LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
Indicator Class Reference

Represents a state indicator for one or more attached actuators, indicators are normally connected to a digital out. More...

#include <indicator.hpp>

Collaboration diagram for Indicator:
Collaboration graph

Public Member Functions

LSH_OPTIONAL_CONSTEXPR_CTOR Indicator (uint8_t pin) noexcept
 Construct a new Indicator object using standard I/O.
 
template<uint8_t Pin>
LSH_OPTIONAL_CONSTEXPR_CTOR Indicator (lsh::core::PinTag< Pin >) noexcept
 Construct an indicator from a compile-time pin tag on the slow-I/O path.
 
void setState (bool stateToSet)
 Set the state of the indicator.
 
void applyComputedState (bool newState)
 
void setIndex (uint8_t indexToSet)
 Set the indicator index on Indicators namespace Array.
 
void check ()
 Switch the indicator based on controlled actuators status.
 
auto getIndex () const -> uint8_t
 Get the indicator index on Indicators namespace Array.
 

Detailed Description

Represents a state indicator for one or more attached actuators, indicators are normally connected to a digital out.

Constructor & Destructor Documentation

◆ Indicator() [1/2]

LSH_OPTIONAL_CONSTEXPR_CTOR Indicator::Indicator ( uint8_t  pin)
inlineexplicitnoexcept

Construct a new Indicator object using standard I/O.

Parameters
pinThe Arduino pin number for the indicator.

◆ Indicator() [2/2]

template<uint8_t Pin>
LSH_OPTIONAL_CONSTEXPR_CTOR Indicator::Indicator ( lsh::core::PinTag< Pin >  )
inlineexplicitnoexcept

Construct an indicator from a compile-time pin tag on the slow-I/O path.

This keeps the public DSL consistent across builds even when the target does not use the AVR fast-I/O backend.

Member Function Documentation

◆ check()

void Indicator::check ( )

Switch the indicator based on controlled actuators status.

The behavior depends on mode setting:

If mode = ANY -> If any controlled actuator is ON switch ON the indicator, OFF otherwise. If mode = ALL -> If all controlled actuators are ON switch ON the indicator, OFF otherwise. If mode = MAJORITY -> If the majority of controlled actuators are ON switch ON the indicator, OFF otherwise.

Indicators with zero controlled actuators are treated as OFF here as a final safety net, even though setup validation should already reject that config.

◆ getIndex()

auto Indicator::getIndex ( ) const -> uint8_t

Get the indicator index on Indicators namespace Array.

Returns
uint8_t indicator index.

◆ setIndex()

void Indicator::setIndex ( uint8_t  indexToSet)

Set the indicator index on Indicators namespace Array.

Parameters
indexToSetindex to set.

◆ setState()

void Indicator::setState ( bool  stateToSet)
inline

Set the state of the indicator.

Parameters
stateToSetthe state to set true=ON, false=OFF.

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