Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed txn tx n plant init #93

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Speed txn tx n plant init #93

wants to merge 27 commits into from

Conversation

SpeedTxn
Copy link
Collaborator

@SpeedTxn SpeedTxn commented Oct 7, 2017

Just for a dry run!

}
}

#define ONE_BIT_HALF_PERIOD 4480
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're making your own HwInit, you can probably remove the DCC driver. Basically everything starting here down until the tivaDCC object (keep the_port that you added inbetween).

tivaDCC.interrupt_handler();
}

/** PORTA3 interrupt handler.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a5

UART0RX_Pin, UART0TX_Pin, //
BOOSTER_H_Pin, BOOSTER_L_Pin, //
RAILCOM_TRIGGER_Pin, RAILCOM_CH1_Pin, //
CAN0RX_Pin, CAN0TX_Pin> GpioInit;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should list MCP23017_INT_N_Pin here, otherwise it will not be initialized.

SYSCTL_XTAL_16MHZ);

MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
MAP_GPIOPinConfigure(GPIO_PA6_I2C1SCL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line and the next four can be replaced by an entry in the gpio pin initializer in hardware.hxx:
see example

GPIO_HWPIN(BOOSTER_H, GpioHwPin, B, 6, T0CCP0, Timer);

so you would use something like

GPIO_HWPIN(I2C_SCL, GpioHwPin, A, 6, I2C1SCL, I2CSCL);
GPIO_HWPIN(I2C_SDA, GpioHwPin, A, 7, I2C1SDA, I2C);

then add I2C_SDA_Pin and I2C_SCL_Pin into the gpioinit array.

The reason is twofold:

  • consistency with the other declarations
  • it makes sure not to forget any of the pin setup calls. For example here there is a missing call to enable the clock to the gpio peripheral; you were lucky someone else did that earlier but if this was not on port A but say on port C, you would be getting a hard fault here and scratching your head for a while.

//unsigned_integer_to_buffer(i, tmp);
//cfg.seg().producers().entry(i).description().write(fd,tmp);
cfg.seg().producers().entry(i).debounce().write(fd,3);
cfg.seg().producers().entry(i).event_on().write(fd,(NODE_ID << 16) + 8+(i*2) );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have two choices about the event IDs here. What you did here is fine if you want a fixed layout of event IDs for your node. This is not recommended for general purpose nodes; in the standard we recommend always new event IDs to be assigned when a factory reset is performed. I have code for that:

stack.factory_reset_all_events(cfg.seg().internal_config(), fd);

Note you still need the write call for the debounce parameter.

dataInA_ = register_read(GPIOA);
dataInB_ = register_read(GPIOB) << 8;

if (directionShaddow_ != direction_)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to perform a little cleanup here. I also want to support multiple MCP23017's on the same I2C bus with this driver.

*/

#ifndef _FREERTOS_DRIVERS_COMMON_MCP23017GPIO_HXX_
#define _FREERTOS_DRIVERS_COMMON_MCP23017GPIO_HXX_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be in a separate PR.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. If you look closely, there is already another branch for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants