The foxBMS secondary mcu API documentation
spi.h
Go to the documentation of this file.
1 
54 #ifndef SPI_H_
55 #define SPI_H_
56 
57 /*================== Includes =============================================*/
58 #include "spi_cfg.h"
59 
60 /*================== Macros and Definitions ===============================*/
61 
66 typedef struct {
67  uint8_t transmit_ongoing;
69  uint8_t counter;
70 } SPI_STATE_s;
71 
72 /*================== Constant and Variable Definitions ====================*/
73 
74 /*================== Function Prototypes ==================================*/
75 
83 extern void SPI_Init(SPI_HandleType_s *hspi);
84 
91 
97 extern void HAL_SPI_TxCpltCallback(SPI_HandleType_s *hspi);
98 
108 extern STD_RETURN_TYPE_e SPI_Transmit(SPI_HandleType_s *hspi, uint8_t *pData, uint16_t Size);
109 
120 extern STD_RETURN_TYPE_e SPI_TransmitReceive(SPI_HandleType_s *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
121 
129 extern void SPI_SetCS(uint8_t busID);
130 
139 extern void SPI_UnsetCS(uint8_t busID);
140 
141 
149 
150 
155 extern void SPI_SetTransmitOngoing(void);
156 
157 
158 
159 /*================== Function Implementations =============================*/
160 
161 
162 #endif /* SPI_H_ */
void HAL_SPI_TxCpltCallback(SPI_HandleType_s *hspi)
callback SPI transmit complete from SPI-Interrupt
Definition: spi.c:139
void SPI_Init(SPI_HandleType_s *hspi)
initializes the SPI module.
Definition: spi.c:80
void HAL_SPI_TxRxCpltCallback(SPI_HandleType_s *hspi)
callback SPI transmit and receive complete from SPI-Interrupt
Definition: spi.c:120
uint8_t dummyByte_ongoing
Definition: spi.h:68
STD_RETURN_TYPE_e SPI_Transmit(SPI_HandleType_s *hspi, uint8_t *pData, uint16_t Size)
transmits through SPI without receiving data.
Definition: spi.c:234
STD_RETURN_TYPE_e SPI_IsTransmitOngoing(void)
gets the SPI transmit status.
Definition: spi.c:308
void SPI_SetTransmitOngoing(void)
sets the SPI transmit status.
Definition: spi.c:316
STD_RETURN_TYPE_e
Definition: std_types.h:76
void SPI_UnsetCS(uint8_t busID)
sets Chip Select high to end SPI transmission.
Definition: spi.c:198
SPI_HandleTypeDef SPI_HandleType_s
Definition: spi_cfg.h:79
Definition: spi.h:66
uint8_t counter
Definition: spi.h:69
uint8_t transmit_ongoing
Definition: spi.h:67
Headers for the configuration for the serial peripheral interface module.
STD_RETURN_TYPE_e SPI_TransmitReceive(SPI_HandleType_s *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
transmits and receives data through SPI.
Definition: spi.c:256
void SPI_SetCS(uint8_t busID)
sets Chip Select low to start SPI transmission.
Definition: spi.c:162