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.
 
void printOverrideConfig () const
 Print the configured override pins and their bitmasks to Serial during startup.
 
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 = NO_OF_DUMPLOADS + relays.size()>
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).

Definition at line 228 of file utils_override.h.

Constructor & Destructor Documentation

◆ OverridePins()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
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 254 of file utils_override.h.

Member Function Documentation

◆ findBitmask()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
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 302 of file utils_override.h.

◆ getBitmask()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
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 292 of file utils_override.h.

◆ getPin()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
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 282 of file utils_override.h.

◆ printOverrideConfig()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
void OverridePins< N, MaxPins >::printOverrideConfig ( ) const
inline

Print the configured override pins and their bitmasks to Serial during startup.

This method outputs the pin number and associated bitmask for each entry.

Definition at line 319 of file utils_override.h.

◆ size()

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
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 272 of file utils_override.h.

Member Data Documentation

◆ entries_

template<uint8_t N, uint8_t MaxPins = NO_OF_DUMPLOADS + relays.size()>
const Entry OverridePins< N, MaxPins >::entries_[N]
private

Array of entries for all pin-index pairs.

Definition at line 246 of file utils_override.h.


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