CRTP SPI communication adapter for MAX22200 using BaseSpi and BaseGpio.
More...
#include <Max22200Handler.h>
|
| | HalSpiMax22200Comm (BaseSpi &spi, BaseGpio &enable, BaseGpio &cmd, BaseGpio *fault=nullptr) noexcept |
| | Construct the SPI adapter.
|
| |
|
| bool | Initialize () noexcept |
| | Park ENABLE/CMD, optional nFAULT input, and 5 ms VM settle.
|
| |
| bool | Transfer (const uint8_t *tx_data, uint8_t *rx_data, size_t length) noexcept |
| | SPI exchange via aligned internal-SRAM staging buffers.
|
| |
| bool | SetChipSelect (bool state) noexcept |
| | Soft-CS no-op — chip select is owned by StmSpiDevice.
|
| |
| bool | Configure (uint32_t speed_hz, uint8_t mode, bool msb_first=true) noexcept |
| | SPI mode/speed no-op — BaseSpi is pre-configured (Mode 0).
|
| |
| bool | IsReady () const noexcept |
| | True when comm adapter and all bound GPIO/SPI objects are ready.
|
| |
| void | DelayUs (uint32_t us) noexcept |
| | Blocking microsecond delay (handler_utils::DelayUs).
|
| |
| void | GpioSet (max22200::CtrlPin pin, max22200::GpioSignal signal) noexcept |
| | Drive ENABLE, CMD, or nFAULT through BaseGpio.
|
| |
| bool | GpioRead (max22200::CtrlPin pin, max22200::GpioSignal &signal) noexcept |
| | Read ENABLE, CMD, or nFAULT level.
|
| |
CRTP SPI communication adapter for MAX22200 using BaseSpi and BaseGpio.
Implements all methods required by max22200::SpiInterface<HalSpiMax22200Comm>. Handles the two-phase CMD-pin SPI protocol (CMD HIGH = command byte, CMD LOW = data). Live actuators typically use Mode 0 soft-CS SPI; EN/CMD/nFLT may be expander-backed — claim board GPIO map ownership before Initialize.
◆ HalSpiMax22200Comm()
| HalSpiMax22200Comm::HalSpiMax22200Comm |
( |
BaseSpi & |
spi, |
|
|
BaseGpio & |
enable, |
|
|
BaseGpio & |
cmd, |
|
|
BaseGpio * |
fault = nullptr |
|
) |
| |
|
noexcept |
Construct the SPI adapter.
- Parameters
-
| spi | Reference to pre-configured BaseSpi (Mode 0, 8-bit). |
| enable | BaseGpio for ENABLE pin (active HIGH). |
| cmd | BaseGpio for CMD pin (HIGH=command phase, LOW=data phase). |
| fault | Optional BaseGpio for nFAULT (active LOW, open-drain). |
◆ Configure()
| bool HalSpiMax22200Comm::Configure |
( |
uint32_t |
speed_hz, |
|
|
uint8_t |
mode, |
|
|
bool |
msb_first = true |
|
) |
| |
|
noexcept |
SPI mode/speed no-op — BaseSpi is pre-configured (Mode 0).
- Returns
- Always true.
◆ DelayUs()
| void HalSpiMax22200Comm::DelayUs |
( |
uint32_t |
us | ) |
|
|
noexcept |
◆ GpioRead()
| bool HalSpiMax22200Comm::GpioRead |
( |
max22200::CtrlPin |
pin, |
|
|
max22200::GpioSignal & |
signal |
|
) |
| |
|
noexcept |
Read ENABLE, CMD, or nFAULT level.
- Parameters
-
| [out] | signal | ACTIVE or INACTIVE on success. |
- Returns
- false if not ready, pin unsupported, or GPIO read failed.
◆ GpioSet()
| void HalSpiMax22200Comm::GpioSet |
( |
max22200::CtrlPin |
pin, |
|
|
max22200::GpioSignal |
signal |
|
) |
| |
|
noexcept |
Drive ENABLE, CMD, or nFAULT through BaseGpio.
- Note
- ENABLE (expander-backed) gets a 2 ms settle; CMD is local GPIO.
◆ Initialize()
| bool HalSpiMax22200Comm::Initialize |
( |
| ) |
|
|
noexcept |
Park ENABLE/CMD, optional nFAULT input, and 5 ms VM settle.
◆ IsReady()
| bool HalSpiMax22200Comm::IsReady |
( |
| ) |
const |
|
noexcept |
True when comm adapter and all bound GPIO/SPI objects are ready.
◆ SetChipSelect()
| bool HalSpiMax22200Comm::SetChipSelect |
( |
bool |
state | ) |
|
|
noexcept |
Soft-CS no-op — chip select is owned by StmSpiDevice.
- Returns
- Always true.
◆ Transfer()
| bool HalSpiMax22200Comm::Transfer |
( |
const uint8_t * |
tx_data, |
|
|
uint8_t * |
rx_data, |
|
|
size_t |
length |
|
) |
| |
|
noexcept |
SPI exchange via aligned internal-SRAM staging buffers.
- Parameters
-
| tx_data | TX buffer (may live outside tightly-coupled memory). |
| rx_data | RX buffer (updated in place via aligned word stores). |
| length | Frame length in bytes (max 8). |
- Returns
- false if not IsReady, null pointers, or SPI failure.
◆ cmd_
| BaseGpio& HalSpiMax22200Comm::cmd_ |
|
private |
◆ enable_
| BaseGpio& HalSpiMax22200Comm::enable_ |
|
private |
◆ fault_
| BaseGpio* HalSpiMax22200Comm::fault_ |
|
private |
◆ initialized_
| bool HalSpiMax22200Comm::initialized_ {false} |
|
private |
◆ spi_
| BaseSpi& HalSpiMax22200Comm::spi_ |
|
private |
The documentation for this class was generated from the following files: