|
Core
|
Core SPI library. More...
#include "spi.h"#include "core_config.h"#include <stdint.h>#include <stdbool.h>#include <stm32g4xx_hal.h>#include <stm32g4xx_hal_spi.h>#include "clock.h"Functions | |
| bool | core_SPI_init (SPI_TypeDef *spi, GPIO_TypeDef *cs_port, uint16_t cs_pin) |
| Initialize an SPI module and set up a CS pin for it. | |
| bool | core_SPI_read_write (SPI_TypeDef *spi, uint8_t *txbuf, uint32_t txbuflen, uint8_t *rxbuf, uint32_t rxbuflen) |
| Transmit data from a buffer on the given SPI bus and store the incoming data in a separate buffer. | |
| bool | core_SPI_start (SPI_TypeDef *spi) |
| Set the CS pin for an SPI bus low. | |
| bool | core_SPI_stop (SPI_TypeDef *spi) |
| Set the CS pin for an SPI bus high. | |
Core SPI library.
This core library component is used to interact with SPI devices.
| bool core_SPI_init | ( | SPI_TypeDef * | spi, |
| GPIO_TypeDef * | cs_port, | ||
| uint16_t | cs_pin ) |
Initialize an SPI module and set up a CS pin for it.
| spi | The SPI module to be initialized |
| cs_port | Port the CS pin is located on (GPIOx) |
| cs_pin | CS pin (GPIO_PIN_x) |
| bool core_SPI_read_write | ( | SPI_TypeDef * | spi, |
| uint8_t * | txbuf, | ||
| uint32_t | txbuflen, | ||
| uint8_t * | rxbuf, | ||
| uint32_t | rxbuflen ) |
Transmit data from a buffer on the given SPI bus and store the incoming data in a separate buffer.
| spi | The SPI module |
| txbuf | Buffer from which data to be transmitted is read |
| txbuflen | Number of bytes to read from the TX buffer |
| rxbuf | Buffer to which received data is to be stored |
| rxbuflen | Number of bytes to write to the RX buffer |
| bool core_SPI_start | ( | SPI_TypeDef * | spi | ) |
Set the CS pin for an SPI bus low.
| spi | The SPI module |
| bool core_SPI_stop | ( | SPI_TypeDef * | spi | ) |
Set the CS pin for an SPI bus high.
| spi | The SPI module |