|
TMC5160 Driver 0.1.0
API reference
|
The UART port of the TMC5160 driver: the CRTP base, the UartPort concept and the bus requirements.
More...
#include <concepts>#include <cstddef>#include <cstdint>#include "tmc5160_detail.hpp"#include "tmc5160_types.hpp"Go to the source code of this file.
Classes | |
| class | tmc5160::UartInterface< Derived > |
| CRTP base of the platform UART port. More... | |
Namespaces | |
| namespace | tmc5160 |
The TMC5160 driver: everything it declares lives here; internals in detail. | |
Concepts | |
| concept | tmc5160::UartPort |
Satisfied by a class that derives from UartInterface<Port> and implements the required hooks with exactly the types above. | |
Variables | |
Bus requirements | |
What the TMC5160 needs from the UART (section 5, page 26). | |
| constexpr uint8_t | tmc5160::kUartDataBits = 8 |
| Data bits of a frame: 8N1, one start bit and one stop bit. | |
| constexpr uint32_t | tmc5160::kUartGapResetBits = 63 |
| A gap of more than this many bit times between start bits resets the chip's receiver (page 26). | |
| constexpr uint32_t | tmc5160::kUartReplyMarginBits = 64 |
| constexpr uint32_t | tmc5160::kMaxBaudRate = 750'000 |
| Highest baud rate: fCLK / 16 (page 26); 750 kBaud with the internal 12 MHz clock. | |
| constexpr uint32_t | tmc5160::kTurnaroundUs = 12'500 |
The UART port of the TMC5160 driver: the CRTP base, the UartPort concept and the bus requirements.
The chip talks on one wire (SWP, optionally SWN for a differential line), 8N1, least significant bit first, at a baud rate it detects from the sync nibble of every datagram (section 5, page 26). Derive from tmc5160::UartInterface<Self> and implement:
| Hook | Contract |
|---|---|
bool EnsureInitialized() noexcept | Bring the UART up on the first call; true at once afterwards |
BusStatus Exchange(const uint8_t* tx, std::size_t tx_len, uint8_t* rx, std::size_t rx_len, uint32_t timeout_us) noexcept | Send tx_len bytes, then receive exactly rx_len bytes (0 for a write). The port removes the echo of its own bytes on a shared single wire and handles transceiver direction |