Internal Interface Wrap
API reference
Loading...
Searching...
No Matches
Classes
StmSpi.h File Reference

STM32 SPI Bus+Device wrapper — wraps STM32 HAL SPI via CubeMX handle. More...

#include "BaseSpi.h"
#include "StmTypes.h"
#include "PlatformMutex.h"
#include "SoftChipSelectGuard.h"
#include <vector>
#include <memory>
Include dependency graph for StmSpi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  StmSpiBusLock
 RAII exclusive ownership of one StmSpiBus (RTOS mutex). More...
 
class  StmSpiDevice
 Soft-CS SPI slave on a shared StmSpiBus. More...
 
class  StmSpiBus
 One MCU SPI peripheral + its soft-CS device collection. More...
 

Detailed Description

STM32 SPI Bus+Device wrapper — wraps STM32 HAL SPI via CubeMX handle.

Bus/Device architecture:

Usage

spiBus.Initialize();
dev_cfg.cs_port = GPIOA;
int idx = spiBus.CreateDevice(dev_cfg);
BaseSpi* sensor = spiBus.GetDevice(idx);
sensor->Initialize();
uint8_t tx = 0x80, rx = 0;
sensor->Transfer(&tx, &rx, 1); // bus lock + SoftCs RAII inside
Abstract base class for SPI device implementations.
Definition BaseSpi.h:184
RAII soft-CS: runs assert_fn on construction and deassert_fn on destruction (including early return /...
Definition SoftChipSelectGuard.h:32
One MCU SPI peripheral + its soft-CS device collection.
Definition StmSpi.h:187
Platform-agnostic SPI bus configuration for STM32.
Definition EspTypes_SPI.h:150
SPI device configuration for STM32.
Definition EspTypes_SPI.h:210
Author
HardFOC
Date
2025