|
Open Model Railroad Network (OpenMRN)
|
Basically a specialized ConfiguredConsumer. More...
#include <ServoConsumer.hxx>
Public Member Functions | |
| ServoConsumer (Node *node, const ServoConsumerConfig &cfg, const uint32_t pwmCountPerMs, PWM *pwm) | |
| UpdateAction | apply_configuration (int fd, bool initial_load, BarrierNotifiable *done) OVERRIDE |
| Notifies the component that there is new configuration available for loading. | |
| void | factory_reset (int fd) OVERRIDE |
| Clears configuration file and resets the configuration settings to factory value. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Private Attributes | |
| const uint32_t | pwmCountPerMs_ |
| Used to compute PWM ticks for max/min servo rotation. | |
| PWM * | pwm_ |
| timer channel. not owned; lives forever | |
| std::unique_ptr< PWMGPO > | pwmGpo_ |
| all the rest are owned and must be reset on config change. | |
| GPIOBit | gpioImpl_ |
| BitEventConsumer | consumer_ |
| has on/off events, Node*, and Gpio* | |
| const ServoConsumerConfig | cfg_ |
| has GPIOBit* | |
Additional Inherited Members | |
Public Types inherited from ConfigUpdateListener | |
| enum | UpdateAction { UPDATED = 0 , REINIT_NEEDED , REBOOT_NEEDED } |
| Specifies what additional steps are needed to apply the new configuration. More... | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Basically a specialized ConfiguredConsumer.
Can't subclass ConfiguredConsumer here because ServoConsumerConfig isn't a subclass of ConsumerConfig,
Definition at line 21 of file ServoConsumer.hxx.
|
inline |
Definition at line 24 of file ServoConsumer.hxx.
|
inlinevirtual |
Notifies the component that there is new configuration available for loading.
The call is made on the main executor, so the call must not block. Reading the given EEPROM device should be fine. Asynchronous operations may be implemented by using a special return status RETRY: the runner will call the same method on the same component once more after the done callback is invoked. This allows implementing state machines.
| fd | is the file descriptor for the EEPROM file. The current offset in this file is unspecified, callees must do lseek. |
| initial_load | is true if this is the first load upon starting the binary. |
| done | must be notified when the call and its dependent actions are complete. No other configuration component will be called until the done callback is invoked. |
Implements ConfigUpdateListener.
Definition at line 36 of file ServoConsumer.hxx.
|
inlinevirtual |
Clears configuration file and resets the configuration settings to factory value.
| fd | is the file descriptor for the EEPROM file. The current offset in this file is unspecified, callees must do lseek. |
Implements ConfigUpdateListener.
Definition at line 90 of file ServoConsumer.hxx.
|
private |
has GPIOBit*
Definition at line 110 of file ServoConsumer.hxx.
|
private |
has on/off events, Node*, and Gpio*
Definition at line 109 of file ServoConsumer.hxx.
|
private |
Definition at line 108 of file ServoConsumer.hxx.
|
private |
timer channel. not owned; lives forever
Definition at line 102 of file ServoConsumer.hxx.
|
private |
Used to compute PWM ticks for max/min servo rotation.
Definition at line 99 of file ServoConsumer.hxx.
|
private |
all the rest are owned and must be reset on config change.
pwmGpo_ heap-allocated because it's nullptr until first config.
Definition at line 106 of file ServoConsumer.hxx.