|
| | HalSpiTmc9660Comm (BaseSpi &spi, BaseGpio &rst, BaseGpio &drv_en, BaseGpio &faultn, BaseGpio &wake, bool rst_active_high=true, bool drv_en_active_high=true, bool faultn_active_low=false, bool wake_active_low=false) noexcept |
| | Construct the SPI communication adapter.
|
| |
| uint32_t | transportDiag () const noexcept |
| | Last BaseSpi error observed by any TMCL/bootloader transfer.
|
| |
| uint32_t | rawTmclProbe (std::array< uint8_t, 8 > &tx, std::array< uint8_t, 8 > &rx, uint32_t timeout_ms) noexcept |
| | Single-shot raw 8-byte transfer with caller-chosen bus-lock timeout.
|
| |
|
These are called by tmc9660::SpiCommInterface<HalSpiTmc9660Comm> via static dispatch.
|
| bool | spiTransferTMCL (std::array< uint8_t, 8 > &tx, std::array< uint8_t, 8 > &rx) noexcept |
| | Perform an 8-byte full-duplex SPI transfer for TMCL parameter mode.
|
| |
| bool | hostSpiTransferTMCLPair (std::array< uint8_t, 8 > &tx1, std::array< uint8_t, 8 > &rx1, std::array< uint8_t, 8 > &tx2, std::array< uint8_t, 8 > &rx2, uint32_t gap_us) noexcept |
| | Two TMCL soft-CS frames under one bus lock (cmd + NO_OP / reply).
|
| |
| bool | spiTransferBootloader (std::array< uint8_t, 5 > &tx, std::array< uint8_t, 5 > &rx) noexcept |
| | Perform a 5-byte full-duplex SPI transfer for bootloader mode.
|
| |
| bool | gpioSet (tmc9660::TMC9660CtrlPin pin, tmc9660::GpioSignal signal) noexcept |
| | Set a TMC9660 control pin to a given logical signal state.
|
| |
| bool | gpioRead (tmc9660::TMC9660CtrlPin pin, tmc9660::GpioSignal &signal) noexcept |
| | Read a TMC9660 control pin's current logical signal state.
|
| |
| void | debugLog (int level, const char *tag, const char *format, va_list args) noexcept |
| | Route TMC9660 driver debug output to the HardFOC Logger.
|
| |
| void | delayMs (uint32_t ms) noexcept |
| | Delay execution for the specified number of milliseconds.
|
| |
| void | delayUs (uint32_t us) noexcept |
| | Delay execution for the specified number of microseconds.
|
| |
Concrete SPI communication adapter for TMC9660 using BaseSpi and BaseGpio.
Implements all methods required by tmc9660::SpiCommInterface<HalSpiTmc9660Comm> through the CRTP (Curiously Recurring Template Pattern). This class acts as the bridge between the HardFOC BaseSpi abstraction and the TMC9660 driver's SPI protocol, handling:
- TMCL transfers: 8-byte full-duplex SPI exchanges for parameter mode
- Bootloader transfers: 5-byte full-duplex SPI exchanges for bootloader mode
- GPIO control: Maps TMC9660 control pin identifiers (RST, DRV_EN, FAULTN, WAKE) to physical BaseGpio instances with configurable active-level polarity
- Timing: Platform-aware delays (millisecond via RTOS, microsecond via esp_rom_delay_us or busy-wait fallback)
- Logging: Routes TMC9660 driver debug output to the HardFOC Logger
Control Pin Polarity
Each control pin can be configured as active-high or active-low to match the board's electrical design (e.g., inverting buffers). The constructor parameters set the initial polarity; the base class provides set_pin_active_level() for runtime reconfiguration if needed.
- Note
- This class does NOT own the BaseSpi or BaseGpio instances; they must remain valid for the lifetime of this object.
- See also
- tmc9660::SpiCommInterface CRTP base class from the TMC9660 driver
-
HalUartTmc9660Comm UART equivalent of this class