OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
qOS::input::watcher Class Reference

The digital input-channel watcher class. More...

#include <input.hpp>

Inheritance diagram for qOS::input::watcher:
[legend]
Collaboration diagram for qOS::input::watcher:
[legend]

Public Member Functions

 watcher (const qOS::duration_t dt=100_ms)
 Constructor for the input-watcher instance.
 
 watcher (const digitalReaderFcn_t &rDigital, const analogReaderFcn_t &rAnalog, const qOS::duration_t timeDebounce=100_ms)
 Constructor for the input-watcher instance.
 
bool add (channel &c) noexcept
 Add a channel to the watcher instance.
 
bool add (channel &c, eventCallback_t cb) noexcept
 Add a channel to the watcher instance.
 
bool add (channel &c, digitalReaderFcn_t fcn, eventCallback_t cb) noexcept
 Add a channel to the watcher instance.
 
bool add (channel &c, analogReaderFcn_t fcn, eventCallback_t cb) noexcept
 Add a channel to the watcher instance.
 
bool remove (channel &c) noexcept
 Remove a channel to the watcher instance.
 
bool watch (void) noexcept
 Watch for the state and events for all channels registered inside the watcher instance (Non-Blocking call).
 

Additional Inherited Members

- Protected Member Functions inherited from qOS::node
listgetContainer (void) noexcept
 Get a pointer to the list in which this node is contained.
 
 node ()
 

Detailed Description

The digital input-channel watcher class.

Constructor & Destructor Documentation

◆ watcher() [1/2]

qOS::input::watcher::watcher ( const qOS::duration_t dt = 100_ms)
inline

Constructor for the input-watcher instance.

Parameters
[in]timeDebounceThe specified time to bypass the bounce of the digital input channels

◆ watcher() [2/2]

qOS::input::watcher::watcher ( const digitalReaderFcn_t & rDigital,
const analogReaderFcn_t & rAnalog,
const qOS::duration_t timeDebounce = 100_ms )
inline

Constructor for the input-watcher instance.

Parameters
[in]rDigitalA pointer to a function that reads the specific digital input channel
[in]rAnalogA pointer to a function that reads the specific analog input channel
[in]dtThe specified time to bypass the bounce of the digital input channels. Is also used as sample time on analog input channels to trigger input::event::STEP and input::event::DELTA events.

Member Function Documentation

◆ add() [1/4]

bool qOS::input::watcher::add ( channel & c)
noexcept

Add a channel to the watcher instance.

Parameters
[in]cThe input-Channel to watch
Returns
true on success. Otherwise false.

◆ add() [2/4]

bool qOS::input::watcher::add ( channel & c,
analogReaderFcn_t fcn,
eventCallback_t cb )
inlinenoexcept

Add a channel to the watcher instance.

Parameters
[in]cThe input-Channel to watch
[in]fcnThe reader function for the analog channel
[in]cbThe callback function for the input-channel
Returns
true on success. Otherwise false.

◆ add() [3/4]

bool qOS::input::watcher::add ( channel & c,
digitalReaderFcn_t fcn,
eventCallback_t cb )
inlinenoexcept

Add a channel to the watcher instance.

Parameters
[in]cThe input-Channel to watch
[in]fcnThe reader function for the digital channel
[in]cbThe callback function for the input-channel
Returns
true on success. Otherwise false.

◆ add() [4/4]

bool qOS::input::watcher::add ( channel & c,
eventCallback_t cb )
inlinenoexcept

Add a channel to the watcher instance.

Parameters
[in]cThe input-Channel to watch
[in]cbThe callback function for the input-channel
Returns
true on success. Otherwise false.

◆ remove()

bool qOS::input::watcher::remove ( channel & c)
noexcept

Remove a channel to the watcher instance.

Parameters
[in]cThe input-Channel to watch
Returns
true on success. Otherwise false.

◆ watch()

bool qOS::input::watcher::watch ( void )
noexcept

Watch for the state and events for all channels registered inside the watcher instance (Non-Blocking call).

Returns
true when the input channels have been completed an updated cycle. Otherwise false.