gr55xx_hal_spi.h
Go to the documentation of this file.
1
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_SPI_H__
53 #define __GR55xx_HAL_SPI_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_spi.h"
61 #include "gr55xx_hal_def.h"
62
63 /* Exported types ------------------------------------------------------------*/
75 typedef enum
76 {
77 HAL_SPI_STATE_RESET = 0x00,
78 HAL_SPI_STATE_READY = 0x01,
79 HAL_SPI_STATE_BUSY = 0x02,
80 HAL_SPI_STATE_BUSY_TX = 0x12,
81 HAL_SPI_STATE_BUSY_RX = 0x22,
82 HAL_SPI_STATE_BUSY_TX_RX = 0x32,
83 HAL_SPI_STATE_ABORT = 0x08,
84 HAL_SPI_STATE_ERROR = 0x04
86 } hal_spi_state_t;
87
103 typedef struct _spi_init
104 {
105 uint32_t data_size;
108 uint32_t clock_polarity;
111 uint32_t clock_phase;
114 uint32_t baudrate_prescaler;
119 uint32_t ti_mode;
122 uint32_t slave_select;
124 } spi_init_t;
134 typedef struct _spi_handle
135 {
136 ssi_regs_t *p_instance;
138 spi_init_t init;
140 uint8_t *p_tx_buffer;
142 __IO uint32_t tx_xfer_size;
144 __IO uint32_t tx_xfer_count;
146 uint8_t *p_rx_buffer;
148 __IO uint32_t rx_xfer_size;
150 __IO uint32_t rx_xfer_count;
152 void (*write_fifo)(struct _spi_handle *p_spi);
154 void (*read_fifo)(struct _spi_handle *p_spi);
156 void (*read_write_fifo)(struct _spi_handle *p_spi);
158 dma_handle_t *p_dmatx;
160 dma_handle_t *p_dmarx;
162 __IO hal_lock_t lock;
164 __IO hal_spi_state_t state;
166 __IO uint32_t error_code;
168 uint32_t timeout;
170 #if defined(HAL_SPI_V2_MODULE_ENABLED)
171 uint32_t retention[9];
172 #else
173 uint32_t retention[8];
174 #endif
175 } spi_handle_t;
192 typedef struct _hal_spi_callback
193 {
194 void (*spi_msp_init)(spi_handle_t *p_spi);
195 void (*spi_msp_deinit)(spi_handle_t *p_spi);
196 void (*spi_error_callback)(spi_handle_t *p_spi);
197 void (*spi_abort_cplt_callback)(spi_handle_t *p_spi);
198 void (*spi_rx_cplt_callback)(spi_handle_t *p_spi);
199 void (*spi_tx_cplt_callback)(spi_handle_t *p_spi);
200 void (*spi_tx_rx_cplt_callback)(spi_handle_t *p_spi);
201 } hal_spi_callback_t;
202
212 /* Exported constants --------------------------------------------------------*/
220 #define SPI_DIRECTION_FULL_DUPLEX LL_SSI_FULL_DUPLEX
221 #define SPI_DIRECTION_SIMPLEX_TX LL_SSI_SIMPLEX_TX
222 #define SPI_DIRECTION_SIMPLEX_RX LL_SSI_SIMPLEX_RX
223 #define SPI_DIRECTION_READ_EEPROM LL_SSI_READ_EEPROM
229 #define HAL_SPI_ERROR_NONE ((uint32_t)0x00000000)
230 #define HAL_SPI_ERROR_TIMEOUT ((uint32_t)0x00000001)
231 #define HAL_SPI_ERROR_TRANSFER ((uint32_t)0x00000002)
232 #define HAL_SPI_ERROR_DMA ((uint32_t)0x00000004)
233 #define HAL_SPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
239 #define SPI_DATASIZE_4BIT LL_SSI_DATASIZE_4BIT
240 #define SPI_DATASIZE_5BIT LL_SSI_DATASIZE_5BIT
241 #define SPI_DATASIZE_6BIT LL_SSI_DATASIZE_6BIT
242 #define SPI_DATASIZE_7BIT LL_SSI_DATASIZE_7BIT
243 #define SPI_DATASIZE_8BIT LL_SSI_DATASIZE_8BIT
244 #define SPI_DATASIZE_9BIT LL_SSI_DATASIZE_9BIT
245 #define SPI_DATASIZE_10BIT LL_SSI_DATASIZE_10BIT
246 #define SPI_DATASIZE_11BIT LL_SSI_DATASIZE_11BIT
247 #define SPI_DATASIZE_12BIT LL_SSI_DATASIZE_12BIT
248 #define SPI_DATASIZE_13BIT LL_SSI_DATASIZE_13BIT
249 #define SPI_DATASIZE_14BIT LL_SSI_DATASIZE_14BIT
250 #define SPI_DATASIZE_15BIT LL_SSI_DATASIZE_15BIT
251 #define SPI_DATASIZE_16BIT LL_SSI_DATASIZE_16BIT
252 #define SPI_DATASIZE_17BIT LL_SSI_DATASIZE_17BIT
253 #define SPI_DATASIZE_18BIT LL_SSI_DATASIZE_18BIT
254 #define SPI_DATASIZE_19BIT LL_SSI_DATASIZE_19BIT
255 #define SPI_DATASIZE_20BIT LL_SSI_DATASIZE_20BIT
256 #define SPI_DATASIZE_21BIT LL_SSI_DATASIZE_21BIT
257 #define SPI_DATASIZE_22BIT LL_SSI_DATASIZE_22BIT
258 #define SPI_DATASIZE_23BIT LL_SSI_DATASIZE_23BIT
259 #define SPI_DATASIZE_24BIT LL_SSI_DATASIZE_24BIT
260 #define SPI_DATASIZE_25BIT LL_SSI_DATASIZE_25BIT
261 #define SPI_DATASIZE_26BIT LL_SSI_DATASIZE_26BIT
262 #define SPI_DATASIZE_27BIT LL_SSI_DATASIZE_27BIT
263 #define SPI_DATASIZE_28BIT LL_SSI_DATASIZE_28BIT
264 #define SPI_DATASIZE_29BIT LL_SSI_DATASIZE_29BIT
265 #define SPI_DATASIZE_30BIT LL_SSI_DATASIZE_30BIT
266 #define SPI_DATASIZE_31BIT LL_SSI_DATASIZE_31BIT
267 #define SPI_DATASIZE_32BIT LL_SSI_DATASIZE_32BIT
273 #define SPI_POLARITY_LOW LL_SSI_SCPOL_LOW
274 #define SPI_POLARITY_HIGH LL_SSI_SCPOL_HIGH
280 #define SPI_PHASE_1EDGE LL_SSI_SCPHA_1EDGE
281 #define SPI_PHASE_2EDGE LL_SSI_SCPHA_2EDGE
287 #define SPI_TIMODE_DISABLE ((uint32_t)0x00000000)
288 #define SPI_TIMODE_ENABLE LL_SSI_PROTOCOL_TI
294 #define SPI_SLAVE_SELECT_0 LL_SSI_SLAVE0
295 #define SPI_SLAVE_SELECT_1 LL_SSI_SLAVE1
296 #define SPI_SLAVE_SELECT_ALL (LL_SSI_SLAVE0 | LL_SSI_SLAVE1)
302 #define SPI_TX_FIFO_LEVEL_MAX 8
303 #define SPI_RX_FIFO_LEVEL_MAX 8
309 #define SPI_FLAG_DCOL LL_SSI_SR_DCOL
310 #define SPI_FLAG_TXE LL_SSI_SR_TXE
311 #define SPI_FLAG_RFF LL_SSI_SR_RFF
312 #define SPI_FLAG_RFNE LL_SSI_SR_RFNE
313 #define SPI_FLAG_TFE LL_SSI_SR_TFE
314 #define SPI_FLAG_TFNF LL_SSI_SR_TFNF
315 #define SPI_FLAG_BUSY LL_SSI_SR_BUSY
321 #define SPI_IT_MST LL_SSI_IS_MST
322 #define SPI_IT_RXF LL_SSI_IS_RXF
323 #define SPI_IT_RXO LL_SSI_IS_RXO
324 #define SPI_IT_RXU LL_SSI_IS_RXU
325 #define SPI_IT_TXO LL_SSI_IS_TXO
326 #define SPI_IT_TXE LL_SSI_IS_TXE
332 #define HAL_SPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
337 /* Exported macro ------------------------------------------------------------*/
338
346 #define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_SPI_STATE_RESET)
347
352 #define __HAL_SPI_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN)
353
358 #define __HAL_SPI_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN)
359
364 #define __HAL_SPI_ENABLE_DMATX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE)
365
370 #define __HAL_SPI_ENABLE_DMARX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE)
371
376 #define __HAL_SPI_DISABLE_DMATX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE)
377
382 #define __HAL_SPI_DISABLE_DMARX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE)
383
396 #define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__))
397
410 #define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__))
411
424 #define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__INTERRUPT__)) == (__INTERRUPT__))
425
439 #define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET)
440
454 #define __HAL_SPI_CLEAR_FLAG(__HANDLE__, __FLAG__) READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__))
455
458 /* Private macros ------------------------------------------------------------*/
467 #define IS_SPI_DIRECTION(__MODE__) (((__MODE__) == SPI_DIRECTION_FULL_DUPLEX) || \
468 ((__MODE__) == SPI_DIRECTION_SIMPLEX_TX) || \
469 ((__MODE__) == SPI_DIRECTION_SIMPLEX_RX) || \
470 ((__MODE__) == SPI_DIRECTION_READ_EEPROM))
471
476 #define IS_SPI_DATASIZE(__DATASIZE__) (((__DATASIZE__) >= SPI_DATASIZE_4BIT) && \
477 ((__DATASIZE__) <= SPI_DATASIZE_32BIT))
478
483 #define IS_SPI_CPOL(__CPOL__) (((__CPOL__) == SPI_POLARITY_LOW) || \
484 ((__CPOL__) == SPI_POLARITY_HIGH))
485
490 #define IS_SPI_CPHA(__CPHA__) (((__CPHA__) == SPI_PHASE_1EDGE) || \
491 ((__CPHA__) == SPI_PHASE_2EDGE))
492
497 #define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__) ((__PRESCALER__) <= 0xFFFF)
498
503 #define IS_SPI_TIMODE(__MODE__) (((__MODE__) == SPI_TIMODE_DISABLE) || \
504 ((__MODE__) == SPI_TIMODE_ENABLE))
505
510 #define IS_SPI_SLAVE(__SLAVE__) (((__SLAVE__) == SPI_SLAVE_SELECT_0) || \
511 ((__SLAVE__) == SPI_SLAVE_SELECT_1) || \
512 ((__SLAVE__) == SPI_SLAVE_SELECT_ALL))
513
518 #define IS_SPI_RX_SAMPLE_DLY(__DLY__) (((__DLY__) >= 0) && ((__DLY__) <= 7))
519
520
525 #define IS_SPI_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= 7))
526
531 /* Exported functions --------------------------------------------------------*/
576 hal_status_t hal_spi_init(spi_handle_t *p_spi);
577
588 hal_status_t hal_spi_deinit(spi_handle_t *p_spi);
589
598 void hal_spi_msp_init(spi_handle_t *p_spi);
599
608 void hal_spi_msp_deinit(spi_handle_t *p_spi);
609
658 hal_status_t hal_spi_transmit(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout);
659
673 hal_status_t hal_spi_receive(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout);
674
689 hal_status_t hal_spi_transmit_receive(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length, uint32_t timeout);
690
706 hal_status_t hal_spi_read_eeprom(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data, uint32_t timeout);
707
720 hal_status_t hal_spi_transmit_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length);
721
734 hal_status_t hal_spi_receive_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length);
735
749 hal_status_t hal_spi_transmit_receive_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length);
750
765 hal_status_t hal_spi_read_eeprom_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data);
766
779 hal_status_t hal_spi_transmit_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length);
780
794 hal_status_t hal_spi_receive_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length);
795
809 hal_status_t hal_spi_transmit_receive_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length);
810
825 hal_status_t hal_spi_read_eeprom_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data);
826
845 hal_status_t hal_spi_abort(spi_handle_t *p_spi);
846
867 hal_status_t hal_spi_abort_it(spi_handle_t *p_spi);
868
882 void hal_spi_irq_handler(spi_handle_t *p_spi);
883
890 void hal_spi_tx_cplt_callback(spi_handle_t *p_spi);
891
898 void hal_spi_rx_cplt_callback(spi_handle_t *p_spi);
899
906 void hal_spi_tx_rx_cplt_callback(spi_handle_t *p_spi);
907
914 void hal_spi_error_callback(spi_handle_t *p_spi);
915
922 void hal_spi_abort_cplt_callback(spi_handle_t *p_spi);
923
960 hal_spi_state_t hal_spi_get_state(spi_handle_t *p_spi);
961
969 uint32_t hal_spi_get_error(spi_handle_t *p_spi);
970
978 void hal_spi_set_timeout(spi_handle_t *p_spi, uint32_t timeout);
979
991 hal_status_t hal_spi_set_tx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold);
992
1004 hal_status_t hal_spi_set_rx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold);
1005
1013 uint32_t hal_spi_get_tx_fifo_threshold(spi_handle_t *p_spi);
1014
1022 uint32_t hal_spi_get_rx_fifo_threshold(spi_handle_t *p_spi);
1023
1035 hal_status_t hal_spi_suspend_reg(spi_handle_t *p_spi);
1036
1049 hal_status_t hal_spi_resume_reg(spi_handle_t *p_spi);
1050
1051
1056 #ifdef __cplusplus
1057 }
1058 #endif
1059
1060 #endif /* __GR55xx_HAL_SPI_H__ */
1061
hal_spi_abort_cplt_callback
void hal_spi_abort_cplt_callback(spi_handle_t *p_spi)
SPI Abort Completed callback.
hal_spi_get_state
hal_spi_state_t hal_spi_get_state(spi_handle_t *p_spi)
Return the SPI handle state.
_hal_spi_callback::spi_rx_cplt_callback
void(* spi_rx_cplt_callback)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:198
HAL_SPI_STATE_READY
@ HAL_SPI_STATE_READY
Definition: gr55xx_hal_spi.h:78
_spi_handle
SPI handle Structure definition.
Definition: gr55xx_hal_spi.h:135
hal_spi_deinit
hal_status_t hal_spi_deinit(spi_handle_t *p_spi)
De-initialize the SPI peripheral.
_spi_init::ti_mode
uint32_t ti_mode
Definition: gr55xx_hal_spi.h:119
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
hal_spi_abort
hal_status_t hal_spi_abort(spi_handle_t *p_spi)
Abort ongoing transfer (blocking mode).
_hal_spi_callback::spi_abort_cplt_callback
void(* spi_abort_cplt_callback)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:197
_hal_spi_callback::spi_tx_cplt_callback
void(* spi_tx_cplt_callback)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:199
hal_spi_callback_t
struct _hal_spi_callback hal_spi_callback_t
HAL_SPI Callback function definition.
hal_spi_error_callback
void hal_spi_error_callback(spi_handle_t *p_spi)
SPI error callback.
_spi_init::slave_select
uint32_t slave_select
Definition: gr55xx_hal_spi.h:122
_spi_handle::read_fifo
void(* read_fifo)(struct _spi_handle *p_spi)
Definition: gr55xx_hal_spi.h:154
hal_spi_init
hal_status_t hal_spi_init(spi_handle_t *p_spi)
Initialize the SPI according to the specified parameters in the spi_init_t and initialize the associa...
_spi_handle::p_instance
ssi_regs_t * p_instance
Definition: gr55xx_hal_spi.h:136
hal_spi_get_tx_fifo_threshold
uint32_t hal_spi_get_tx_fifo_threshold(spi_handle_t *p_spi)
Get the TX FIFO threshold.
HAL_SPI_STATE_ERROR
@ HAL_SPI_STATE_ERROR
Definition: gr55xx_hal_spi.h:84
hal_spi_transmit_dma
hal_status_t hal_spi_transmit_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length)
Transmit an amount of data in non-blocking mode with DMA.
hal_spi_transmit
hal_status_t hal_spi_transmit(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout)
Transmit an amount of data in blocking mode.
hal_spi_read_eeprom_dma
hal_status_t hal_spi_read_eeprom_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data)
Read an amount of data from EEPROM in non-blocking mode with DMA.
_spi_handle::p_tx_buffer
uint8_t * p_tx_buffer
Definition: gr55xx_hal_spi.h:140
_spi_init
SPI init Structure definition.
Definition: gr55xx_hal_spi.h:104
HAL_SPI_STATE_BUSY_TX
@ HAL_SPI_STATE_BUSY_TX
Definition: gr55xx_hal_spi.h:80
_spi_handle::retention
uint32_t retention[8]
Definition: gr55xx_hal_spi.h:173
_spi_handle::tx_xfer_count
__IO uint32_t tx_xfer_count
Definition: gr55xx_hal_spi.h:144
hal_spi_receive_dma
hal_status_t hal_spi_receive_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length)
Receive an amount of data in non-blocking mode with DMA.
hal_spi_tx_cplt_callback
void hal_spi_tx_cplt_callback(spi_handle_t *p_spi)
Tx Transfer completed callback.
hal_spi_read_eeprom
hal_status_t hal_spi_read_eeprom(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data, uint32_t timeout)
Read an amount of data from EEPROM in blocking mode.
hal_spi_state_t
hal_spi_state_t
HAL SPI State Enumerations definition.
Definition: gr55xx_hal_spi.h:76
hal_spi_rx_cplt_callback
void hal_spi_rx_cplt_callback(spi_handle_t *p_spi)
Rx Transfer completed callback.
_spi_handle::p_dmatx
dma_handle_t * p_dmatx
Definition: gr55xx_hal_spi.h:158
_spi_handle::timeout
uint32_t timeout
Definition: gr55xx_hal_spi.h:168
_spi_handle::p_rx_buffer
uint8_t * p_rx_buffer
Definition: gr55xx_hal_spi.h:146
_hal_spi_callback::spi_error_callback
void(* spi_error_callback)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:196
_spi_handle::error_code
__IO uint32_t error_code
Definition: gr55xx_hal_spi.h:166
HAL_SPI_STATE_BUSY
@ HAL_SPI_STATE_BUSY
Definition: gr55xx_hal_spi.h:79
_spi_handle::rx_xfer_count
__IO uint32_t rx_xfer_count
Definition: gr55xx_hal_spi.h:150
hal_spi_irq_handler
void hal_spi_irq_handler(spi_handle_t *p_spi)
Handle SPI interrupt request.
_hal_spi_callback::spi_msp_init
void(* spi_msp_init)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:194
hal_spi_suspend_reg
hal_status_t hal_spi_suspend_reg(spi_handle_t *p_spi)
Suspend some registers related to SPI configuration before sleep.
_hal_spi_callback::spi_tx_rx_cplt_callback
void(* spi_tx_rx_cplt_callback)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:200
_spi_handle::tx_xfer_size
__IO uint32_t tx_xfer_size
Definition: gr55xx_hal_spi.h:142
hal_spi_resume_reg
hal_status_t hal_spi_resume_reg(spi_handle_t *p_spi)
Restore some registers related to SPI configuration after sleep. This function must be used in conjun...
_spi_handle::p_dmarx
dma_handle_t * p_dmarx
Definition: gr55xx_hal_spi.h:160
hal_spi_transmit_receive
hal_status_t hal_spi_transmit_receive(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length, uint32_t timeout)
Transmit and Receive an amount of data in blocking mode.
hal_spi_set_rx_fifo_threshold
hal_status_t hal_spi_set_rx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold)
Set the RX FIFO threshold.
hal_spi_get_rx_fifo_threshold
uint32_t hal_spi_get_rx_fifo_threshold(spi_handle_t *p_spi)
Get the RX FIFO threshold.
spi_handle_t
struct _spi_handle spi_handle_t
SPI handle Structure definition.
HAL_SPI_STATE_ABORT
@ HAL_SPI_STATE_ABORT
Definition: gr55xx_hal_spi.h:83
HAL_SPI_STATE_BUSY_RX
@ HAL_SPI_STATE_BUSY_RX
Definition: gr55xx_hal_spi.h:81
_spi_handle::init
spi_init_t init
Definition: gr55xx_hal_spi.h:138
hal_spi_abort_it
hal_status_t hal_spi_abort_it(spi_handle_t *p_spi)
Abort ongoing transfer (Interrupt mode).
HAL_SPI_STATE_RESET
@ HAL_SPI_STATE_RESET
Definition: gr55xx_hal_spi.h:77
hal_spi_transmit_it
hal_status_t hal_spi_transmit_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length)
Transmit an amount of data in non-blocking mode with Interrupt.
hal_spi_receive_it
hal_status_t hal_spi_receive_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length)
Receive an amount of data in non-blocking mode with Interrupt.
HAL_SPI_STATE_BUSY_TX_RX
@ HAL_SPI_STATE_BUSY_TX_RX
Definition: gr55xx_hal_spi.h:82
gr55xx_ll_spi.h
Header file containing functions prototypes of SPI LL library.
hal_spi_msp_deinit
void hal_spi_msp_deinit(spi_handle_t *p_spi)
De-initialize the SPI MSP.
hal_spi_receive
hal_status_t hal_spi_receive(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout)
Receive an amount of data in blocking mode.
spi_init_t
struct _spi_init spi_init_t
SPI init Structure definition.
_hal_spi_callback::spi_msp_deinit
void(* spi_msp_deinit)(spi_handle_t *p_spi)
Definition: gr55xx_hal_spi.h:195
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
_spi_init::clock_polarity
uint32_t clock_polarity
Definition: gr55xx_hal_spi.h:108
_spi_init::baudrate_prescaler
uint32_t baudrate_prescaler
Definition: gr55xx_hal_spi.h:114
hal_spi_set_tx_fifo_threshold
hal_status_t hal_spi_set_tx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold)
Set the TX FIFO threshold.
_spi_handle::read_write_fifo
void(* read_write_fifo)(struct _spi_handle *p_spi)
Definition: gr55xx_hal_spi.h:156
hal_spi_msp_init
void hal_spi_msp_init(spi_handle_t *p_spi)
Initialize the SPI MSP.
_spi_handle::state
__IO hal_spi_state_t state
Definition: gr55xx_hal_spi.h:164
hal_spi_tx_rx_cplt_callback
void hal_spi_tx_rx_cplt_callback(spi_handle_t *p_spi)
Tx and Rx Transfer completed callback.
_spi_handle::rx_xfer_size
__IO uint32_t rx_xfer_size
Definition: gr55xx_hal_spi.h:148
hal_spi_transmit_receive_dma
hal_status_t hal_spi_transmit_receive_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length)
Transmit and Receive an amount of data in non-blocking mode with DMA.
hal_spi_read_eeprom_it
hal_status_t hal_spi_read_eeprom_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data)
Read an amount of data from EEPROM in non-blocking mode with Interrupt.
hal_spi_transmit_receive_it
hal_status_t hal_spi_transmit_receive_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length)
Transmit and Receive an amount of data in non-blocking mode with Interrupt.
hal_spi_get_error
uint32_t hal_spi_get_error(spi_handle_t *p_spi)
Return the SPI error code.
_spi_init::clock_phase
uint32_t clock_phase
Definition: gr55xx_hal_spi.h:111
_spi_handle::lock
__IO hal_lock_t lock
Definition: gr55xx_hal_spi.h:162
_hal_spi_callback
HAL_SPI Callback function definition.
Definition: gr55xx_hal_spi.h:193
_dma_handle
DMA handle Structure definition.
Definition: gr55xx_hal_dma.h:179
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_spi_handle::write_fifo
void(* write_fifo)(struct _spi_handle *p_spi)
Definition: gr55xx_hal_spi.h:152
_spi_init::data_size
uint32_t data_size
Definition: gr55xx_hal_spi.h:105
hal_spi_set_timeout
void hal_spi_set_timeout(spi_handle_t *p_spi, uint32_t timeout)
Set the SPI internal process timeout value.