Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::PolledProducer< Debouncer, BaseBit > Class Template Reference

Producer class for GPIO bits. More...

#include <PolledProducer.hxx>

Inheritance diagram for openlcb::PolledProducer< Debouncer, BaseBit >:
openlcb::Polling

Public Member Functions

template<typename... Fields>
 PolledProducer (const typename Debouncer::Options &debounce_args, Fields... bit_args)
 
EventState get_current_state () OVERRIDE
 
void set_state (bool new_value) OVERRIDE
 
void poll_33hz (WriteHelper *helper, Notifiable *done) OVERRIDE
 This function will be called approximately 33 times per second by the refresh loop.
 

Private Attributes

Debouncer debouncer_
 
BitEventProducer producer_
 

Detailed Description

template<class Debouncer, class BaseBit>
class openlcb::PolledProducer< Debouncer, BaseBit >

Producer class for GPIO bits.

Polls the hardware state at a given frequency, applies a debouncing algorithm, and when the output of the devbouncing algorithm changes, requests the Producer class to update (i.e., generate the event report message to the OpenLCB bus).

Definition at line 48 of file PolledProducer.hxx.

Constructor & Destructor Documentation

◆ PolledProducer()

template<class Debouncer , class BaseBit >
template<typename... Fields>
openlcb::PolledProducer< Debouncer, BaseBit >::PolledProducer ( const typename Debouncer::Options &  debounce_args,
Fields...  bit_args 
)
inline

Definition at line 52 of file PolledProducer.hxx.

Member Function Documentation

◆ get_current_state()

template<class Debouncer , class BaseBit >
EventState openlcb::PolledProducer< Debouncer, BaseBit >::get_current_state ( )
inline

Definition at line 61 of file PolledProducer.hxx.

◆ poll_33hz()

template<class Debouncer , class BaseBit >
void openlcb::PolledProducer< Debouncer, BaseBit >::poll_33hz ( WriteHelper helper,
Notifiable done 
)
inlinevirtual

This function will be called approximately 33 times per second by the refresh loop.

It must notify done when it is finished using the writehelper.

Implements openlcb::Polling.

Definition at line 71 of file PolledProducer.hxx.

◆ set_state()

template<class Debouncer , class BaseBit >
void openlcb::PolledProducer< Debouncer, BaseBit >::set_state ( bool  new_value)
inline

Definition at line 66 of file PolledProducer.hxx.

Member Data Documentation

◆ debouncer_

template<class Debouncer , class BaseBit >
Debouncer openlcb::PolledProducer< Debouncer, BaseBit >::debouncer_
private

Definition at line 84 of file PolledProducer.hxx.

◆ producer_

template<class Debouncer , class BaseBit >
BitEventProducer openlcb::PolledProducer< Debouncer, BaseBit >::producer_
private

Definition at line 85 of file PolledProducer.hxx.


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