Speed txn tx n plant init#93
Conversation
| } | ||
| } | ||
|
|
||
| #define ONE_BIT_HALF_PERIOD 4480 |
There was a problem hiding this comment.
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. |
| UART0RX_Pin, UART0TX_Pin, // | ||
| BOOSTER_H_Pin, BOOSTER_L_Pin, // | ||
| RAILCOM_TRIGGER_Pin, RAILCOM_CH1_Pin, // | ||
| CAN0RX_Pin, CAN0TX_Pin> GpioInit; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) ); |
There was a problem hiding this comment.
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_) |
There was a problem hiding this comment.
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_ |
There was a problem hiding this comment.
this should probably be in a separate PR.
There was a problem hiding this comment.
I agree. If you look closely, there is already another branch for this.
…ng the same thread instance.
# Conflicts: # src/freertos_drivers/sources
…bakerstu-mcp23017
Just for a dry run!