Skip to main content

Module driver

Module driver 

Source
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:

  1. write the frame and wait up to Config::ack_timeout for ACK; on NAK, CAN or timeout retransmit after 100 ms, then 1.1 s, giving up after three transmissions;
  2. if a response is expected, wait for the RES frame with the same function id;
  3. 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.
SerialApi
A handle to the link layer task. Cloning is cheap; all clones share one port.

Enums§

SerialError
Link layer failures.