Represents an actuator (relay) attached to a digital pin. More...
#include <actuator.hpp>

Public Member Functions | |
| LSH_OPTIONAL_CONSTEXPR_CTOR | Actuator (uint8_t pin, bool normalState=false) noexcept |
| Construct a new Actuator object, conventional IO version. | |
| template<uint8_t Pin> | |
| LSH_OPTIONAL_CONSTEXPR_CTOR | Actuator (lsh::core::PinTag< Pin >, bool normalState=false) noexcept |
| Construct an actuator from a compile-time pin tag on the slow-I/O path. | |
| auto | setState (bool state) -> bool |
| Set the new actuator state if the new state can be set. | |
| auto | setState (bool state, uint32_t now_ms) -> bool |
| Set the new actuator state if the new state can be set. | |
| auto | setStateForIndex (uint8_t actuatorIndex, bool state) -> bool |
| Set the new actuator state with a generated dense runtime index. | |
| auto | setStateForIndex (uint8_t actuatorIndex, bool state, uint32_t now_ms) -> bool |
| Set the new actuator state with generated index and cached timestamp. | |
| template<uint8_t ActuatorIndex> | |
| auto | setStateStatic (bool state) -> bool |
| template<uint8_t ActuatorIndex> | |
| auto | setStateStatic (bool state, uint32_t now_ms) -> bool |
| void | setIndex (uint8_t indexToSet) |
| store the actuator index in Actuators namespace array. | |
| auto | setProtected (bool hasProtection) -> Actuator & |
| Set protection against some turn ON/OFF behaviour. | |
| auto | getIndex () const -> uint8_t |
| Get the actuator index on Actuators namespace array. | |
| auto | getState () const -> bool |
| Get the state of the actuator. | |
| auto | toggleState () -> bool |
| Switch the state of the actuator (if it was OFF is going to be ON and vice versa). | |
| auto | toggleState (uint32_t now_ms) -> bool |
| Switch the state of the actuator using a caller-cached timestamp. | |
| auto | toggleStateForIndex (uint8_t actuatorIndex) -> bool |
| Toggle the actuator with a generated dense runtime index. | |
| auto | toggleStateForIndex (uint8_t actuatorIndex, uint32_t now_ms) -> bool |
| Toggle the actuator with generated index and caller-cached timestamp. | |
| template<uint8_t ActuatorIndex> | |
| auto | toggleStateStatic () -> bool |
| template<uint8_t ActuatorIndex> | |
| auto | toggleStateStatic (uint32_t now_ms) -> bool |
| auto | checkAutoOffTimer (uint32_t now_ms, uint32_t autoOffTimer_ms) -> bool |
| Checks the provided auto-off timer, switch OFF the actuator if it's over. | |
| auto | checkAutoOffTimerForIndex (uint8_t actuatorIndex, uint32_t now_ms, uint32_t autoOffTimer_ms) -> bool |
| Checks an auto-off timer with the generated dense actuator index. | |
Represents an actuator (relay) attached to a digital pin.
|
inlineexplicitnoexcept |
Construct a new Actuator object, conventional IO version.
| pin | pin number |
| normalState | the default state of the actuator. |
|
inlineexplicitnoexcept |
Construct an actuator from a compile-time pin tag on the slow-I/O path.
The tag keeps the public macro surface uniform even when fast I/O is disabled or unavailable for the current build target.
| auto Actuator::checkAutoOffTimer | ( | uint32_t | now_ms, |
| uint32_t | autoOffTimer_ms | ||
| ) | -> bool |
Checks the provided auto-off timer, switch OFF the actuator if it's over.
| now_ms | caller-cached current time in milliseconds. |
| autoOffTimer_ms | auto-off timer to test. |
| auto Actuator::checkAutoOffTimerForIndex | ( | uint8_t | actuatorIndex, |
| uint32_t | now_ms, | ||
| uint32_t | autoOffTimer_ms | ||
| ) | -> bool |
Checks an auto-off timer with the generated dense actuator index.
| actuatorIndex | Dense static-profile actuator index. |
| now_ms | caller-cached current time in milliseconds. |
| autoOffTimer_ms | auto-off timer to test. |
| auto Actuator::getIndex | ( | ) | const -> uint8_t |
Get the actuator index on Actuators namespace array.
| auto Actuator::getState | ( | ) | const -> bool |
Get the state of the actuator.
| void Actuator::setIndex | ( | uint8_t | indexToSet | ) |
store the actuator index in Actuators namespace array.
| indexToSet | index to set. |
| auto Actuator::setProtected | ( | bool | hasProtection | ) | -> Actuator & |
Set protection against some turn ON/OFF behaviour.
| hasProtection | to set the property. |
| auto Actuator::setState | ( | bool | state | ) | -> bool |
Set the new actuator state if the new state can be set.
| state | new state to set. |

| auto Actuator::setState | ( | bool | state, |
| uint32_t | now_ms | ||
| ) | -> bool |
Set the new actuator state if the new state can be set.
| state | new state to set. |
| now_ms | caller-cached timestamp used when debounce or auto-off storage needs it. |
| auto Actuator::setStateForIndex | ( | uint8_t | actuatorIndex, |
| bool | state | ||
| ) | -> bool |
Set the new actuator state with a generated dense runtime index.
| actuatorIndex | Dense static-profile actuator index. |
| state | new state to set. |

| auto Actuator::setStateForIndex | ( | uint8_t | actuatorIndex, |
| bool | state, | ||
| uint32_t | now_ms | ||
| ) | -> bool |
Set the new actuator state with generated index and cached timestamp.
| actuatorIndex | Dense static-profile actuator index. |
| state | new state to set. |
| now_ms | caller-cached timestamp used when debounce or auto-off storage needs it. |
| auto Actuator::toggleState | ( | ) | -> bool |
Switch the state of the actuator (if it was OFF is going to be ON and vice versa).
| auto Actuator::toggleState | ( | uint32_t | now_ms | ) | -> bool |
Switch the state of the actuator using a caller-cached timestamp.
| now_ms | cached timestamp shared by a generated action body. |
| auto Actuator::toggleStateForIndex | ( | uint8_t | actuatorIndex | ) | -> bool |
Toggle the actuator with a generated dense runtime index.
| actuatorIndex | Dense static-profile actuator index. |
| auto Actuator::toggleStateForIndex | ( | uint8_t | actuatorIndex, |
| uint32_t | now_ms | ||
| ) | -> bool |
Toggle the actuator with generated index and caller-cached timestamp.
| actuatorIndex | Dense static-profile actuator index. |
| now_ms | cached timestamp shared by a generated action body. |