|
Open Model Railroad Network (OpenMRN)
|
Simple implementation of a BitEventInterface when the true state ofthe variable is mapped in memory (e.g. More...
#include <EventHandlerTemplates.hxx>
Public Member Functions | |
| MemoryBit (Node *node, uint64_t event_on, uint64_t event_off, T *ptr, T mask) | |
| Node * | node () override |
| returns the OpenLCB virtual node from which to send the respective events when the bit changes. | |
| EventState | get_current_state () override |
| returns the current hardware state: true for ON, false for OFF. | |
| void | set_state (bool new_value) override |
| Updates the hardware for the new event state. | |
Public Member Functions inherited from openlcb::BitEventInterface | |
| BitEventInterface (uint64_t event_on, uint64_t event_off) | |
| virtual EventState | get_requested_state () |
| Get the requested state. | |
| uint64_t | event_on () |
| returns the event ID for representing the state transition OFF->ON. | |
| uint64_t | event_off () |
| returns the event ID for representing the state transition ON->OFF. | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (MemoryBit) | |
Private Attributes | |
| Node * | node_ |
| T * | ptr_ |
| T | mask_ |
Simple implementation of a BitEventInterface when the true state ofthe variable is mapped in memory (e.g.
mmap-ed gpio, or if there is no real hardware but a bit in RAM).
The template argument is the C++ type of the raw pointer, usually uint32_t or uint8_t.
Definition at line 447 of file EventHandlerTemplates.hxx.
|
inline |
| ptr | defines the memory address of the bit where the hardware state is located in the address space. |
| mask | defines which bit at that address. If there are multiple bits set in mask, they will all be set/cleared for output purposes, and if any of them is set, the input will be considered on. |
Definition at line 456 of file EventHandlerTemplates.hxx.
|
inlineoverridevirtual |
returns the current hardware state: true for ON, false for OFF.
Implements openlcb::BitEventInterface.
Definition at line 468 of file EventHandlerTemplates.hxx.
|
inlineoverridevirtual |
returns the OpenLCB virtual node from which to send the respective events when the bit changes.
Implements openlcb::BitEventInterface.
Definition at line 464 of file EventHandlerTemplates.hxx.
|
inlineoverridevirtual |
Updates the hardware for the new event state.
| new_value | is true for state ON, false for state OFF. |
Implements openlcb::BitEventInterface.
Definition at line 472 of file EventHandlerTemplates.hxx.
|
private |
Definition at line 487 of file EventHandlerTemplates.hxx.
|
private |
Definition at line 485 of file EventHandlerTemplates.hxx.
|
private |
Definition at line 486 of file EventHandlerTemplates.hxx.