Go to the documentation of this file.
37 #ifndef __STM32F7xx_HAL_CAN_LEGACY_H
38 #define __STM32F7xx_HAL_CAN_LEGACY_H
255 #define HAL_CAN_ERROR_NONE 0x00000000U
256 #define HAL_CAN_ERROR_EWG 0x00000001U
257 #define HAL_CAN_ERROR_EPV 0x00000002U
258 #define HAL_CAN_ERROR_BOF 0x00000004U
259 #define HAL_CAN_ERROR_STF 0x00000008U
260 #define HAL_CAN_ERROR_FOR 0x00000010U
261 #define HAL_CAN_ERROR_ACK 0x00000020U
262 #define HAL_CAN_ERROR_BR 0x00000040U
263 #define HAL_CAN_ERROR_BD 0x00000080U
264 #define HAL_CAN_ERROR_CRC 0x00000100U
265 #define HAL_CAN_ERROR_FOV0 0x00000200U
266 #define HAL_CAN_ERROR_FOV1 0x00000400U
267 #define HAL_CAN_ERROR_TXFAIL 0x00000800U
275 #define CAN_INITSTATUS_FAILED ((uint8_t)0x00)
276 #define CAN_INITSTATUS_SUCCESS ((uint8_t)0x01)
284 #define CAN_MODE_NORMAL 0x00000000U
285 #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM)
286 #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM)
287 #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM))
295 #define CAN_SJW_1TQ 0x00000000U
296 #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0)
297 #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1)
298 #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW)
306 #define CAN_BS1_1TQ 0x00000000U
307 #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0)
308 #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1)
309 #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0))
310 #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2)
311 #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0))
312 #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1))
313 #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0))
314 #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3)
315 #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0))
316 #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1))
317 #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0))
318 #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2))
319 #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0))
320 #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1))
321 #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1)
329 #define CAN_BS2_1TQ 0x00000000U
330 #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0)
331 #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1)
332 #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0))
333 #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2)
334 #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0))
335 #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1))
336 #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2)
344 #define CAN_FILTERMODE_IDMASK ((uint8_t)0x00)
345 #define CAN_FILTERMODE_IDLIST ((uint8_t)0x01)
353 #define CAN_FILTERSCALE_16BIT ((uint8_t)0x00)
354 #define CAN_FILTERSCALE_32BIT ((uint8_t)0x01)
362 #define CAN_FILTER_FIFO0 ((uint8_t)0x00)
363 #define CAN_FILTER_FIFO1 ((uint8_t)0x01)
371 #define CAN_ID_STD 0x00000000U
372 #define CAN_ID_EXT 0x00000004U
380 #define CAN_RTR_DATA 0x00000000U
381 #define CAN_RTR_REMOTE 0x00000002U
389 #define CAN_FIFO0 ((uint8_t)0x00)
390 #define CAN_FIFO1 ((uint8_t)0x01)
404 #define CAN_FLAG_RQCP0 0x00000500U
405 #define CAN_FLAG_RQCP1 0x00000508U
406 #define CAN_FLAG_RQCP2 0x00000510U
407 #define CAN_FLAG_TXOK0 0x00000501U
408 #define CAN_FLAG_TXOK1 0x00000509U
409 #define CAN_FLAG_TXOK2 0x00000511U
410 #define CAN_FLAG_TME0 0x0000051AU
411 #define CAN_FLAG_TME1 0x0000051BU
412 #define CAN_FLAG_TME2 0x0000051CU
415 #define CAN_FLAG_FF0 0x00000203U
416 #define CAN_FLAG_FOV0 0x00000204U
418 #define CAN_FLAG_FF1 0x00000403U
419 #define CAN_FLAG_FOV1 0x00000404U
422 #define CAN_FLAG_INAK 0x00000100U
423 #define CAN_FLAG_SLAK 0x00000101U
424 #define CAN_FLAG_ERRI 0x00000102U
425 #define CAN_FLAG_WKU 0x00000103U
426 #define CAN_FLAG_SLAKI 0x00000104U
432 #define CAN_FLAG_EWG 0x00000300U
433 #define CAN_FLAG_EPV 0x00000301U
434 #define CAN_FLAG_BOF 0x00000302U
442 #define CAN_IT_TME CAN_IER_TMEIE
445 #define CAN_IT_FMP0 CAN_IER_FMPIE0
446 #define CAN_IT_FF0 CAN_IER_FFIE0
447 #define CAN_IT_FOV0 CAN_IER_FOVIE0
448 #define CAN_IT_FMP1 CAN_IER_FMPIE1
449 #define CAN_IT_FF1 CAN_IER_FFIE1
450 #define CAN_IT_FOV1 CAN_IER_FOVIE1
453 #define CAN_IT_WKU CAN_IER_WKUIE
454 #define CAN_IT_SLK CAN_IER_SLKIE
457 #define CAN_IT_EWG CAN_IER_EWGIE
458 #define CAN_IT_EPV CAN_IER_EPVIE
459 #define CAN_IT_BOF CAN_IER_BOFIE
460 #define CAN_IT_LEC CAN_IER_LECIE
461 #define CAN_IT_ERR CAN_IER_ERRIE
469 #define CAN_TXMAILBOX_0 ((uint8_t)0x00)
470 #define CAN_TXMAILBOX_1 ((uint8_t)0x01)
471 #define CAN_TXMAILBOX_2 ((uint8_t)0x02)
489 #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET)
497 #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
505 #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
513 #define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
514 ((uint8_t)((__HANDLE__)->Instance->RF0R&0x03U)) : ((uint8_t)((__HANDLE__)->Instance->RF1R&0x03U)))
543 #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \
544 ((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
545 (((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
546 (((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
547 (((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
548 ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))))
574 #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \
575 ((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
576 (((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
577 (((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
578 (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))))
589 #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
597 #define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\
598 (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) == (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0)) :\
599 ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) == (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1)) :\
600 ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)))
608 #define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
609 ((__HANDLE__)->Instance->RF0R = CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R = CAN_RF1R_RFOM1))
617 #define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\
618 (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ0) :\
619 ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ1) :\
620 ((__HANDLE__)->Instance->TSR = CAN_TSR_ABRQ2))
631 #define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \
632 ((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF))
710 #define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04)
711 #define CAN_FLAG_MASK 0x000000FFU
720 #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \
721 ((MODE) == CAN_MODE_LOOPBACK)|| \
722 ((MODE) == CAN_MODE_SILENT) || \
723 ((MODE) == CAN_MODE_SILENT_LOOPBACK))
724 #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \
725 ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ))
726 #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ)
727 #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ)
728 #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U))
729 #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27U)
730 #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \
731 ((MODE) == CAN_FILTERMODE_IDLIST))
732 #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \
733 ((SCALE) == CAN_FILTERSCALE_32BIT))
734 #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \
735 ((FIFO) == CAN_FILTER_FIFO1))
736 #define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28U)
738 #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
739 #define IS_CAN_STDID(STDID) ((STDID) <= 0x7FFU)
740 #define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU)
741 #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
743 #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \
744 ((IDTYPE) == CAN_ID_EXT))
745 #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))
746 #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
CanRxMsgTypeDef * pRx1Msg
HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef
HAL Status structures definition
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout)
CAN init structure definition.
HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber)
uint32_t FilterMaskIdHigh
HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan)
HAL_LockTypeDef
HAL Lock structures definition
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef *hcan)
CAN filter configuration structure definition.
CAN handle Structure definition.
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterConfTypeDef *sFilterConfig)
@ HAL_CAN_STATE_BUSY_RX0_RX1
CAN Tx message structure definition.
uint32_t FilterActivation
HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout)
@ HAL_CAN_STATE_BUSY_TX_RX1
CAN Rx message structure definition.
__IO HAL_CAN_StateTypeDef State
uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan)
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_CAN_StateTypeDef
HAL State structures definition.
void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan)
void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan)
HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan)
@ HAL_CAN_STATE_BUSY_TX_RX0
@ HAL_CAN_STATE_BUSY_TX_RX0_RX1
uint32_t FilterFIFOAssignment
HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan)
void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan)