FDO2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Enumerations
fdo2_uart_interface.hpp File Reference

The UART port of the FDO2 driver: the CRTP base, its pin enums, the UartPort concept and the line requirements. More...

#include <concepts>
#include <cstddef>
#include <cstdint>
#include "fdo2_detail.hpp"
#include "fdo2_protocol.hpp"
#include "fdo2_types.hpp"

Go to the source code of this file.

Classes

class  fdo2::UartInterface< Derived >
 CRTP base of the platform UART port. More...
 

Namespaces

namespace  fdo2
 The FDO2 driver: everything it declares lives here; internals in detail.
 

Concepts

concept  fdo2::UartPort
 Satisfied by a class that derives from UartInterface<Port> and implements the required hooks with exactly the types above and noexcept.
 

Enumerations

enum class  fdo2::CtrlPin : uint8_t { fdo2::Power = 0 }
 Control pins the port may drive through the optional GpioSet() hook. More...
 
enum class  fdo2::GpioSignal : uint8_t { fdo2::INACTIVE = 0 , fdo2::ACTIVE = 1 }
 Logical level of a control pin; the port maps it to the physical polarity. More...
 

Variables

Bus requirements

What the FDO2 needs from the UART and its supply (datasheet sections 2 and 4). A port and a board configuration check their settings against these with static_assert (handbook KB-CPP-123).

constexpr uint32_t fdo2::kPortDefaultBaud = 19'200
 Rate after every power-up (datasheet 4).
 
constexpr uint32_t fdo2::kLogicLevelMv = 3000
 Logic level of the module's UART, millivolts (datasheet 2, Interface).
 
constexpr uint32_t fdo2::kMaxLogicLevelMv = 3300
 Absolute maximum on the module's UART pins, millivolts: a 5 V host needs a level shifter.
 
constexpr uint32_t fdo2::kSupplyMinMv = 3300
 Lowest supply the datasheet allows, millivolts (below it the readings can be wrong).
 
constexpr uint32_t fdo2::kSupplyMaxMv = 5000
 Highest supply, millivolts (absolute maximum 5.5 V).
 
constexpr uint32_t fdo2::kPowerUpMs = 1000
 Time from power to the first answer, milliseconds ("ca. 1 sec", datasheet 4).
 
constexpr uint32_t fdo2::kRxBufferBytes = 800
 Receive buffer a port needs to never lose a #RDUM reply, bytes (or it polls every 300 ms).
 
constexpr uint32_t fdo2::kMaxBaudRate = 115'200
 Highest baud rate the module accepts (datasheet 4.3, #BAUD).
 
constexpr uint32_t fdo2::kTurnaroundUs = 2000
 

Detailed Description

The UART port of the FDO2 driver: the CRTP base, its pin enums, the UartPort concept and the line requirements.

The driver never calls an SDK. It calls hooks on a class you derive from fdo2::UartInterface<Self>:

19200 baud, 8 data bits, no parity, 1 stop bit, no handshake after every power-up (datasheet section 4). The port moves raw bytes; the driver builds, frames, checks and times everything. Read() is not an all-or-nothing read: the reply length is unknown, so it returns the count received. A port whose SDK returns only a status polls its FIFO level first.