Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Stm32SPI.hxx
Go to the documentation of this file.
1
36#ifndef _FREERTOS_DRIVERS_ST_STM32SPI_HXX_
37#define _FREERTOS_DRIVERS_ST_STM32SPI_HXX_
38
39#include "SPI.hxx"
40
41#include "stm32f_hal_conf.hxx"
42
45class Stm32SPI : public SPI
46{
47public:
59 Stm32SPI(const char *name, SPI_TypeDef *port, uint32_t interrupt,
60 ChipSelectMethod cs_assert, ChipSelectMethod cs_deassert,
61 OSMutex *bus_lock = nullptr);
62
66 {
67 }
68
69private:
70 void enable() override {}
71 void disable() override {}
77 int transfer(struct spi_ioc_transfer *msg) override;
78
83 int transfer_polled(struct spi_ioc_transfer *msg) override
84 {
85 return transfer(msg);
86 }
87
91 int update_configuration() override;
92
94 SPI_HandleTypeDef spiHandle_;
95
99
101};
102
103
104
105
106#endif // _FREERTOS_DRIVERS_ST_STM32SPI_HXX_
const char * name
device name
Definition Devtab.hxx:266
This class provides a mutex API.
Definition OS.hxx:427
Private data for an SPI device.
Definition SPI.hxx:53
void bus_lock()
Lock the bus shared by many chip selects.
Definition SPI.hxx:141
void(* ChipSelectMethod)()
Function point for the chip select assert and deassert methods.
Definition SPI.hxx:56
Specialization of SPI driver for STM32 devices.
Definition Stm32SPI.hxx:46
int update_configuration() override
Update the configuration of the bus.
Definition Stm32SPI.cxx:148
SPI_HandleTypeDef spiHandle_
Stm32 HAL device structure.
Definition Stm32SPI.hxx:94
void disable() override
function to disable device
Definition Stm32SPI.hxx:71
int transfer(struct spi_ioc_transfer *msg) override
Method to transmit/receive the data.
Definition Stm32SPI.cxx:247
Stm32SPI()
Default constructor.
~Stm32SPI()
Destructor.
Definition Stm32SPI.hxx:65
void enable() override
function to enable device
Definition Stm32SPI.hxx:70
int transfer_polled(struct spi_ioc_transfer *msg) override
Method to transmit/receive the data.
Definition Stm32SPI.hxx:83
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
Definition macros.h:171