The PD mini's jobs: which transaction goes next, and the step that runs the phases of one.
More...
|
| static bool | en_ready (pdmini_t *d, uint32_t now) |
| | Whether an ON may be written: four writes that do not take leave the output stuck – an input not ready for an ON – and it is tried again two seconds on.
|
| static bool | write_en (pdmini_t *d, uint32_t now) |
| | OUTPUT_EN towards what is asked: twice with the argument taken to mean it, then – until a read-back has shown which argument means on – twice with the other, in case this module reads it the way the vendor's sheet says.
|
| static bool | poll (pdmini_t *d, uint32_t now, uint32_t margin) |
| | The reading furthest past its due by margin ms or more, started; false for none.
|
| static bool | next_job (pdmini_t *d, uint32_t now) |
| | The next transaction, or false for none now.
|
| static bool | off_now (const pdmini_t *d) |
| | Whether an OFF waits on the transaction under way: next_job() would write it to an output read on, or write it – or read the state for it – over an ON still being confirmed.
|
| static bool | overtaken (const pdmini_t *d) |
| | Whether the write waiting for its pins has been overtaken: an OUTPUT_EN towards what is no longer asked, an ON whose set points have changed since they were read back for it, set points no longer the ones asked, or a set point while an OFF is asked and the output is or may be on – the OFF goes first.
|
| void | pdmini_step (pdmini_t *d, uint32_t now_ms) |
| | Run one pass of the driver.
|
The PD mini's jobs: which transaction goes next, and the step that runs the phases of one.
See pdmini.h.
SPDX-License-Identifier: MIT
◆ en_ready()
| bool en_ready |
( |
pdmini_t * | d, |
|
|
uint32_t | now ) |
|
static |
Whether an ON may be written: four writes that do not take leave the output stuck – an input not ready for an ON – and it is tried again two seconds on.
False while it waits out that pause.
- Parameters
-
| d | Driver state. |
| now | Current time, in milliseconds. |
- Returns
- true when an ON may be written.
◆ next_job()
| bool next_job |
( |
pdmini_t * | d, |
|
|
uint32_t | now ) |
|
static |
The next transaction, or false for none now.
- Parameters
-
| d | Driver state. |
| now | Current time, in milliseconds. |
- Returns
- true when a transaction was started; false for none now.
◆ off_now()
Whether an OFF waits on the transaction under way: next_job() would write it to an output read on, or write it – or read the state for it – over an ON still being confirmed.
- Parameters
-
- Returns
- true when an OFF is waiting.
◆ overtaken()
Whether the write waiting for its pins has been overtaken: an OUTPUT_EN towards what is no longer asked, an ON whose set points have changed since they were read back for it, set points no longer the ones asked, or a set point while an OFF is asked and the output is or may be on – the OFF goes first.
- Parameters
-
- Returns
- true when the write is no longer wanted and is not sent.
◆ pdmini_step()
| void pdmini_step |
( |
pdmini_t * | d, |
|
|
uint32_t | now_ms ) |
Run one pass of the driver.
Call every pass.
- Parameters
-
| d | Driver state. |
| now_ms | Current time, in milliseconds. |
◆ poll()
| bool poll |
( |
pdmini_t * | d, |
|
|
uint32_t | now, |
|
|
uint32_t | margin ) |
|
static |
The reading furthest past its due by margin ms or more, started; false for none.
Furthest past its due, so a slow module answering every display read near its period does not starve the others. Unsigned, so a reading untaken for 2^31 ms or more – a module first seen 25 days after start – is late rather than early.
- Parameters
-
| d | Driver state. |
| now | Current time, in milliseconds. |
| margin | Least time past its due, in milliseconds. |
- Returns
- true when a reading was started.
◆ write_en()
| bool write_en |
( |
pdmini_t * | d, |
|
|
uint32_t | now ) |
|
static |
OUTPUT_EN towards what is asked: twice with the argument taken to mean it, then – until a read-back has shown which argument means on – twice with the other, in case this module reads it the way the vendor's sheet says.
Written when the output reads otherwise, so an OFF that tries the other argument goes only to an output that is on and cannot switch on one that was off. An ON is false when en_ready() says not now; an OFF is never held back, and four that do not take only say stuck.
- Parameters
-
| d | Driver state. |
| now | Current time, in milliseconds. |
- Returns
- true when the write was started; false when an ON must wait.