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

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

#include <utils_override.h>

Collaboration diagram for OverrideTable< N, MaxPins >:

Classes

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

Public Member Functions

constexpr OverrideTable (const KeyIndexPair< MaxPins >(&pairs)[N])
 Constructor. Initializes the override pin mapping from pin-index pairs.
 
template<typename Map>
constexpr OverrideTable (const OverridePins< N, MaxPins > &pins, const Map &map)
 Constructor. The override pins of config.h, their codes turned into pins by map.
 
constexpr uint16_t findLocalBitmask (uint8_t pin) const
 Finds the local bitmask associated with a given pin number.
 
constexpr uint8_t findRemoteBitmask (uint8_t pin) const
 Finds the remote bitmask associated with a given pin number.
 
constexpr uint16_t getLocalBitmask (uint8_t index) const
 Returns the local 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 getRemoteBitmask (uint8_t index) const
 Returns the remote bitmask for 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 OverrideTable< 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 separate bitmasks for local loads/relays and remote loads.

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

Definition at line 255 of file utils_override.h.

Constructor & Destructor Documentation

◆ OverrideTable() [1/2]

template<uint8_t N, uint8_t MaxPins = 16>
OverrideTable< N, MaxPins >::OverrideTable ( 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 284 of file utils_override.h.

◆ OverrideTable() [2/2]

template<uint8_t N, uint8_t MaxPins = 16>
template<typename Map>
OverrideTable< N, MaxPins >::OverrideTable ( const OverridePins< N, MaxPins > & pins,
const Map & map )
inlineconstexpr

Constructor. The override pins of config.h, their codes turned into pins by map.

Parameters
pinsThe override pins, as in config.h.
mapWhat the codes stand for (a TargetMap).

Definition at line 305 of file utils_override.h.

Here is the call graph for this function:

Member Function Documentation

◆ findLocalBitmask()

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

Finds the local bitmask associated with a given pin number.

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

Definition at line 363 of file utils_override.h.

◆ findRemoteBitmask()

template<uint8_t N, uint8_t MaxPins = 16>
uint8_t OverrideTable< N, MaxPins >::findRemoteBitmask ( uint8_t pin) const
inlineconstexpr

Finds the remote bitmask associated with a given pin number.

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

Definition at line 380 of file utils_override.h.

◆ getLocalBitmask()

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

Returns the local bitmask for the specified entry index.

Parameters
indexIndex in the entries array.
Returns
Local bitmask for physical pins, or 0 if out of bounds.

Definition at line 343 of file utils_override.h.

◆ getPin()

template<uint8_t N, uint8_t MaxPins = 16>
uint8_t OverrideTable< 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 333 of file utils_override.h.

◆ getRemoteBitmask()

template<uint8_t N, uint8_t MaxPins = 16>
uint8_t OverrideTable< N, MaxPins >::getRemoteBitmask ( uint8_t index) const
inlineconstexpr

Returns the remote bitmask for the specified entry index.

Parameters
indexIndex in the entries array.
Returns
Remote bitmask (bit n = remote load n), or 0 if out of bounds.

Definition at line 353 of file utils_override.h.

◆ size()

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

Returns the number of override pin entries.

Returns
Number of pin-index pairs (entries).

Definition at line 323 of file utils_override.h.

Member Data Documentation

◆ entries_

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

Array of entries for all pin-index pairs.

Definition at line 276 of file utils_override.h.


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