Expand description
The Serial API link layer.
SerialApi::start spawns a task that owns the port. Callers submit a
Request; the task runs one exchange at a time:
- write the frame and wait up to
Config::ack_timeoutfor ACK; on NAK, CAN or timeout retransmit after 100 ms, then 1.1 s, giving up after three transmissions; - if a response is expected, wait for the RES frame with the same function id;
- if a callback is expected (and the response did not say the request was refused), wait for the REQ frame with the same function id whose first byte is the callback id.
Every data frame from the controller is acknowledged at once (NAK when its checksum is bad). Request frames that are not the awaited callback are handed to the unsolicited channel: received commands, node information, inclusion progress, SmartStart requests.
Structs§
- Config
- Link layer timing.
- Exchange
- What came back from an exchange.
- Request
- One exchange with the controller.
- Serial
Api - A handle to the link layer task. Cloning is cheap; all clones share one port.
Enums§
- Serial
Error - Link layer failures.