|
3-phase PV router
|
Encoding of the load map: one packed byte per dump load. More...
#include <stdint.h>

Go to the source code of this file.
Classes | |
| struct | Load::OverrideMasks< N > |
| Override bit of each load, in the local or in the remote override bitmask. More... | |
Namespaces | |
| namespace | Load |
| Authoring and decoding helpers for the packed load map. | |
Enumerations | |
| enum class | LoadStates : uint8_t { LOAD_OFF , LOAD_ON } |
Functions | |
| template<uint8_t N> | |
| constexpr uint8_t | Load::bitOf (const uint8_t(&map)[N], uint8_t loadNum) |
| Rank of a load among the loads of its own unit, in ascending map order. | |
| template<uint8_t N> | |
| constexpr uint8_t | Load::countRemoteLoads (const uint8_t(&map)[N]) |
| Number of entries of the map that are driven remotely. | |
| template<uint8_t N> | |
| constexpr uint8_t | Load::countUnits (const uint8_t(&map)[N]) |
| Highest remote unit number appearing in the map (0 if fully local). | |
| template<uint8_t N> | |
| constexpr bool | Load::hasValidRemoteUnits (const uint8_t(&map)[N]) |
| Check that every remote load of a map was declared with a unit from 1 to 3. | |
| constexpr bool | Load::isLocal (uint8_t entry) |
| True if the entry describes a locally driven load. | |
| template<uint8_t N> | |
| constexpr bool | Load::isValidMap (const uint8_t(&map)[N]) |
| Check that every entry of a load map designates a usable pin. | |
| constexpr uint8_t | Load::local (uint8_t pin) |
| Declares a load driven locally by the router. | |
| template<uint8_t N> | |
| constexpr uint8_t | Load::maxLoadsPerUnit (const uint8_t(&map)[N]) |
| Largest number of loads assigned to any single remote unit. | |
| template<uint8_t N> | |
| constexpr OverrideMasks< N > | Load::overrideMasks (const uint8_t(&map)[N]) |
| Build the override bits of a load map. | |
| constexpr uint8_t | Load::pinOf (uint8_t entry) |
| The pin of the entry: TRIAC pin if local, status LED (0 = none) if remote. | |
| constexpr uint8_t | Load::remote (uint8_t unit, uint8_t ledPin=0) |
| Declares a load driven by a remote unit over RF. | |
| template<uint8_t N> | |
| constexpr uint8_t | Load::remoteOrdinal (const uint8_t(&map)[N], uint8_t loadNum) |
| Rank of a remote load among the remote loads, in ascending map order. | |
| constexpr uint8_t | Load::unitOf (uint8_t entry) |
| The owning unit of the entry: 0 for a local load, 1..3 for a remote one. | |
Variables | |
| constexpr uint8_t | invalidRemoteUnitEntry { 0xFE } |
| The entry Load::remote() returns for a unit outside 1..MAX_REMOTE_UNITS. | |
| constexpr uint8_t | loadPinMask { 0x3F } |
| constexpr uint8_t | loadTypeMask { 0xC0 } |
| constexpr uint8_t | loadTypeShift { 6 } |
| constexpr uint8_t | MAX_LOADS_PER_UNIT { 8 } |
| constexpr uint8_t | MAX_REMOTE_UNITS { 3 } |
Encoding of the load map: one packed byte per dump load.
Each entry of physicalLoadPin[] describes one dump load:
Loads may be declared in any order; nothing assumes locals come first.
<stdint.h>) so the encoding and the census helpers can be exercised by the native test suite. Definition in file load_map.h.
|
strong |
Load state (for use if loads are active high (Rev 2 PCB))
| Enumerator | |
|---|---|
| LOAD_OFF | load is OFF |
| LOAD_ON | load is ON |
Definition at line 31 of file load_map.h.
|
inlineconstexpr |
The entry Load::remote() returns for a unit outside 1..MAX_REMOTE_UNITS.
Packed as is, unit 4 would wrap to 0 (local) and remote(4, 8) would be local(8): a TRIAC on the LED pin. A static_assert cannot test a parameter (and C++17 has no consteval), so remote() returns this marker and validation.h reports it, with its own message (Load::hasValidRemoteUnits()).
It decodes as a remote load (unit 3) with a status LED on pin 62, which does not exist: the checks of local loads ignore it, isValidMap() and the pin check skip it, so a wrong unit gives one error, not a cascade.
Definition at line 57 of file load_map.h.
|
inlineconstexpr |
bit mask of the pin field
Definition at line 39 of file load_map.h.
|
inlineconstexpr |
bit mask of the owning-unit field
Definition at line 38 of file load_map.h.
|
inlineconstexpr |
position of the owning-unit field
Definition at line 40 of file load_map.h.
|
inlineconstexpr |
one payload byte per unit, 1 bit per load
Definition at line 43 of file load_map.h.
|
inlineconstexpr |
only 2 bits are available for the unit number
Definition at line 42 of file load_map.h.