PinsModule
Source:
PinsModule.h
Claim¶
src/core/system/PinsModule.h:61One control's claim on one pin, with everything the row needs copied in.
Public Attributes¶
uint8_t gpio
: the physical GPIO, which keys the row
char owner
: the owning module's name
char role
: the derived role, per claim so lanes do not collapse
const char * severity
: a static label, or null when the claim is safe
const char * reason
: why it is flagged, shown when the row expands
platform::GpioLiveState live
: direction, level and drive, sampled per refresh
PinListSource¶
src/core/system/PinsModule.h:57Inherits:
ListSource
The map itself, a source over a fixed snapshot, keeping every claim so conflicts show.
Public Attributes¶
Claim claims_
: the snapshot
uint8_t count_ = 0
: how many claims it holds
Public Methods¶
inline void refresh()
: Re-walk the tree, order the claims by GPIO, then flag the conflicts.
inline void flagConflicts()
: Flag every GPIO claimed twice, which surfaces a conflict without wedging the device.
inline uint8_t listRowCount() const override
inline void writeListRow(JsonSink & sink, uint8_t row) const override
inline void writeListRowDetail(JsonSink & sink, uint8_t row) const override
: Append every claim on this GPIO, and why the row is flagged when it is.
Public Static Attributes¶
constexpr uint8_t kMaxClaims = 64
Public Static Methods¶
static inline const char * driveLabel(uint8_t cap)
: The drive capability as a readable label, where a pin under-driving a long strip shows.
static inline const char * dirLabel(const platform::GpioLiveState & live)
: The pad's actual direction rather than the role's intent, "off" meaning neither buffer.
PinsModule¶
src/core/system/PinsModule.h:41Inherits:
MoonModule
The device's pin ownership map: which module owns each GPIO, for what, and whether it is safe.
It is keyed by physical GPIO, the way an OS device manager or a board template is. A fixed System module, wired by code, and read-only. Header-only: a small read-only diagnostic over the live tree and one platform seam.
Public Methods¶
virtual inline void defineControls() override
: Declare the one list of claimed pins.
virtual inline void tick1s() override
: Rebuild the claim map once a second, each claim copying what it needs into its own storage.
More info¶
What it collects¶
It walks the live tree for every claimed pin, both pin controls and driver lane lists. Each claim carries a severity flag and the live state read off the pad. A disabled module's pins drop out, so the map reflects release-on-disable.
Each row is one GPIO with its owner and role. A GPIO claimed twice shows the first owner and lists every claimant in the detail. It surfaces rather than arbitrates, the controls already being the registry.
Why it only observes¶
MoonLight's equivalent is a central manager owning a table and assigning pins. This inverts that: each module owns its pins, and one module observes them. What is borrowed is the per-pin report rather than the ownership. The role is derived from the control name, with no central vocabulary.