3-phase PV router
Loading...
Searching...
No Matches
OverridePins< N, MaxPins > Class Template Reference

Manages override pins and their associated bitmasks for forced operation. More...

#include <utils_override.h>

Collaboration diagram for OverridePins< N, MaxPins >:

Classes

struct  Entry
 Internal structure representing a pin and its associated bitmask. More...
 

Public Member Functions

constexpr OverridePins (const KeyIndexPair< MaxPins >(&pairs)[N])
 Constructor. Initializes the override pin mapping from pin-index pairs.
 
constexpr uint16_t findBitmask (uint8_t pin) const
 Finds the bitmask associated with a given pin number.
 
constexpr uint16_t getBitmask (uint8_t index) const
 Returns the bitmask for the specified entry index.
 
constexpr uint8_t getPin (uint8_t index) const
 Returns the pin number at the specified entry index.
 
constexpr uint8_t size () const
 Returns the number of override pin entries.
 

Private Attributes

const Entry entries_ [N]
 

Detailed Description

template<uint8_t N, uint8_t MaxPins = 16>
class OverridePins< N, MaxPins >

Manages override pins and their associated bitmasks for forced operation.

This class provides compile-time mapping between override pins and the loads/relays they control. Each pin can be associated with a set of pins (loads/relays), represented as a bitmask.

Template Parameters
NNumber of pin-index pairs (entries).
MaxPinsMaximum number of pins supported (loads + relays). Default is 16 (enough for most configurations).

Definition at line 161 of file utils_override.h.

Constructor & Destructor Documentation

◆ OverridePins()

template<uint8_t N, uint8_t MaxPins = 16>
OverridePins< N, MaxPins >::OverridePins ( const KeyIndexPair< MaxPins >(&) pairs[N])
inlineconstexpr

Constructor. Initializes the override pin mapping from pin-index pairs.

Parameters
pairsArray of pin-index pairs, each specifying a pin and its associated pins.

Definition at line 187 of file utils_override.h.

Member Function Documentation

◆ findBitmask()

template<uint8_t N, uint8_t MaxPins = 16>
uint16_t OverridePins< N, MaxPins >::findBitmask ( uint8_t pin) const
inlineconstexpr

Finds the bitmask associated with a given pin number.

Parameters
pinPin value to search for.
Returns
Bitmask for the pin, or 0 if not found.

Definition at line 235 of file utils_override.h.

◆ getBitmask()

template<uint8_t N, uint8_t MaxPins = 16>
uint16_t OverridePins< N, MaxPins >::getBitmask ( uint8_t index) const
inlineconstexpr

Returns the bitmask for the specified entry index.

Parameters
indexIndex in the entries array.
Returns
Bitmask, or 0 if out of bounds.

Definition at line 225 of file utils_override.h.

◆ getPin()

template<uint8_t N, uint8_t MaxPins = 16>
uint8_t OverridePins< N, MaxPins >::getPin ( uint8_t index) const
inlineconstexpr

Returns the pin number at the specified entry index.

Parameters
indexIndex in the entries array.
Returns
Pin value, or 0 if out of bounds.

Definition at line 215 of file utils_override.h.

◆ size()

template<uint8_t N, uint8_t MaxPins = 16>
uint8_t OverridePins< N, MaxPins >::size ( ) const
inlineconstexpr

Returns the number of override pin entries.

Returns
Number of pin-index pairs (entries).

Definition at line 205 of file utils_override.h.

Member Data Documentation

◆ entries_

template<uint8_t N, uint8_t MaxPins = 16>
const Entry OverridePins< N, MaxPins >::entries_[N]
private

Array of entries for all pin-index pairs.

Definition at line 179 of file utils_override.h.


The documentation for this class was generated from the following file: