|
Open Model Railroad Network (OpenMRN)
|
Railcom driver for STM32-class microcontrollers using the HAL middleware library. More...
#include <Stm32Railcom.hxx>
Public Member Functions | |
| Stm32RailcomDriver (const char *path) | |
| Constructor. | |
Public Member Functions inherited from RailcomDriverBase< HW > | |
| RailcomDriverBase (const char *name) | |
| Constructor. | |
| void | os_interrupt_handler () |
| Implementation of the interrupt handler running at the kernel interrupt priority. | |
| RailcomDriverBase (const char *name) | |
| Constructor. | |
| void | os_interrupt_handler () |
| Implementation of the interrupt handler running at the kernel interrupt priority. | |
Public Member Functions inherited from RailcomDriver | |
| virtual void | send_ch1 (const DCCFeedback *ch1_pkt) |
| Specifies what packet should be sent for the channel1 cutout. | |
| virtual void | send_ch2 (const DCCFeedback *ch2_pkt) |
| Specifies what packet should be sent for the channel2 cutout. | |
Private Member Functions | |
| void | int_set_pending (unsigned int_nr) override |
| Sets a given software interrupt pending. | |
| void | enable () OVERRIDE |
| This will be called once when reference-count goes from 0 to positive. | |
| void | disable () override |
| This will be called when reference count goes from non-zero to 0. | |
| void | feedback_sample () override |
| Call to the driver for sampling the current sensors. | |
| void | start_cutout () override |
| Instructs the driver that the railcom cutout is starting now. | |
| void | middle_cutout () override |
| Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting. | |
| void | end_cutout () override |
| Instructs the driver that the railcom cutout is over now. | |
| void | no_cutout () override |
| Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested. | |
Static Private Member Functions | |
| static constexpr USART_TypeDef * | uart (unsigned i) |
| static constexpr DMA_Channel_TypeDef * | dma_ch (unsigned i) |
Private Attributes | |
| bool | inCutout_ = false |
| True when we are currently within a cutout. | |
Additional Inherited Members | |
Protected Member Functions inherited from RailcomDriverBase< HW > | |
| dcc::Feedback * | alloc_new_packet (uint8_t channel) |
| Takes a new empty packet at the front of the queue, fills in feedback key and channel information. | |
| void | add_sample (int sample) |
| Adds a sample for a preamble bit. | |
| dcc::Feedback * | alloc_new_packet (uint8_t channel) |
| Takes a new empty packet at the front of the queue, fills in feedback key and channel information. | |
| void | add_sample (int sample) |
| Adds a sample for a preamble bit. | |
Protected Attributes inherited from RailcomDriverBase< HW > | |
| Notifiable * | readableNotifiable_ |
| Notify this when we have data in our buffers. | |
| FixedQueue< dcc::Feedback, HW::Q_SIZE > | feedbackQueue_ |
| The packets we have read so far. | |
| uint32_t | feedbackKey_ |
| Stores the key for the next packets to read. | |
| dcc::Feedback * | returnedPackets_ [HW::CHANNEL_COUNT] |
| Stores pointers to packets we are filling right now, one for each channel. | |
Railcom driver for STM32-class microcontrollers using the HAL middleware library.
This railcom driver supports parallel polling of multiple UART channels for the railcom data.
Definition at line 166 of file Stm32Railcom.hxx.
|
inline |
Constructor.
| path | is the device node path (e.g. "/dev/railcom0"). |
Definition at line 170 of file Stm32Railcom.hxx.
|
inline |
Definition at line 181 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
This will be called when reference count goes from non-zero to 0.
Called with lock_ held.
Implements Node.
Definition at line 258 of file Stm32Railcom.hxx.
|
inlinestaticconstexprprivate |
| i | channel number (0..HW::NUM_CHANNEL) |
Definition at line 201 of file Stm32Railcom.hxx.
|
inlineprivatevirtual |
This will be called once when reference-count goes from 0 to positive.
Called with lock_ held.
Implements Node.
Definition at line 214 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Instructs the driver that the railcom cutout is over now.
The driver will use this information to disable the UART receiver.
Implements RailcomDriver.
Definition at line 357 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Call to the driver for sampling the current sensors.
This call is performed repeatedly, in a configurable interval, on the next positive edge.
Implements RailcomDriver.
Definition at line 267 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Sets a given software interrupt pending.
| int_nr | interrupt number (will be HW::OS_INTERRUPT) |
Implements RailcomDriverBase< HW >.
Definition at line 208 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting.
The driver will use this information to separate channel 1 nd channel 2 data.
Implements RailcomDriver.
Definition at line 303 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested.
Implements RailcomDriver.
Definition at line 412 of file Stm32Railcom.hxx.
|
inlineoverrideprivatevirtual |
Instructs the driver that the railcom cutout is starting now.
The driver will use this information to enable the UART receiver.
Implements RailcomDriver.
Definition at line 274 of file Stm32Railcom.hxx.
|
inlinestaticconstexprprivate |
| i | channel number (0..HW::NUM_CHANNEL) |
Definition at line 194 of file Stm32Railcom.hxx.
|
private |
True when we are currently within a cutout.
Definition at line 188 of file Stm32Railcom.hxx.