Some utility functions for pins manipulation.
More...
#include <Arduino.h>
Go to the source code of this file.
|
template<typename T > |
constexpr uint8_t | bit_clear (T &_dest, const uint8_t bit) |
| Clear the specified bit.
|
|
template<typename T > |
constexpr uint8_t | bit_read (const T &_src, const uint8_t bit) |
| Read the specified bit.
|
|
template<typename T > |
constexpr void | bit_set (T &_dest, const uint8_t bit) |
| Set the specified bit to 1.
|
|
bool | getPinState (const uint8_t pin) |
| Get the Pin State.
|
|
constexpr void | setPinOFF (const uint8_t pin) |
| Set the Pin state to OFF for the specified pin.
|
|
constexpr void | setPinON (const uint8_t pin) |
| Set the Pin state to ON for the specified pin.
|
|
void | setPinsOFF (const uint16_t pins) |
| Set the Pins state to OFF.
|
|
void | setPinsON (const uint16_t pins) |
| Set the Pins state to ON.
|
|
constexpr void | setPinState (const uint8_t pin, const bool bState) |
| Set the Pin state for the specified pin.
|
|
constexpr void | togglePin (const uint8_t pin) |
| Toggle the specified pin.
|
|
Some utility functions for pins manipulation.
- Author
- Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
- Version
- 0.1
- Date
- 2023-05-05
- Copyright
- Copyright (c) 2023
Definition in file utils_pins.h.
◆ bit_clear()
template<typename T >
constexpr uint8_t bit_clear |
( |
T & |
_dest, |
|
|
const uint8_t |
bit |
|
) |
| |
|
constexpr |
Clear the specified bit.
- Template Parameters
-
- Parameters
-
_dest | Integer variable to modify |
bit | Bit to clear in _src |
- Returns
- constexpr uint8_t
Definition at line 72 of file utils_pins.h.
◆ bit_read()
template<typename T >
constexpr uint8_t bit_read |
( |
const T & |
_src, |
|
|
const uint8_t |
bit |
|
) |
| |
|
constexpr |
Read the specified bit.
- Template Parameters
-
- Parameters
-
_src | Integer variable to read |
bit | Bit to read in _src |
- Returns
- constexpr uint8_t
Definition at line 59 of file utils_pins.h.
◆ bit_set()
template<typename T >
constexpr void bit_set |
( |
T & |
_dest, |
|
|
const uint8_t |
bit |
|
) |
| |
|
constexpr |
Set the specified bit to 1.
- Template Parameters
-
- Parameters
-
_dest | Integer variable to modify |
bit | Bit to set in _dest |
Definition at line 46 of file utils_pins.h.
◆ getPinState()
bool getPinState |
( |
const uint8_t |
pin | ) |
|
|
inline |
Get the Pin State.
- Parameters
-
- Returns
- true if HIGH
-
false if LOW
Definition at line 174 of file utils_pins.h.
◆ setPinOFF()
constexpr void setPinOFF |
( |
const uint8_t |
pin | ) |
|
|
inlineconstexpr |
Set the Pin state to OFF for the specified pin.
- Parameters
-
Definition at line 144 of file utils_pins.h.
◆ setPinON()
constexpr void setPinON |
( |
const uint8_t |
pin | ) |
|
|
inlineconstexpr |
Set the Pin state to ON for the specified pin.
- Parameters
-
Definition at line 116 of file utils_pins.h.
◆ setPinsOFF()
Set the Pins state to OFF.
- Parameters
-
Definition at line 161 of file utils_pins.h.
◆ setPinsON()
Set the Pins state to ON.
- Parameters
-
Definition at line 133 of file utils_pins.h.
◆ setPinState()
constexpr void setPinState |
( |
const uint8_t |
pin, |
|
|
const bool |
bState |
|
) |
| |
|
inlineconstexpr |
Set the Pin state for the specified pin.
- Parameters
-
pin | pin to change [2..13] |
bState | state to be set |
Definition at line 99 of file utils_pins.h.
◆ togglePin()
void constexpr togglePin |
( |
const uint8_t |
pin | ) |
|
|
inlineconstexpr |