3-phase PV router
Loading...
Searching...
No Matches
utils_pins.h File Reference

Some utility functions for pins manipulation. More...

#include <Arduino.h>
Include dependency graph for utils_pins.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
 

Variables

constexpr uint8_t unused_pin { 0xff }
 

Detailed Description

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

Definition in file utils_pins.h.

Function Documentation

◆ bit_clear()

template<typename T>
uint8_t bit_clear ( T & _dest,
const uint8_t bit )
constexpr

Clear the specified bit.

Template Parameters
TType of the variable
Parameters
_destInteger variable to modify
bitBit to clear in _src
Returns
constexpr uint8_t

Definition at line 80 of file utils_pins.h.

Here is the caller graph for this function:

◆ bit_read()

template<typename T>
uint8_t bit_read ( const T & _src,
const uint8_t bit )
constexpr

Read the specified bit.

Template Parameters
TType of the variable
Parameters
_srcInteger variable to read
bitBit to read in _src
Returns
constexpr uint8_t

Definition at line 67 of file utils_pins.h.

Here is the caller graph for this function:

◆ bit_set()

template<typename T>
void bit_set ( T & _dest,
const uint8_t bit )
constexpr

Set the specified bit to 1.

Template Parameters
TType of the variable
Parameters
_destInteger variable to modify
bitBit to set in _dest

Definition at line 54 of file utils_pins.h.

Here is the caller graph for this function:

◆ getPinState()

bool getPinState ( const uint8_t pin)
inlineconstexpr

Get the Pin State.

Parameters
pinThe pin to read
Returns
true if HIGH
false if LOW

Definition at line 194 of file utils_pins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPinOFF()

void setPinOFF ( const uint8_t pin)
inlineconstexpr

Set the Pin state to OFF for the specified pin.

Parameters
pinpin to change [2..13]

Definition at line 160 of file utils_pins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPinON()

void setPinON ( const uint8_t pin)
inlineconstexpr

Set the Pin state to ON for the specified pin.

Parameters
pinpin to change [2..13]

Definition at line 128 of file utils_pins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPinsAsInputPullup()

void setPinsAsInputPullup ( const uint16_t pins)
inline

Set the pins as INPUT_PULLUP.

Parameters
pinsThe pins to set as INPUT_PULLUP

Definition at line 216 of file utils_pins.h.

Here is the caller graph for this function:

◆ setPinsAsOutput()

void setPinsAsOutput ( const uint16_t pins)
inline

Set the pins as OUTPUT.

Parameters
pinsThe pins to set as OUTPUT

Definition at line 205 of file utils_pins.h.

Here is the caller graph for this function:

◆ setPinsOFF()

void setPinsOFF ( const uint16_t pins)
inline

Set the Pins state to OFF.

Parameters
pinsThe pins to change

Definition at line 181 of file utils_pins.h.

Here is the caller graph for this function:

◆ setPinsON()

void setPinsON ( const uint16_t pins)
inline

Set the Pins state to ON.

Parameters
pinsThe pins to change

Definition at line 149 of file utils_pins.h.

Here is the caller graph for this function:

◆ setPinState()

void setPinState ( const uint8_t pin,
const bool bState )
inlineconstexpr

Set the Pin state for the specified pin.

Parameters
pinpin to change [2..13]
bStatestate to be set

Definition at line 111 of file utils_pins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ togglePin()

void constexpr togglePin ( uint8_t pin)
inlineconstexpr

Toggle the specified pin.

Definition at line 89 of file utils_pins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ unused_pin

uint8_t unused_pin { 0xff }
inlineconstexpr

unused pin

Definition at line 17 of file utils_pins.h.