GPS Device
Loading...
Searching...
No Matches
stm32f401re_spi.h
Go to the documentation of this file.
1
32
38
39#ifndef STM32F401RE_SPI_DRIVER_H__
40#define STM32F401RE_SPI_DRIVER_H__
41
42#include "stm32f401re.h"
43#include "common.h"
44
51
59
70
81
92
100
108
127
162
164
171
194void spi_init(SPI_CFG_ts *spi_cfg);
195
205void spi_deinit(SPI_REGDEF_ts const *spi_instance);
206
222void spi_send(SPI_REGDEF_ts *spi_instance, uint8_t *tx_buffer, uint32_t len);
223
239void spi_receive(SPI_REGDEF_ts *spi_instance, uint8_t *rx_buffer, uint32_t len);
240
256void spi_set_pclk_div(SPI_REGDEF_ts *spi_instance, SPI_MASTER_SCLK_SPEED_te pclk_div);
257
270void spi_set_comm(SPI_REGDEF_ts *spi_instance, EN_STATUS_te en_status);
271
273
274#endif
275
Common utility module public API.
EN_STATUS_te
Represents an enabled or disabled state.
Definition common.h:95
void spi_send(SPI_REGDEF_ts *spi_instance, uint8_t *tx_buffer, uint32_t len)
Blocking SPI transmit. Sends len bytes from tx_buffer.
void spi_deinit(SPI_REGDEF_ts const *spi_instance)
Deinitializes the SPI peripheral and disables its clock.
void spi_init(SPI_CFG_ts *spi_cfg)
Initializes the SPI peripheral with the given configuration.
void spi_receive(SPI_REGDEF_ts *spi_instance, uint8_t *rx_buffer, uint32_t len)
Blocking SPI receive. Reads len bytes into rx_buffer.
void spi_set_comm(SPI_REGDEF_ts *spi_instance, EN_STATUS_te en_status)
Enables or disables the SPI peripheral (SPE bit).
void spi_set_pclk_div(SPI_REGDEF_ts *spi_instance, SPI_MASTER_SCLK_SPEED_te pclk_div)
Changes the SPI master clock speed divisor at runtime.
SPI_BIT_FIRST_te
SPI frame bit order.
SPI_CLOCK_PHASE_te
SPI clock phase (CPHA).
SPI_DATA_FRAME_FORMAT_te
SPI data frame size.
SPI_MODE_te
SPI operating mode.
SPI_SLAVE_SELECT_MODE_te
SPI slave select (NSS) management mode.
SPI_MASTER_SCLK_SPEED_te
SPI master clock speed as a division of the peripheral clock (PCLK).
SPI_CLOCK_POLARITY_te
SPI clock polarity (CPOL).
@ SPI_BIT_FIRST_LSB
@ SPI_BIT_FIRST_MSB
@ SPI_CLOCK_PHASE_SECOND_TRANSITION
@ SPI_CLOCK_PHASE_FIRST_TRANSITION
@ SPI_DATA_FRAME_FORMAT_16_BIT
@ SPI_DATA_FRAME_FORMATE_8_BIT
@ SPI_MODE_SLAVE
@ SPI_MODE_MASTER
@ SPI_SLAVE_SELECT_MODE_SW
@ SPI_SLAVE_SELECT_MODE_HW
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_8
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_2
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_16
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_4
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_256
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_32
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_128
@ SPI_MASTER_SCLK_SPEED_PCLK_DIV_64
@ SPI_CLOCK_POLARITY_0_IDLE
@ SPI_CLOCK_POLARITY_1_IDLE
STM32F401RE MCU-specific peripheral register definitions and bit position enumerations.
Configuration structure for initializing an SPI peripheral.
SPI_CLOCK_POLARITY_te clock_polarity
SPI_SLAVE_SELECT_MODE_te slave_select_mode
SPI_REGDEF_ts * instance
SPI_MASTER_SCLK_SPEED_te master_sclk_speed
SPI_DATA_FRAME_FORMAT_te data_frame_format
SPI_CLOCK_PHASE_te clock_phase
SPI_MODE_te mode
SPI_BIT_FIRST_te bit_first
SPI peripheral register map.