64#define SUPPLY_CAPS_PDMINI { 1.0f, 20.0f, 0.01f, 0.05f, 3.0f, 0.01f }
71#define SUPPLY_LINK_STALE_MS 1500u
77#define SUPPLY_LINK_BLIND_MS (2u * SUPPLY_LINK_STALE_MS)
79#define SUPPLY_LINK_READ_MS 100u
82#define SUPPLY_LINK_BAUD_AUTO 7u
94#define SUPPLY_LINK_NO_ANSWER (-1)
95#define SUPPLY_LINK_ACK 0
115 SUPPLY_LINK_W_NONE = 0,
117 SUPPLY_LINK_W_WIRING,
118 SUPPLY_LINK_W_COMMAND,
139 uint16_t page_mv, page_ma;
146 uint16_t regs[LINK_SP_COUNT];
155 uint16_t samples_seen;
162 uint16_t sag_vin_mv, sag_set_mv;
227 uint8_t *n, uint16_t *regs);
371 unsigned edits, word;
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
The page map: what the panel can ask the IOmcu for, and set.
@ LINK_SP_FLAGS
Definition link_pages.h:526
Where the PD mini's wiring stood when last followed: the edit count and the wiring word the settings ...
Definition supply_link.h:369
The panel's state of the SUPPLY link page.
Definition supply_link.h:125
A supply's readings, set points, mode and trip state.
Definition supply.h:69
Where the PD mini is wired, as SETUP INTERFACES has it.
Definition supply_link.h:85
int8_t rx
Definition supply_link.h:87
uint8_t baud
Definition supply_link.h:88
A programmable supply: what it can be set to, what it was set to, and what it delivers.
bool supply_link_adopted(supply_link_t *s, bool *on, uint16_t *mv, uint16_t *ma)
The command a programming port left on the page, once: true with on, mv and ma filled when the page's...
Definition supply_link.c:468
@ SUPPLY_LINK_EV_BAUD_FOUND
Definition supply_link.h:105
@ SUPPLY_LINK_EV_STUCK
Definition supply_link.h:102
@ SUPPLY_LINK_EV_ON_LOST
Definition supply_link.h:101
@ SUPPLY_LINK_EV_SET_STUCK
Definition supply_link.h:103
@ SUPPLY_LINK_EV_ON_REFUSED
Definition supply_link.h:100
@ SUPPLY_LINK_EV_TRIPPED
Definition supply_link.h:104
@ SUPPLY_LINK_EV_WIRING_LIVE
Definition supply_link.h:107
@ SUPPLY_LINK_EV_WIRING_REFUSED
Definition supply_link.h:99
@ SUPPLY_LINK_EV_SAGGED
Definition supply_link.h:106
void supply_link_command(supply_link_t *s, bool on, uint16_t mv, uint16_t ma)
What the output is to be; set points clamped to the page's 1000 to 20000mV and 50 to 3000mA.
Definition supply_link.c:104
void supply_link_sag(const supply_link_t *s, uint16_t *vin_mv, uint16_t *set_mv)
The input and the set point in mV that SUPPLY_LINK_EV_SAGGED was read with: the page's VIN_MV and SET...
Definition supply_link.c:492
bool supply_link_blind(const supply_link_t *s, uint32_t now_ms)
Whether the module's readings have stopped at now_ms: a page has been read and its reading count (SAM...
Definition supply_link.c:462
supply_link_write_t supply_link_next(supply_link_t *s, uint8_t *off, uint8_t *n, uint16_t *regs)
The next write owed, or SUPPLY_LINK_W_NONE.
Definition supply_link.c:123
void supply_link_init(supply_link_t *s)
Sets up the supply link state.
Definition supply_link.c:23
bool supply_link_port_held(const supply_link_t *s)
Whether the last read of the page had LINK_SP_PORT set: a programming port holds the supply,...
Definition supply_link.c:528
bool supply_link_event_stands(const supply_link_t *s, uint16_t ev)
Whether what ev, one SUPPLY_LINK_EV_* bit, says still holds now.
Definition supply_link.c:288
void supply_link_lost(supply_link_t *s)
The link went or came back: nothing on the page is known, and the panel's ON, if it had one,...
Definition supply_link.c:36
void supply_link_reset(supply_link_t *s)
Restart the PD mini (protocol 4.4): written once the page's output is off and its wiring written,...
Definition supply_link.c:116
void supply_link_state(const supply_link_t *s, uint32_t now_ms, supply_state_t *st)
The supply as the page last said, into st: readings, set points read back from the module,...
Definition supply_link.c:424
bool supply_link_read_due(const supply_link_t *s, uint32_t now_ms)
Whether a read of the page is due at now_ms.
Definition supply_link.c:301
void supply_link_written(supply_link_t *s, int result)
How the write supply_link_next() gave went: SUPPLY_LINK_ACK, a NACK reason, or SUPPLY_LINK_NO_ANSWER.
Definition supply_link.c:211
bool supply_link_settled(const supply_link_t *s)
Whether nothing is owed: the page holds the command asked and the wiring, or the wiring was refused.
Definition supply_link.c:277
bool supply_link_wiring_moved(supply_link_follow_t *f, unsigned edits, unsigned word)
Whether the PD mini's wiring has moved since it was last followed.
Definition supply_link.c:502
void supply_link_wire(supply_link_t *s, const supply_wiring_t *w)
The wiring the settings name now.
Definition supply_link.c:93
void supply_link_read(supply_link_t *s, const uint16_t *regs, uint32_t now_ms)
The whole page as read at now_ms, or regs NULL for a read that was not answered.
Definition supply_link.c:308
bool supply_link_held_pins(const supply_link_t *s, int *tx, int *rx)
The PD mini's pins the page holds by its last read, as the IOmcu reserves them (supply_page_pins()): ...
Definition supply_link.c:515
uint16_t supply_link_events(supply_link_t *s)
The events since the last call, SUPPLY_LINK_EV_*, and cleared.
Definition supply_link.c:482
supply_link_write_t
The writes the supply link asks for next.
Definition supply_link.h:114