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

The edges of the active-LOW input pins: pressed, released, or no change. More...

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

Go to the source code of this file.

Classes

struct  PinEdges
 State of an active-LOW input pin, and how it changed since the previous reading. More...
 

Functions

constexpr bool isRotationRequested (const PinEdges &pin, const bool bOverridden)
 Tells whether the rotation pin asks for a rotation now.
 
constexpr PinEdges pinEdges (const bool wasActive, const bool active)
 The edges of a pin, from its previous level and its current one.
 
template<uint8_t pin>
PinEdges trackPinEdges (const bool active)
 Gives the edges of a pin from its current level, and keeps that level for the next call.
 

Detailed Description

The edges of the active-LOW input pins: pressed, released, or no change.

Author
Frédéric Metrich (frede.nosp@m.ric..nosp@m.metri.nosp@m.ch@l.nosp@m.ive.f.nosp@m.r)
Version
1.0
Date
2026-11-21

The diversion, router OFF, dual tariff and rotation pins are read once per second. Each one keeps its previous level, released at startup: the new level and the previous one give its edges.

Note
This header has no Arduino dependency, so it can be exercised by the native test suite. The pin itself is read in main.cpp (readPinEdges()).

Definition in file pin_edges.h.

Function Documentation

◆ isRotationRequested()

bool isRotationRequested ( const PinEdges & pin,
const bool bOverridden )
constexpr

Tells whether the rotation pin asks for a rotation now.

Parameters
pinthe edges of the rotation pin, read every second, forced or not.
bOverriddentrue while a load, relay or remote load is forced.
Returns
true on a press while nothing is forced. A press during forcing is dropped, not carried over to its end: held until then, it is no edge any more.

Definition at line 87 of file pin_edges.h.

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

◆ pinEdges()

PinEdges pinEdges ( const bool wasActive,
const bool active )
constexpr

The edges of a pin, from its previous level and its current one.

Parameters
wasActivethe pin was LOW at the previous reading.
activethe pin is LOW now.
Returns
its state and its edges.

Definition at line 54 of file pin_edges.h.

Here is the caller graph for this function:

◆ trackPinEdges()

template<uint8_t pin>
PinEdges trackPinEdges ( const bool active)

Gives the edges of a pin from its current level, and keeps that level for the next call.

Template Parameters
pinthe input pin: each one keeps its own previous level, released at startup.
Parameters
activethe pin is LOW now.
Returns
its state and its edges.

Call it for each pin every second, whether its edges are used or not: a previous level left stale would turn a press made long ago into an edge now.

Definition at line 70 of file pin_edges.h.

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