Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::GPIOBit Class Reference

Simple implementation of the BitEventInterface for going through GPIO ports. More...

#include <EventHandlerTemplates.hxx>

Inheritance diagram for openlcb::GPIOBit:
openlcb::BitEventInterface

Public Member Functions

 GPIOBit (Node *node, EventId event_on, EventId event_off, const Gpio *gpio)
 
template<class HW >
 GPIOBit (Node *node, EventId event_on, EventId event_off, const HW &, const Gpio *g=HW::instance(), decltype(HW::instance) *=0)
 
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.
 
Nodenode () OVERRIDE
 returns the OpenLCB virtual node from which to send the respective events when the bit changes.
 
- 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.
 

Public Attributes

Nodenode_
 
const Gpiogpio_
 

Detailed Description

Simple implementation of the BitEventInterface for going through GPIO ports.

The port getter and setter are taken as a GPIO* pointer.

Definition at line 494 of file EventHandlerTemplates.hxx.

Constructor & Destructor Documentation

◆ GPIOBit() [1/2]

openlcb::GPIOBit::GPIOBit ( Node node,
EventId  event_on,
EventId  event_off,
const Gpio gpio 
)
inline

Definition at line 497 of file EventHandlerTemplates.hxx.

◆ GPIOBit() [2/2]

template<class HW >
openlcb::GPIOBit::GPIOBit ( Node node,
EventId  event_on,
EventId  event_off,
const HW &  ,
const Gpio g = HW::instance(),
decltype(HW::instance) *  = 0 
)
inline

Definition at line 505 of file EventHandlerTemplates.hxx.

Member Function Documentation

◆ get_current_state()

EventState openlcb::GPIOBit::get_current_state ( )
inlinevirtual

returns the current hardware state: true for ON, false for OFF.

Implements openlcb::BitEventInterface.

Definition at line 510 of file EventHandlerTemplates.hxx.

◆ node()

Node * openlcb::GPIOBit::node ( )
inlinevirtual

returns the OpenLCB virtual node from which to send the respective events when the bit changes.

Implements openlcb::BitEventInterface.

Definition at line 518 of file EventHandlerTemplates.hxx.

◆ set_state()

void openlcb::GPIOBit::set_state ( bool  new_value)
inlinevirtual

Updates the hardware for the new event state.

Parameters
new_valueis true for state ON, false for state OFF.

Implements openlcb::BitEventInterface.

Definition at line 514 of file EventHandlerTemplates.hxx.

Member Data Documentation

◆ gpio_

const Gpio* openlcb::GPIOBit::gpio_

Definition at line 525 of file EventHandlerTemplates.hxx.

◆ node_

Node* openlcb::GPIOBit::node_

Definition at line 524 of file EventHandlerTemplates.hxx.


The documentation for this class was generated from the following file: