4#include "include/types.hpp"
5#include "include/list.hpp"
6#include "include/timer.hpp"
7#include "include/helper.hpp"
102 void *userData{
nullptr };
107 virtual void updateReading(
bool act )
noexcept = 0;
108 virtual void evaluateState(
void )
noexcept = 0;
109 virtual bool isValidConfig(
void )
const noexcept = 0;
110 virtual void setInitalState(
void )
noexcept = 0;
111 inline void dispatchEvent(
event e )
noexcept
120 channel( uint8_t channelNumber ) noexcept : number( channelNumber ) {}
144 return ( cb != callback );
151 inline bool setChannel(
const uint8_t inputChannel )
noexcept
153 bool retValue =
false;
155 if ( inputChannel < 32U ) {
156 number = inputChannel;
176 userData = pUserData;
211 virtual uint8_t
getCount(
void )
const noexcept = 0;
226 using channelStateFcn_t = void(*)( digitalChannel& );
231 channelStateFcn_t channelState{
nullptr };
232 bool negate{
false };
234 uint8_t pulsationCount{ 0 };
235 void updateReading(
bool act )
noexcept override;
236 void setInitalState(
void )
noexcept override;
237 bool isValidConfig(
void )
const noexcept override
241 void evaluateState(
void )
noexcept override
243 channelState( *
this );
245 static void fallingEdgeState( digitalChannel& c );
246 static void risingEdgeState( digitalChannel& c );
247 static void steadyInHighState( digitalChannel& c );
248 static void steadyInLowState( digitalChannel& c );
249 digitalChannel( digitalChannel
const& ) =
delete;
250 void operator=( digitalChannel
const& ) =
delete;
253 virtual ~digitalChannel() {}
260 explicit digitalChannel(
const uint8_t inputChannel,
bool invert =
false ) noexcept :
channel( inputChannel ), negate( invert) {}
290 return pulsationCount;
299 return ( &value != ptrValue );
318 bool unShare(
void )
noexcept override
331 using channelStateFcn_t = void(*)( analogChannel& );
336 channelStateFcn_t channelState{
nullptr };
346 void updateReading(
bool act )
noexcept override;
347 void setInitalState(
void )
noexcept override;
348 bool isValidConfig(
void )
const noexcept override
350 return ( high - low ) > hysteresis;
352 void evaluateState(
void )
noexcept override
354 channelState( *
this );
356 static void lowThresholdState( analogChannel& c );
357 static void highThresholdState( analogChannel& c );
358 static void inBandState( analogChannel& c );
359 static void steadyInHighState( analogChannel& c );
360 static void steadyInLowState( analogChannel& c );
361 static void steadyInBandState( analogChannel& c );
362 analogChannel( analogChannel
const& ) =
delete;
363 void operator=( analogChannel
const& ) =
delete;
366 virtual ~analogChannel() {}
378 high( upperThreshold ),
379 low( lowerThreshold ),
419 return ( &value != ptrValue );
459 list digitalChannels;
487 debounceTime( timeDebounce ), digitalReader( rDigital ), analogReader( rAnalog ) {}
502 (void)c.setCallback( cb );
515 (void)c.setCallback( cb );
517 (void)c.setReader( fcn );
530 (void)c.setCallback( cb );
532 (void)c.setReader( fcn );
549 inline bool operator()(
void )
A list object (Generic double-linked)
Definition list.hpp:119
A non-blocking Timer object.
Definition timer.hpp:26
timeCount_t duration_t
The typedef that specified an time quantity, usually expressed in milliseconds.
Definition clock.hpp:18
timeCount_t clock_t
A unsigned integer to hold ticks count. Epochs counter.
Definition clock.hpp:15
OS/Kernel interfaces.
Definition bytebuffer.hpp:7