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.
|
| |
| constexpr 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 | setPinsAsInputPullup (const uint16_t pins) |
| | Set the pins as INPUT_PULLUP.
|
| |
| void | setPinsAsOutput (const uint16_t pins) |
| | Set the pins as OUTPUT.
|
| |
| 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>
| 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 80 of file utils_pins.h.
◆ bit_read()
template<typename T>
| 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 67 of file utils_pins.h.
◆ bit_set()
template<typename T>
| 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 54 of file utils_pins.h.
◆ getPinState()
| bool getPinState |
( |
const uint8_t | pin | ) |
|
|
inlineconstexpr |
Get the Pin State.
- Parameters
-
- Returns
- true if HIGH
-
false if LOW
Definition at line 194 of file utils_pins.h.
◆ setPinOFF()
| void setPinOFF |
( |
const uint8_t | pin | ) |
|
|
inlineconstexpr |
Set the Pin state to OFF for the specified pin.
- Parameters
-
Definition at line 160 of file utils_pins.h.
◆ setPinON()
| void setPinON |
( |
const uint8_t | pin | ) |
|
|
inlineconstexpr |
Set the Pin state to ON for the specified pin.
- Parameters
-
Definition at line 128 of file utils_pins.h.
◆ setPinsAsInputPullup()
| void setPinsAsInputPullup |
( |
const uint16_t | pins | ) |
|
|
inline |
Set the pins as INPUT_PULLUP.
- Parameters
-
| pins | The pins to set as INPUT_PULLUP |
Definition at line 226 of file utils_pins.h.
◆ setPinsAsOutput()
| void setPinsAsOutput |
( |
const uint16_t | pins | ) |
|
|
inline |
Set the pins as OUTPUT.
- Parameters
-
| pins | The pins to set as OUTPUT |
Definition at line 215 of file utils_pins.h.
◆ setPinsOFF()
| void setPinsOFF |
( |
const uint16_t | pins | ) |
|
|
inline |
Set the Pins state to OFF.
- Parameters
-
Definition at line 181 of file utils_pins.h.
◆ setPinsON()
| void setPinsON |
( |
const uint16_t | pins | ) |
|
|
inline |
Set the Pins state to ON.
- Parameters
-
Definition at line 149 of file utils_pins.h.
◆ setPinState()
| 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 111 of file utils_pins.h.
◆ togglePin()
| void constexpr togglePin |
( |
uint8_t | pin | ) |
|
|
inlineconstexpr |
◆ unused_pin
| uint8_t unused_pin { 0xff } |
|
inlineconstexpr |