36#ifndef _OPENLCB_CONFIGUREDPRODUCER_HXX_
37#define _OPENLCB_CONFIGUREDPRODUCER_HXX_
53 Name(
"Description"), Description(
"User name of this input."));
58 Description(
"Amount of time to wait for the input to stabilize before "
59 "producing the event. Unit is 30 msec of time. Usually a value "
60 "of 2-3 works well in a non-noisy environment. In high noise "
61 "(train wheels for example) a setting between 8 -- 15 makes "
62 "for a slower response time but a more stable "
63 "signal.\nFormally, the parameter tells how many times of "
64 "tries, each 30 msec apart, the input must have the same value "
65 "in order for that value to be accepted and the event "
66 "transition produced."),
72 Description(
"This event will be produced when the input goes to HIGH."));
77 Description(
"This event will be produced when the input goes to LOW."));
110 const Gpio *g = HW::instance(),
decltype(HW::instance) * = 0)
121 uint8_t debounce_arg = cfg_.debounce().read(fd);
122 EventId cfg_event_on = cfg_.event_on().read(fd);
123 EventId cfg_event_off = cfg_.event_off().read(fd);
124 if (cfg_event_off != producer_.event_off() ||
125 cfg_event_on != producer_.event_on())
127 auto saved_gpio = producer_.gpio_;
128 auto saved_node = producer_.node();
131 producer_.ProducerClass::~ProducerClass();
134 cfg_event_on, cfg_event_off, saved_gpio);
142 cfg_.description().write(fd,
"");
152 ProducerClass producer_;
153 const ProducerConfig cfg_;
#define CDI_GROUP(GroupName, ARGS...)
Starts a CDI group.
#define CDI_GROUP_ENTRY(NAME, TYPE, ARGS...)
Adds an entry to a CDI group.
#define CDI_FACTORY_RESET(PATH)
Performs factory reset on a CDI variable.
This class sends a notification in its destructor.
A BarrierNotifiable allows to create a number of child Notifiable and wait for all of them to finish.
Abstract class for components that need to receive configuration from EEPROM.
UpdateAction
Specifies what additional steps are needed to apply the new configuration.
@ REINIT_NEEDED
Need to perform application-level reinitialization.
@ UPDATED
No additional step is necessary.
virtual void register_update_listener(ConfigUpdateListener *listener)=0
Adds a config update listener to be called upon configuration updates.
OS-independent abstraction for GPIO.
uint8_t Options
Type declaring what opeions we can supply to this class.
static ConfigUpdateService * instance()
Implementation class for event ID configuration entries.
Simple implementation of the BitEventInterface for going through GPIO ports.
Base class for NMRAnet nodes conforming to the asynchronous interface.
Implementation class for numeric configuration entries, templated by the integer type.
Abstract base class for components that need repeated execution (with a specified frequency,...
Implementation class for string configuration entries.
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
CDI_GROUP_END()
Signals termination of the group.