SPI interface from which slave devices inherit.
More...
|
struct | SPI |
| Struct definition for SPI interface. Provides the interface for API consumers to interact with the SPI peripheral. More...
|
|
SPI interface from which slave devices inherit.
- Todo
- Add in code block examples to API documentation.
◆ DeviceType
Device type enum Describes the type of peripheral implementing an SPI interface.
Enumerator |
---|
SENSOR_ACCEL | Accelerometer.
|
SENSOR_GYRO | Gyroscope.
|
SENSOR_BARO | Barometer.
|
MEMORY_FLASH | Flash memory.
|
COMM_LORA | LoRa module.
|
Definition at line 28 of file spi.h.
◆ SPI_init()
void SPI_init |
( |
SPI * | spi, |
|
|
DeviceType | device, |
|
|
SPI_TypeDef * | interface, |
|
|
DataFormat | df, |
|
|
GPIO_TypeDef * | port, |
|
|
unsigned long | cs ) |
Initialiser for an SPI device interface.
- Parameters
-
*spi | Pointer to SPI struct to be initialised. |
device | Enum specifier for device type. |
*interface | Pointer to SPI interface struct. |
*port | Pointer to GPIO port struct. |
cs | Device chip select address. |
- Returns
NULL
.
Definition at line 32 of file spi.c.
◆ SPI_transmit()
uint16_t SPI_transmit |
( |
SPI * | spi, |
|
|
uint16_t | data ) |
Instance method to communicate a SPI transaction with slave device.
- Parameters
-
*spi | Pointer to SPI struct. |
data | Data payload to be sent to slave device. |
- Return values
-
response | Returns the slave device response from the transaction. |
Definition at line 52 of file spi.c.