Prusa MINI Firmware overview
|
Go to the documentation of this file.
37 #ifndef __STM32F4xx_HAL_SPI_H
38 #define __STM32F4xx_HAL_SPI_H
166 #define HAL_SPI_ERROR_NONE 0x00000000U
167 #define HAL_SPI_ERROR_MODF 0x00000001U
168 #define HAL_SPI_ERROR_CRC 0x00000002U
169 #define HAL_SPI_ERROR_OVR 0x00000004U
170 #define HAL_SPI_ERROR_FRE 0x00000008U
171 #define HAL_SPI_ERROR_DMA 0x00000010U
172 #define HAL_SPI_ERROR_FLAG 0x00000020U
180 #define SPI_MODE_SLAVE 0x00000000U
181 #define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
189 #define SPI_DIRECTION_2LINES 0x00000000U
190 #define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
191 #define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
199 #define SPI_DATASIZE_8BIT 0x00000000U
200 #define SPI_DATASIZE_16BIT SPI_CR1_DFF
208 #define SPI_POLARITY_LOW 0x00000000U
209 #define SPI_POLARITY_HIGH SPI_CR1_CPOL
217 #define SPI_PHASE_1EDGE 0x00000000U
218 #define SPI_PHASE_2EDGE SPI_CR1_CPHA
226 #define SPI_NSS_SOFT SPI_CR1_SSM
227 #define SPI_NSS_HARD_INPUT 0x00000000U
228 #define SPI_NSS_HARD_OUTPUT 0x00040000U
236 #define SPI_BAUDRATEPRESCALER_2 0x00000000U
237 #define SPI_BAUDRATEPRESCALER_4 0x00000008U
238 #define SPI_BAUDRATEPRESCALER_8 0x00000010U
239 #define SPI_BAUDRATEPRESCALER_16 0x00000018U
240 #define SPI_BAUDRATEPRESCALER_32 0x00000020U
241 #define SPI_BAUDRATEPRESCALER_64 0x00000028U
242 #define SPI_BAUDRATEPRESCALER_128 0x00000030U
243 #define SPI_BAUDRATEPRESCALER_256 0x00000038U
251 #define SPI_FIRSTBIT_MSB 0x00000000U
252 #define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
260 #define SPI_TIMODE_DISABLE 0x00000000U
261 #define SPI_TIMODE_ENABLE SPI_CR2_FRF
269 #define SPI_CRCCALCULATION_DISABLE 0x00000000U
270 #define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
278 #define SPI_IT_TXE SPI_CR2_TXEIE
279 #define SPI_IT_RXNE SPI_CR2_RXNEIE
280 #define SPI_IT_ERR SPI_CR2_ERRIE
288 #define SPI_FLAG_RXNE SPI_SR_RXNE
289 #define SPI_FLAG_TXE SPI_SR_TXE
290 #define SPI_FLAG_BSY SPI_SR_BSY
291 #define SPI_FLAG_CRCERR SPI_SR_CRCERR
292 #define SPI_FLAG_MODF SPI_SR_MODF
293 #define SPI_FLAG_OVR SPI_SR_OVR
294 #define SPI_FLAG_FRE SPI_SR_FRE
313 #define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
325 #define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
326 #define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
338 #define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
354 #define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
361 #define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = (uint16_t)(~SPI_FLAG_CRCERR))
368 #define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
370 __IO uint32_t tmpreg_modf = 0x00U; \
371 tmpreg_modf = (__HANDLE__)->Instance->SR; \
372 (__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE); \
373 UNUSED(tmpreg_modf); \
381 #define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
383 __IO uint32_t tmpreg_ovr = 0x00U; \
384 tmpreg_ovr = (__HANDLE__)->Instance->DR; \
385 tmpreg_ovr = (__HANDLE__)->Instance->SR; \
386 UNUSED(tmpreg_ovr); \
394 #define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) \
396 __IO uint32_t tmpreg_fre = 0x00U; \
397 tmpreg_fre = (__HANDLE__)->Instance->SR; \
398 UNUSED(tmpreg_fre); \
406 #define __HAL_SPI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_SPE)
413 #define __HAL_SPI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE))
496 #define SPI_1LINE_TX(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_BIDIOE)
503 #define SPI_1LINE_RX(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_BIDIOE))
510 #define SPI_RESET_CRC(__HANDLE__) do{(__HANDLE__)->Instance->CR1 &= (uint16_t)(~SPI_CR1_CRCEN);\
511 (__HANDLE__)->Instance->CR1 |= SPI_CR1_CRCEN;}while(0U)
513 #define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_SLAVE) || \
514 ((MODE) == SPI_MODE_MASTER))
516 #define IS_SPI_DIRECTION(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
517 ((MODE) == SPI_DIRECTION_2LINES_RXONLY) || \
518 ((MODE) == SPI_DIRECTION_1LINE))
520 #define IS_SPI_DIRECTION_2LINES(MODE) ((MODE) == SPI_DIRECTION_2LINES)
522 #define IS_SPI_DIRECTION_2LINES_OR_1LINE(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
523 ((MODE) == SPI_DIRECTION_1LINE))
525 #define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DATASIZE_16BIT) || \
526 ((DATASIZE) == SPI_DATASIZE_8BIT))
528 #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_POLARITY_LOW) || \
529 ((CPOL) == SPI_POLARITY_HIGH))
531 #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_PHASE_1EDGE) || \
532 ((CPHA) == SPI_PHASE_2EDGE))
534 #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_SOFT) || \
535 ((NSS) == SPI_NSS_HARD_INPUT) || \
536 ((NSS) == SPI_NSS_HARD_OUTPUT))
538 #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BAUDRATEPRESCALER_2) || \
539 ((PRESCALER) == SPI_BAUDRATEPRESCALER_4) || \
540 ((PRESCALER) == SPI_BAUDRATEPRESCALER_8) || \
541 ((PRESCALER) == SPI_BAUDRATEPRESCALER_16) || \
542 ((PRESCALER) == SPI_BAUDRATEPRESCALER_32) || \
543 ((PRESCALER) == SPI_BAUDRATEPRESCALER_64) || \
544 ((PRESCALER) == SPI_BAUDRATEPRESCALER_128) || \
545 ((PRESCALER) == SPI_BAUDRATEPRESCALER_256))
547 #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \
548 ((BIT) == SPI_FIRSTBIT_LSB))
550 #define IS_SPI_TIMODE(MODE) (((MODE) == SPI_TIMODE_DISABLE) || \
551 ((MODE) == SPI_TIMODE_ENABLE))
553 #define IS_SPI_CRC_CALCULATION(CALCULATION) (((CALCULATION) == SPI_CRCCALCULATION_DISABLE) || \
554 ((CALCULATION) == SPI_CRCCALCULATION_ENABLE))
556 #define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) (((POLYNOMIAL) >= 0x01U) && ((POLYNOMIAL) <= 0xFFFFU))
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi)
__IO uint16_t TxXferCount
Definition: stm32f4xx_hal_spi.h:130
uint16_t RxXferSize
Definition: stm32f4xx_hal_spi.h:134
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
__IO uint16_t RxXferCount
Definition: stm32f4xx_hal_spi.h:136
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi)
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_SPI_StateTypeDef
HAL SPI State structure definition.
Definition: stm32f4xx_hal_spi.h:106
void(* RxISR)(struct __SPI_HandleTypeDef *hspi)
Definition: stm32f4xx_hal_spi.h:138
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
SPI MSP Initialization This function configures the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:252
SPI_TypeDef * Instance
Definition: stm32f4xx_hal_spi.h:122
SPI handle Structure definition.
Definition: stm32f4xx_hal_spi.h:120
uint32_t CLKPhase
Definition: stm32f4xx_hal_spi.h:77
uint8_t * pTxBuffPtr
Definition: stm32f4xx_hal_spi.h:126
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi)
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
void HAL_SPI_AbortCpltCallback(SPI_HandleTypeDef *hspi)
DMA_HandleTypeDef * hdmarx
Definition: stm32f4xx_hal_spi.h:144
uint32_t CLKPolarity
Definition: stm32f4xx_hal_spi.h:74
Definition: stm32f4xx_hal_spi.h:114
uint32_t CRCPolynomial
Definition: stm32f4xx_hal_spi.h:99
void(* TxISR)(struct __SPI_HandleTypeDef *hspi)
Definition: stm32f4xx_hal_spi.h:140
Definition: stm32f4xx_hal_spi.h:113
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi)
struct __SPI_HandleTypeDef SPI_HandleTypeDef
SPI handle Structure definition.
Definition: stm32f4xx_hal_spi.h:112
uint8_t * pRxBuffPtr
Definition: stm32f4xx_hal_spi.h:132
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
SPI MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:337
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
Definition: stm32f4xx_hal_spi.h:109
Definition: stm32f4xx_hal_spi.h:111
HAL_LockTypeDef Lock
Definition: stm32f4xx_hal_spi.h:146
uint32_t TIMode
Definition: stm32f4xx_hal_spi.h:93
Definition: stm32f4xx_hal_spi.h:110
void
Definition: png.h:1083
DMA handle Structure definition.
Definition: stm32f4xx_hal_dma.h:155
__IO uint32_t ErrorCode
Definition: stm32f4xx_hal_spi.h:150
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_SPI_DeInit(SPI_HandleTypeDef *hspi)
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi)
__IO HAL_SPI_StateTypeDef State
Definition: stm32f4xx_hal_spi.h:148
HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi)
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi)
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi)
const uint8_t[]
Definition: 404_html.c:3
uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi)
uint32_t FirstBit
Definition: stm32f4xx_hal_spi.h:90
uint32_t DataSize
Definition: stm32f4xx_hal_spi.h:71
SPI_InitTypeDef Init
Definition: stm32f4xx_hal_spi.h:124
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
uint16_t TxXferSize
Definition: stm32f4xx_hal_spi.h:128
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi)
Definition: stm32f4xx_hal_spi.h:108
uint32_t BaudRatePrescaler
Definition: stm32f4xx_hal_spi.h:84
uint32_t CRCCalculation
Definition: stm32f4xx_hal_spi.h:96
uint32_t Direction
Definition: stm32f4xx_hal_spi.h:68
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi)
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32f4xx_hal_def.h:66
DMA_HandleTypeDef * hdmatx
Definition: stm32f4xx_hal_spi.h:142
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_SPI_Abort(SPI_HandleTypeDef *hspi)
uint32_t NSS
Definition: stm32f4xx_hal_spi.h:80
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
uint32_t Mode
Definition: stm32f4xx_hal_spi.h:65
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
Definition: main.c:918
HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi)
SPI Configuration Structure definition.
Definition: stm32f4xx_hal_spi.h:63
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)