The register image a Schema 1 device keeps: Pages 0-1 from EEPROM, Pages 2-3 written per reading. More…
#include <NW_Pages.h>
Public Functions
| Name | |
|---|---|
| NW_Pages() | |
| void | loadStored(int base) Pages 0 and 1 from EEPROM[base .. base + 63] (base = EEPROM.length() - 64). |
| bool | page0Valid() const Page 0 says Schema 1, carries the magic byte and passes its CRC. |
| bool | page1Blank() const Page 1 was never written (every byte 0xFF): use built-in constants instead. |
| void | beginReading() A reading begins: ready clears. Fill Page 2 after this. |
| void | endReading(uint8_t chipFaults) A reading is complete: status carries the chip-fault bits given (bit n = chip n), the pan-fault bit follows them, the counter moves, ready sets. |
| uint16_t | counter() const |
| void | latchFault(uint8_t code) Latch a fault code (chip in bits 7-5, kind in bits 4-0): overwrites anything. |
| void | latchNotice(uint8_t code) Latch a notice unless a fault is waiting to be acknowledged (spec: one report at a time). |
| void | acknowledge() The controller’s acknowledge: a logger acknowledges its own report once it has written the row. |
| NW_Report | report() const The report as NW_Report decodes it: status byte and code. |
| void | put8(uint8_t at, uint8_t v) |
| void | put16(uint8_t at, uint16_t v) |
| void | put32(uint8_t at, uint32_t v) |
| uint16_t | get16(uint8_t at) const |
| float | getFloat(uint8_t at) const |
| size_t | printSnapshot(Print & out, const char *const * chipNames, uint8_t nChips, const char * fw, const NW_Report * r =nullptr, const char *const * kindWords =nullptr, uint8_t nKindWords =0, const char * fwCommit =””, const char * lib =””, const char * libCommit =””) const One status line for the logger’s status file, the columns of NW_Device::printSnapshot(): name, serial (Page 0 Block 2), HW major.minor, FW (the library version, given), FWCommit (its build commit, given), Lib and LibCommit (blank and the sketch’s commit for a logger), report code and note word (r, the current report by default; device-specific kinds through kindWords), Pages 0, 1 and 2 in hex. No newline. |
| uint8_t | crc8(const uint8_t * d, uint8_t len) CRC-8/SMBUS, as Page 0 carries it. |
| bool | isFaultCode(uint8_t code) A report code whose kind is a fault (1-5, 7, 8), as opposed to a notice (6, 9, 10, device-specific notices). |
Public Attributes
| Name | |
|---|---|
| const uint8_t | SIZE Pages 0-3, 0x00-0x7F. |
| uint8_t | page |
Detailed Description
class NW_Pages;
The register image a Schema 1 device keeps: Pages 0-1 from EEPROM, Pages 2-3 written per reading.
The counterpart of NW_Device. A logger library holds one, loads the stored half at boot (loadStored), fills Page 2 at each reading between beginReading() and endReading(), and latches its reports into Block 0 with the spec’s rules: a fault overwrites a notice, a notice never overwrites an unacknowledged fault, and the counter moves when the reading is complete. printSnapshot() is the status line a logger writes for itself, in the same columns as NW_Device::printSnapshot(). Nothing here serves a bus: a transport (UART, Okapi) reads page[] when it comes.
Public Functions Documentation
function NW_Pages
inline NW_Pages()
function loadStored
inline void loadStored(
int base
)
Pages 0 and 1 from EEPROM[base .. base + 63] (base = EEPROM.length() - 64).
function page0Valid
inline bool page0Valid() const
Page 0 says Schema 1, carries the magic byte and passes its CRC.
function page1Blank
inline bool page1Blank() const
Page 1 was never written (every byte 0xFF): use built-in constants instead.
function beginReading
inline void beginReading()
A reading begins: ready clears. Fill Page 2 after this.
function endReading
inline void endReading(
uint8_t chipFaults
)
A reading is complete: status carries the chip-fault bits given (bit n = chip n), the pan-fault bit follows them, the counter moves, ready sets.
function counter
inline uint16_t counter() const
function latchFault
inline void latchFault(
uint8_t code
)
Latch a fault code (chip in bits 7-5, kind in bits 4-0): overwrites anything.
function latchNotice
inline void latchNotice(
uint8_t code
)
Latch a notice unless a fault is waiting to be acknowledged (spec: one report at a time).
function acknowledge
inline void acknowledge()
The controller’s acknowledge: a logger acknowledges its own report once it has written the row.
function report
inline NW_Report report() const
The report as NW_Report decodes it: status byte and code.
function put8
inline void put8(
uint8_t at,
uint8_t v
)
function put16
inline void put16(
uint8_t at,
uint16_t v
)
function put32
inline void put32(
uint8_t at,
uint32_t v
)
function get16
inline uint16_t get16(
uint8_t at
) const
function getFloat
inline float getFloat(
uint8_t at
) const
function printSnapshot
inline size_t printSnapshot(
Print & out,
const char *const * chipNames,
uint8_t nChips,
const char * fw,
const NW_Report * r =nullptr,
const char *const * kindWords =nullptr,
uint8_t nKindWords =0,
const char * fwCommit ="",
const char * lib ="",
const char * libCommit =""
) const
One status line for the logger’s status file, the columns of NW_Device::printSnapshot(): name, serial (Page 0 Block 2), HW major.minor, FW (the library version, given), FWCommit (its build commit, given), Lib and LibCommit (blank and the sketch’s commit for a logger), report code and note word (r, the current report by default; device-specific kinds through kindWords), Pages 0, 1 and 2 in hex. No newline.
function crc8
static inline uint8_t crc8(
const uint8_t * d,
uint8_t len
)
CRC-8/SMBUS, as Page 0 carries it.
function isFaultCode
static inline bool isFaultCode(
uint8_t code
)
A report code whose kind is a fault (1-5, 7, 8), as opposed to a notice (6, 9, 10, device-specific notices).
Public Attributes Documentation
variable SIZE
static const uint8_t SIZE = 128;
Pages 0-3, 0x00-0x7F.
variable page
uint8_t page;
Updated on 2026-09-23 at 22:42:22 +0000