Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Child:
116:c0f6e94411f5
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32f7xx_hal_can.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.1
Kojto 107:4f6c30876dfa 6 * @date 25-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of CAN HAL module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32F7xx_HAL_CAN_H
Kojto 107:4f6c30876dfa 40 #define __STM32F7xx_HAL_CAN_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32f7xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup CAN
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58 /** @defgroup CAN_Exported_Types CAN Exported Types
Kojto 107:4f6c30876dfa 59 * @{
Kojto 107:4f6c30876dfa 60 */
Kojto 107:4f6c30876dfa 61
Kojto 107:4f6c30876dfa 62 /**
Kojto 107:4f6c30876dfa 63 * @brief HAL State structures definition
Kojto 107:4f6c30876dfa 64 */
Kojto 107:4f6c30876dfa 65 typedef enum
Kojto 107:4f6c30876dfa 66 {
Kojto 107:4f6c30876dfa 67 HAL_CAN_STATE_RESET = 0x00, /*!< CAN not yet initialized or disabled */
Kojto 107:4f6c30876dfa 68 HAL_CAN_STATE_READY = 0x01, /*!< CAN initialized and ready for use */
Kojto 107:4f6c30876dfa 69 HAL_CAN_STATE_BUSY = 0x02, /*!< CAN process is ongoing */
Kojto 107:4f6c30876dfa 70 HAL_CAN_STATE_BUSY_TX = 0x12, /*!< CAN process is ongoing */
Kojto 107:4f6c30876dfa 71 HAL_CAN_STATE_BUSY_RX = 0x22, /*!< CAN process is ongoing */
Kojto 107:4f6c30876dfa 72 HAL_CAN_STATE_BUSY_TX_RX = 0x32, /*!< CAN process is ongoing */
Kojto 107:4f6c30876dfa 73 HAL_CAN_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 107:4f6c30876dfa 74 HAL_CAN_STATE_ERROR = 0x04 /*!< CAN error state */
Kojto 107:4f6c30876dfa 75
Kojto 107:4f6c30876dfa 76 }HAL_CAN_StateTypeDef;
Kojto 107:4f6c30876dfa 77
Kojto 107:4f6c30876dfa 78 /**
Kojto 107:4f6c30876dfa 79 * @brief CAN init structure definition
Kojto 107:4f6c30876dfa 80 */
Kojto 107:4f6c30876dfa 81 typedef struct
Kojto 107:4f6c30876dfa 82 {
Kojto 107:4f6c30876dfa 83 uint32_t Prescaler; /*!< Specifies the length of a time quantum.
Kojto 107:4f6c30876dfa 84 This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
Kojto 107:4f6c30876dfa 85
Kojto 107:4f6c30876dfa 86 uint32_t Mode; /*!< Specifies the CAN operating mode.
Kojto 107:4f6c30876dfa 87 This parameter can be a value of @ref CAN_operating_mode */
Kojto 107:4f6c30876dfa 88
Kojto 107:4f6c30876dfa 89 uint32_t SJW; /*!< Specifies the maximum number of time quanta
Kojto 107:4f6c30876dfa 90 the CAN hardware is allowed to lengthen or
Kojto 107:4f6c30876dfa 91 shorten a bit to perform resynchronization.
Kojto 107:4f6c30876dfa 92 This parameter can be a value of @ref CAN_synchronisation_jump_width */
Kojto 107:4f6c30876dfa 93
Kojto 107:4f6c30876dfa 94 uint32_t BS1; /*!< Specifies the number of time quanta in Bit Segment 1.
Kojto 107:4f6c30876dfa 95 This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */
Kojto 107:4f6c30876dfa 96
Kojto 107:4f6c30876dfa 97 uint32_t BS2; /*!< Specifies the number of time quanta in Bit Segment 2.
Kojto 107:4f6c30876dfa 98 This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */
Kojto 107:4f6c30876dfa 99
Kojto 107:4f6c30876dfa 100 uint32_t TTCM; /*!< Enable or disable the time triggered communication mode.
Kojto 107:4f6c30876dfa 101 This parameter can be set to ENABLE or DISABLE. */
Kojto 107:4f6c30876dfa 102
Kojto 107:4f6c30876dfa 103 uint32_t ABOM; /*!< Enable or disable the automatic bus-off management.
Kojto 107:4f6c30876dfa 104 This parameter can be set to ENABLE or DISABLE */
Kojto 107:4f6c30876dfa 105
Kojto 107:4f6c30876dfa 106 uint32_t AWUM; /*!< Enable or disable the automatic wake-up mode.
Kojto 107:4f6c30876dfa 107 This parameter can be set to ENABLE or DISABLE */
Kojto 107:4f6c30876dfa 108
Kojto 107:4f6c30876dfa 109 uint32_t NART; /*!< Enable or disable the non-automatic retransmission mode.
Kojto 107:4f6c30876dfa 110 This parameter can be set to ENABLE or DISABLE */
Kojto 107:4f6c30876dfa 111
Kojto 107:4f6c30876dfa 112 uint32_t RFLM; /*!< Enable or disable the receive FIFO Locked mode.
Kojto 107:4f6c30876dfa 113 This parameter can be set to ENABLE or DISABLE */
Kojto 107:4f6c30876dfa 114
Kojto 107:4f6c30876dfa 115 uint32_t TXFP; /*!< Enable or disable the transmit FIFO priority.
Kojto 107:4f6c30876dfa 116 This parameter can be set to ENABLE or DISABLE */
Kojto 107:4f6c30876dfa 117 }CAN_InitTypeDef;
Kojto 107:4f6c30876dfa 118
Kojto 107:4f6c30876dfa 119 /**
Kojto 107:4f6c30876dfa 120 * @brief CAN filter configuration structure definition
Kojto 107:4f6c30876dfa 121 */
Kojto 107:4f6c30876dfa 122 typedef struct
Kojto 107:4f6c30876dfa 123 {
Kojto 107:4f6c30876dfa 124 uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit
Kojto 107:4f6c30876dfa 125 configuration, first one for a 16-bit configuration).
Kojto 107:4f6c30876dfa 126 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 107:4f6c30876dfa 127
Kojto 107:4f6c30876dfa 128 uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit
Kojto 107:4f6c30876dfa 129 configuration, second one for a 16-bit configuration).
Kojto 107:4f6c30876dfa 130 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 107:4f6c30876dfa 131
Kojto 107:4f6c30876dfa 132 uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number,
Kojto 107:4f6c30876dfa 133 according to the mode (MSBs for a 32-bit configuration,
Kojto 107:4f6c30876dfa 134 first one for a 16-bit configuration).
Kojto 107:4f6c30876dfa 135 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 107:4f6c30876dfa 136
Kojto 107:4f6c30876dfa 137 uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number,
Kojto 107:4f6c30876dfa 138 according to the mode (LSBs for a 32-bit configuration,
Kojto 107:4f6c30876dfa 139 second one for a 16-bit configuration).
Kojto 107:4f6c30876dfa 140 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
Kojto 107:4f6c30876dfa 141
Kojto 107:4f6c30876dfa 142 uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter.
Kojto 107:4f6c30876dfa 143 This parameter can be a value of @ref CAN_filter_FIFO */
Kojto 107:4f6c30876dfa 144
Kojto 107:4f6c30876dfa 145 uint32_t FilterNumber; /*!< Specifies the filter which will be initialized.
Kojto 107:4f6c30876dfa 146 This parameter must be a number between Min_Data = 0 and Max_Data = 27 */
Kojto 107:4f6c30876dfa 147
Kojto 107:4f6c30876dfa 148 uint32_t FilterMode; /*!< Specifies the filter mode to be initialized.
Kojto 107:4f6c30876dfa 149 This parameter can be a value of @ref CAN_filter_mode */
Kojto 107:4f6c30876dfa 150
Kojto 107:4f6c30876dfa 151 uint32_t FilterScale; /*!< Specifies the filter scale.
Kojto 107:4f6c30876dfa 152 This parameter can be a value of @ref CAN_filter_scale */
Kojto 107:4f6c30876dfa 153
Kojto 107:4f6c30876dfa 154 uint32_t FilterActivation; /*!< Enable or disable the filter.
Kojto 107:4f6c30876dfa 155 This parameter can be set to ENABLE or DISABLE. */
Kojto 107:4f6c30876dfa 156
Kojto 107:4f6c30876dfa 157 uint32_t BankNumber; /*!< Select the start slave bank filter.
Kojto 107:4f6c30876dfa 158 This parameter must be a number between Min_Data = 0 and Max_Data = 28 */
Kojto 107:4f6c30876dfa 159
Kojto 107:4f6c30876dfa 160 }CAN_FilterConfTypeDef;
Kojto 107:4f6c30876dfa 161
Kojto 107:4f6c30876dfa 162 /**
Kojto 107:4f6c30876dfa 163 * @brief CAN Tx message structure definition
Kojto 107:4f6c30876dfa 164 */
Kojto 107:4f6c30876dfa 165 typedef struct
Kojto 107:4f6c30876dfa 166 {
Kojto 107:4f6c30876dfa 167 uint32_t StdId; /*!< Specifies the standard identifier.
Kojto 107:4f6c30876dfa 168 This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */
Kojto 107:4f6c30876dfa 169
Kojto 107:4f6c30876dfa 170 uint32_t ExtId; /*!< Specifies the extended identifier.
Kojto 107:4f6c30876dfa 171 This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */
Kojto 107:4f6c30876dfa 172
Kojto 107:4f6c30876dfa 173 uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted.
Kojto 107:4f6c30876dfa 174 This parameter can be a value of @ref CAN_Identifier_Type */
Kojto 107:4f6c30876dfa 175
Kojto 107:4f6c30876dfa 176 uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted.
Kojto 107:4f6c30876dfa 177 This parameter can be a value of @ref CAN_remote_transmission_request */
Kojto 107:4f6c30876dfa 178
Kojto 107:4f6c30876dfa 179 uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted.
Kojto 107:4f6c30876dfa 180 This parameter must be a number between Min_Data = 0 and Max_Data = 8 */
Kojto 107:4f6c30876dfa 181
Kojto 107:4f6c30876dfa 182 uint8_t Data[8]; /*!< Contains the data to be transmitted.
Kojto 107:4f6c30876dfa 183 This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
Kojto 107:4f6c30876dfa 184
Kojto 107:4f6c30876dfa 185 }CanTxMsgTypeDef;
Kojto 107:4f6c30876dfa 186
Kojto 107:4f6c30876dfa 187 /**
Kojto 107:4f6c30876dfa 188 * @brief CAN Rx message structure definition
Kojto 107:4f6c30876dfa 189 */
Kojto 107:4f6c30876dfa 190 typedef struct
Kojto 107:4f6c30876dfa 191 {
Kojto 107:4f6c30876dfa 192 uint32_t StdId; /*!< Specifies the standard identifier.
Kojto 107:4f6c30876dfa 193 This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF */
Kojto 107:4f6c30876dfa 194
Kojto 107:4f6c30876dfa 195 uint32_t ExtId; /*!< Specifies the extended identifier.
Kojto 107:4f6c30876dfa 196 This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF */
Kojto 107:4f6c30876dfa 197
Kojto 107:4f6c30876dfa 198 uint32_t IDE; /*!< Specifies the type of identifier for the message that will be received.
Kojto 107:4f6c30876dfa 199 This parameter can be a value of @ref CAN_Identifier_Type */
Kojto 107:4f6c30876dfa 200
Kojto 107:4f6c30876dfa 201 uint32_t RTR; /*!< Specifies the type of frame for the received message.
Kojto 107:4f6c30876dfa 202 This parameter can be a value of @ref CAN_remote_transmission_request */
Kojto 107:4f6c30876dfa 203
Kojto 107:4f6c30876dfa 204 uint32_t DLC; /*!< Specifies the length of the frame that will be received.
Kojto 107:4f6c30876dfa 205 This parameter must be a number between Min_Data = 0 and Max_Data = 8 */
Kojto 107:4f6c30876dfa 206
Kojto 107:4f6c30876dfa 207 uint8_t Data[8]; /*!< Contains the data to be received.
Kojto 107:4f6c30876dfa 208 This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
Kojto 107:4f6c30876dfa 209
Kojto 107:4f6c30876dfa 210 uint32_t FMI; /*!< Specifies the index of the filter the message stored in the mailbox passes through.
Kojto 107:4f6c30876dfa 211 This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF */
Kojto 107:4f6c30876dfa 212
Kojto 107:4f6c30876dfa 213 uint32_t FIFONumber; /*!< Specifies the receive FIFO number.
Kojto 107:4f6c30876dfa 214 This parameter can be CAN_FIFO0 or CAN_FIFO1 */
Kojto 107:4f6c30876dfa 215
Kojto 107:4f6c30876dfa 216 }CanRxMsgTypeDef;
Kojto 107:4f6c30876dfa 217
Kojto 107:4f6c30876dfa 218 /**
Kojto 107:4f6c30876dfa 219 * @brief CAN handle Structure definition
Kojto 107:4f6c30876dfa 220 */
Kojto 107:4f6c30876dfa 221 typedef struct
Kojto 107:4f6c30876dfa 222 {
Kojto 107:4f6c30876dfa 223 CAN_TypeDef *Instance; /*!< Register base address */
Kojto 107:4f6c30876dfa 224
Kojto 107:4f6c30876dfa 225 CAN_InitTypeDef Init; /*!< CAN required parameters */
Kojto 107:4f6c30876dfa 226
Kojto 107:4f6c30876dfa 227 CanTxMsgTypeDef* pTxMsg; /*!< Pointer to transmit structure */
Kojto 107:4f6c30876dfa 228
Kojto 107:4f6c30876dfa 229 CanRxMsgTypeDef* pRxMsg; /*!< Pointer to reception structure */
Kojto 107:4f6c30876dfa 230
Kojto 107:4f6c30876dfa 231 __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */
Kojto 107:4f6c30876dfa 232
Kojto 107:4f6c30876dfa 233 HAL_LockTypeDef Lock; /*!< CAN locking object */
Kojto 107:4f6c30876dfa 234
Kojto 107:4f6c30876dfa 235 __IO uint32_t ErrorCode; /*!< CAN Error code */
Kojto 107:4f6c30876dfa 236
Kojto 107:4f6c30876dfa 237 }CAN_HandleTypeDef;
Kojto 107:4f6c30876dfa 238
Kojto 107:4f6c30876dfa 239 /**
Kojto 107:4f6c30876dfa 240 * @}
Kojto 107:4f6c30876dfa 241 */
Kojto 107:4f6c30876dfa 242
Kojto 107:4f6c30876dfa 243 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 244 /** @defgroup CAN_Exported_Constants CAN Exported Constants
Kojto 107:4f6c30876dfa 245 * @{
Kojto 107:4f6c30876dfa 246 */
Kojto 107:4f6c30876dfa 247
Kojto 107:4f6c30876dfa 248 /** @defgroup HAL_CAN_Error_Code HAL CAN Error Code
Kojto 107:4f6c30876dfa 249 * @{
Kojto 107:4f6c30876dfa 250 */
Kojto 107:4f6c30876dfa 251 #define HAL_CAN_ERROR_NONE 0x00 /*!< No error */
Kojto 107:4f6c30876dfa 252 #define HAL_CAN_ERROR_EWG 0x01 /*!< EWG error */
Kojto 107:4f6c30876dfa 253 #define HAL_CAN_ERROR_EPV 0x02 /*!< EPV error */
Kojto 107:4f6c30876dfa 254 #define HAL_CAN_ERROR_BOF 0x04 /*!< BOF error */
Kojto 107:4f6c30876dfa 255 #define HAL_CAN_ERROR_STF 0x08 /*!< Stuff error */
Kojto 107:4f6c30876dfa 256 #define HAL_CAN_ERROR_FOR 0x10 /*!< Form error */
Kojto 107:4f6c30876dfa 257 #define HAL_CAN_ERROR_ACK 0x20 /*!< Acknowledgment error */
Kojto 107:4f6c30876dfa 258 #define HAL_CAN_ERROR_BR 0x40 /*!< Bit recessive */
Kojto 107:4f6c30876dfa 259 #define HAL_CAN_ERROR_BD 0x80 /*!< LEC dominant */
Kojto 107:4f6c30876dfa 260 #define HAL_CAN_ERROR_CRC 0x100 /*!< LEC transfer error */
Kojto 107:4f6c30876dfa 261 /**
Kojto 107:4f6c30876dfa 262 * @}
Kojto 107:4f6c30876dfa 263 */
Kojto 107:4f6c30876dfa 264
Kojto 107:4f6c30876dfa 265 /** @defgroup CAN_InitStatus CAN InitStatus
Kojto 107:4f6c30876dfa 266 * @{
Kojto 107:4f6c30876dfa 267 */
Kojto 107:4f6c30876dfa 268 #define CAN_INITSTATUS_FAILED ((uint8_t)0x00) /*!< CAN initialization failed */
Kojto 107:4f6c30876dfa 269 #define CAN_INITSTATUS_SUCCESS ((uint8_t)0x01) /*!< CAN initialization OK */
Kojto 107:4f6c30876dfa 270 /**
Kojto 107:4f6c30876dfa 271 * @}
Kojto 107:4f6c30876dfa 272 */
Kojto 107:4f6c30876dfa 273
Kojto 107:4f6c30876dfa 274 /** @defgroup CAN_operating_mode CAN Operating Mode
Kojto 107:4f6c30876dfa 275 * @{
Kojto 107:4f6c30876dfa 276 */
Kojto 107:4f6c30876dfa 277 #define CAN_MODE_NORMAL ((uint32_t)0x00000000) /*!< Normal mode */
Kojto 107:4f6c30876dfa 278 #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */
Kojto 107:4f6c30876dfa 279 #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */
Kojto 107:4f6c30876dfa 280 #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */
Kojto 107:4f6c30876dfa 281 /**
Kojto 107:4f6c30876dfa 282 * @}
Kojto 107:4f6c30876dfa 283 */
Kojto 107:4f6c30876dfa 284
Kojto 107:4f6c30876dfa 285 /** @defgroup CAN_synchronisation_jump_width CAN Synchronisation Jump Width
Kojto 107:4f6c30876dfa 286 * @{
Kojto 107:4f6c30876dfa 287 */
Kojto 107:4f6c30876dfa 288 #define CAN_SJW_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 289 #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 290 #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 291 #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 292 /**
Kojto 107:4f6c30876dfa 293 * @}
Kojto 107:4f6c30876dfa 294 */
Kojto 107:4f6c30876dfa 295
Kojto 107:4f6c30876dfa 296 /** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in bit segment 1
Kojto 107:4f6c30876dfa 297 * @{
Kojto 107:4f6c30876dfa 298 */
Kojto 107:4f6c30876dfa 299 #define CAN_BS1_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 300 #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 301 #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 302 #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 303 #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */
Kojto 107:4f6c30876dfa 304 #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */
Kojto 107:4f6c30876dfa 305 #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */
Kojto 107:4f6c30876dfa 306 #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */
Kojto 107:4f6c30876dfa 307 #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */
Kojto 107:4f6c30876dfa 308 #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */
Kojto 107:4f6c30876dfa 309 #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */
Kojto 107:4f6c30876dfa 310 #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */
Kojto 107:4f6c30876dfa 311 #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */
Kojto 107:4f6c30876dfa 312 #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */
Kojto 107:4f6c30876dfa 313 #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */
Kojto 107:4f6c30876dfa 314 #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */
Kojto 107:4f6c30876dfa 315 /**
Kojto 107:4f6c30876dfa 316 * @}
Kojto 107:4f6c30876dfa 317 */
Kojto 107:4f6c30876dfa 318
Kojto 107:4f6c30876dfa 319 /** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in bit segment 2
Kojto 107:4f6c30876dfa 320 * @{
Kojto 107:4f6c30876dfa 321 */
Kojto 107:4f6c30876dfa 322 #define CAN_BS2_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 323 #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 324 #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 325 #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 326 #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */
Kojto 107:4f6c30876dfa 327 #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */
Kojto 107:4f6c30876dfa 328 #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */
Kojto 107:4f6c30876dfa 329 #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */
Kojto 107:4f6c30876dfa 330 /**
Kojto 107:4f6c30876dfa 331 * @}
Kojto 107:4f6c30876dfa 332 */
Kojto 107:4f6c30876dfa 333
Kojto 107:4f6c30876dfa 334 /** @defgroup CAN_filter_mode CAN Filter Mode
Kojto 107:4f6c30876dfa 335 * @{
Kojto 107:4f6c30876dfa 336 */
Kojto 107:4f6c30876dfa 337 #define CAN_FILTERMODE_IDMASK ((uint8_t)0x00) /*!< Identifier mask mode */
Kojto 107:4f6c30876dfa 338 #define CAN_FILTERMODE_IDLIST ((uint8_t)0x01) /*!< Identifier list mode */
Kojto 107:4f6c30876dfa 339 /**
Kojto 107:4f6c30876dfa 340 * @}
Kojto 107:4f6c30876dfa 341 */
Kojto 107:4f6c30876dfa 342
Kojto 107:4f6c30876dfa 343 /** @defgroup CAN_filter_scale CAN Filter Scale
Kojto 107:4f6c30876dfa 344 * @{
Kojto 107:4f6c30876dfa 345 */
Kojto 107:4f6c30876dfa 346 #define CAN_FILTERSCALE_16BIT ((uint8_t)0x00) /*!< Two 16-bit filters */
Kojto 107:4f6c30876dfa 347 #define CAN_FILTERSCALE_32BIT ((uint8_t)0x01) /*!< One 32-bit filter */
Kojto 107:4f6c30876dfa 348 /**
Kojto 107:4f6c30876dfa 349 * @}
Kojto 107:4f6c30876dfa 350 */
Kojto 107:4f6c30876dfa 351
Kojto 107:4f6c30876dfa 352 /** @defgroup CAN_filter_FIFO CAN Filter FIFO
Kojto 107:4f6c30876dfa 353 * @{
Kojto 107:4f6c30876dfa 354 */
Kojto 107:4f6c30876dfa 355 #define CAN_FILTER_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
Kojto 107:4f6c30876dfa 356 #define CAN_FILTER_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
Kojto 107:4f6c30876dfa 357 /**
Kojto 107:4f6c30876dfa 358 * @}
Kojto 107:4f6c30876dfa 359 */
Kojto 107:4f6c30876dfa 360
Kojto 107:4f6c30876dfa 361 /** @defgroup CAN_Identifier_Type CAN Identifier Type
Kojto 107:4f6c30876dfa 362 * @{
Kojto 107:4f6c30876dfa 363 */
Kojto 107:4f6c30876dfa 364 #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */
Kojto 107:4f6c30876dfa 365 #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */
Kojto 107:4f6c30876dfa 366 /**
Kojto 107:4f6c30876dfa 367 * @}
Kojto 107:4f6c30876dfa 368 */
Kojto 107:4f6c30876dfa 369
Kojto 107:4f6c30876dfa 370 /** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request
Kojto 107:4f6c30876dfa 371 * @{
Kojto 107:4f6c30876dfa 372 */
Kojto 107:4f6c30876dfa 373 #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */
Kojto 107:4f6c30876dfa 374 #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */
Kojto 107:4f6c30876dfa 375 /**
Kojto 107:4f6c30876dfa 376 * @}
Kojto 107:4f6c30876dfa 377 */
Kojto 107:4f6c30876dfa 378
Kojto 107:4f6c30876dfa 379 /** @defgroup CAN_receive_FIFO_number_constants CAN Receive FIFO Number Constants
Kojto 107:4f6c30876dfa 380 * @{
Kojto 107:4f6c30876dfa 381 */
Kojto 107:4f6c30876dfa 382 #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */
Kojto 107:4f6c30876dfa 383 #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */
Kojto 107:4f6c30876dfa 384 /**
Kojto 107:4f6c30876dfa 385 * @}
Kojto 107:4f6c30876dfa 386 */
Kojto 107:4f6c30876dfa 387
Kojto 107:4f6c30876dfa 388 /** @defgroup CAN_flags CAN Flags
Kojto 107:4f6c30876dfa 389 * @{
Kojto 107:4f6c30876dfa 390 */
Kojto 107:4f6c30876dfa 391 /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus()
Kojto 107:4f6c30876dfa 392 and CAN_ClearFlag() functions. */
Kojto 107:4f6c30876dfa 393 /* If the flag is 0x1XXXXXXX, it means that it can only be used with
Kojto 107:4f6c30876dfa 394 CAN_GetFlagStatus() function. */
Kojto 107:4f6c30876dfa 395
Kojto 107:4f6c30876dfa 396 /* Transmit Flags */
Kojto 107:4f6c30876dfa 397 #define CAN_FLAG_RQCP0 ((uint32_t)0x00000500) /*!< Request MailBox0 flag */
Kojto 107:4f6c30876dfa 398 #define CAN_FLAG_RQCP1 ((uint32_t)0x00000508) /*!< Request MailBox1 flag */
Kojto 107:4f6c30876dfa 399 #define CAN_FLAG_RQCP2 ((uint32_t)0x00000510) /*!< Request MailBox2 flag */
Kojto 107:4f6c30876dfa 400 #define CAN_FLAG_TXOK0 ((uint32_t)0x00000501) /*!< Transmission OK MailBox0 flag */
Kojto 107:4f6c30876dfa 401 #define CAN_FLAG_TXOK1 ((uint32_t)0x00000509) /*!< Transmission OK MailBox1 flag */
Kojto 107:4f6c30876dfa 402 #define CAN_FLAG_TXOK2 ((uint32_t)0x00000511) /*!< Transmission OK MailBox2 flag */
Kojto 107:4f6c30876dfa 403 #define CAN_FLAG_TME0 ((uint32_t)0x0000051A) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 404 #define CAN_FLAG_TME1 ((uint32_t)0x0000051B) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 405 #define CAN_FLAG_TME2 ((uint32_t)0x0000051C) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 406
Kojto 107:4f6c30876dfa 407 /* Receive Flags */
Kojto 107:4f6c30876dfa 408 #define CAN_FLAG_FF0 ((uint32_t)0x00000203) /*!< FIFO 0 Full flag */
Kojto 107:4f6c30876dfa 409 #define CAN_FLAG_FOV0 ((uint32_t)0x00000204) /*!< FIFO 0 Overrun flag */
Kojto 107:4f6c30876dfa 410
Kojto 107:4f6c30876dfa 411 #define CAN_FLAG_FF1 ((uint32_t)0x00000403) /*!< FIFO 1 Full flag */
Kojto 107:4f6c30876dfa 412 #define CAN_FLAG_FOV1 ((uint32_t)0x00000404) /*!< FIFO 1 Overrun flag */
Kojto 107:4f6c30876dfa 413
Kojto 107:4f6c30876dfa 414 /* Operating Mode Flags */
Kojto 107:4f6c30876dfa 415 #define CAN_FLAG_WKU ((uint32_t)0x00000103) /*!< Wake up flag */
Kojto 107:4f6c30876dfa 416 #define CAN_FLAG_SLAK ((uint32_t)0x00000101) /*!< Sleep acknowledge flag */
Kojto 107:4f6c30876dfa 417 #define CAN_FLAG_SLAKI ((uint32_t)0x00000104) /*!< Sleep acknowledge flag */
Kojto 107:4f6c30876dfa 418 /* @note When SLAK interrupt is disabled (SLKIE=0), no polling on SLAKI is possible.
Kojto 107:4f6c30876dfa 419 In this case the SLAK bit can be polled.*/
Kojto 107:4f6c30876dfa 420
Kojto 107:4f6c30876dfa 421 /* Error Flags */
Kojto 107:4f6c30876dfa 422 #define CAN_FLAG_EWG ((uint32_t)0x00000300) /*!< Error warning flag */
Kojto 107:4f6c30876dfa 423 #define CAN_FLAG_EPV ((uint32_t)0x00000301) /*!< Error passive flag */
Kojto 107:4f6c30876dfa 424 #define CAN_FLAG_BOF ((uint32_t)0x00000302) /*!< Bus-Off flag */
Kojto 107:4f6c30876dfa 425 /**
Kojto 107:4f6c30876dfa 426 * @}
Kojto 107:4f6c30876dfa 427 */
Kojto 107:4f6c30876dfa 428
Kojto 107:4f6c30876dfa 429 /** @defgroup CAN_Interrupts CAN Interrupts
Kojto 107:4f6c30876dfa 430 * @{
Kojto 107:4f6c30876dfa 431 */
Kojto 107:4f6c30876dfa 432 #define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */
Kojto 107:4f6c30876dfa 433
Kojto 107:4f6c30876dfa 434 /* Receive Interrupts */
Kojto 107:4f6c30876dfa 435 #define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */
Kojto 107:4f6c30876dfa 436 #define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */
Kojto 107:4f6c30876dfa 437 #define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */
Kojto 107:4f6c30876dfa 438 #define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */
Kojto 107:4f6c30876dfa 439 #define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */
Kojto 107:4f6c30876dfa 440 #define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */
Kojto 107:4f6c30876dfa 441
Kojto 107:4f6c30876dfa 442 /* Operating Mode Interrupts */
Kojto 107:4f6c30876dfa 443 #define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */
Kojto 107:4f6c30876dfa 444 #define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */
Kojto 107:4f6c30876dfa 445
Kojto 107:4f6c30876dfa 446 /* Error Interrupts */
Kojto 107:4f6c30876dfa 447 #define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */
Kojto 107:4f6c30876dfa 448 #define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */
Kojto 107:4f6c30876dfa 449 #define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */
Kojto 107:4f6c30876dfa 450 #define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */
Kojto 107:4f6c30876dfa 451 #define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */
Kojto 107:4f6c30876dfa 452 /**
Kojto 107:4f6c30876dfa 453 * @}
Kojto 107:4f6c30876dfa 454 */
Kojto 107:4f6c30876dfa 455
Kojto 107:4f6c30876dfa 456 /** @defgroup CAN_Mailboxes_Definition CAN Mailboxes Definition
Kojto 107:4f6c30876dfa 457 * @{
Kojto 107:4f6c30876dfa 458 */
Kojto 107:4f6c30876dfa 459 #define CAN_TXMAILBOX_0 ((uint8_t)0x00)
Kojto 107:4f6c30876dfa 460 #define CAN_TXMAILBOX_1 ((uint8_t)0x01)
Kojto 107:4f6c30876dfa 461 #define CAN_TXMAILBOX_2 ((uint8_t)0x02)
Kojto 107:4f6c30876dfa 462 /**
Kojto 107:4f6c30876dfa 463 * @}
Kojto 107:4f6c30876dfa 464 */
Kojto 107:4f6c30876dfa 465
Kojto 107:4f6c30876dfa 466 /**
Kojto 107:4f6c30876dfa 467 * @}
Kojto 107:4f6c30876dfa 468 */
Kojto 107:4f6c30876dfa 469
Kojto 107:4f6c30876dfa 470 /* Exported macro ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 471 /** @defgroup CAN_Exported_Macros CAN Exported Macros
Kojto 107:4f6c30876dfa 472 * @{
Kojto 107:4f6c30876dfa 473 */
Kojto 107:4f6c30876dfa 474
Kojto 107:4f6c30876dfa 475 /** @brief Reset CAN handle state
Kojto 107:4f6c30876dfa 476 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 477 * @retval None
Kojto 107:4f6c30876dfa 478 */
Kojto 107:4f6c30876dfa 479 #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET)
Kojto 107:4f6c30876dfa 480
Kojto 107:4f6c30876dfa 481 /**
Kojto 107:4f6c30876dfa 482 * @brief Enable the specified CAN interrupts.
Kojto 107:4f6c30876dfa 483 * @param __HANDLE__: CAN handle
Kojto 107:4f6c30876dfa 484 * @param __INTERRUPT__: CAN Interrupt
Kojto 107:4f6c30876dfa 485 * @retval None
Kojto 107:4f6c30876dfa 486 */
Kojto 107:4f6c30876dfa 487 #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
Kojto 107:4f6c30876dfa 488
Kojto 107:4f6c30876dfa 489 /**
Kojto 107:4f6c30876dfa 490 * @brief Disable the specified CAN interrupts.
Kojto 107:4f6c30876dfa 491 * @param __HANDLE__: CAN handle
Kojto 107:4f6c30876dfa 492 * @param __INTERRUPT__: CAN Interrupt
Kojto 107:4f6c30876dfa 493 * @retval None
Kojto 107:4f6c30876dfa 494 */
Kojto 107:4f6c30876dfa 495 #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
Kojto 107:4f6c30876dfa 496
Kojto 107:4f6c30876dfa 497 /**
Kojto 107:4f6c30876dfa 498 * @brief Return the number of pending received messages.
Kojto 107:4f6c30876dfa 499 * @param __HANDLE__: CAN handle
Kojto 107:4f6c30876dfa 500 * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
Kojto 107:4f6c30876dfa 501 * @retval The number of pending message.
Kojto 107:4f6c30876dfa 502 */
Kojto 107:4f6c30876dfa 503 #define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
Kojto 107:4f6c30876dfa 504 ((uint8_t)((__HANDLE__)->Instance->RF0R&(uint32_t)0x03)) : ((uint8_t)((__HANDLE__)->Instance->RF1R&(uint32_t)0x03)))
Kojto 107:4f6c30876dfa 505
Kojto 107:4f6c30876dfa 506 /** @brief Check whether the specified CAN flag is set or not.
Kojto 107:4f6c30876dfa 507 * @param __HANDLE__: CAN Handle
Kojto 107:4f6c30876dfa 508 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 509 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 510 * @arg CAN_TSR_RQCP0: Request MailBox0 Flag
Kojto 107:4f6c30876dfa 511 * @arg CAN_TSR_RQCP1: Request MailBox1 Flag
Kojto 107:4f6c30876dfa 512 * @arg CAN_TSR_RQCP2: Request MailBox2 Flag
Kojto 107:4f6c30876dfa 513 * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
Kojto 107:4f6c30876dfa 514 * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
Kojto 107:4f6c30876dfa 515 * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
Kojto 107:4f6c30876dfa 516 * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
Kojto 107:4f6c30876dfa 517 * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
Kojto 107:4f6c30876dfa 518 * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
Kojto 107:4f6c30876dfa 519 * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
Kojto 107:4f6c30876dfa 520 * @arg CAN_FLAG_FF0: FIFO 0 Full Flag
Kojto 107:4f6c30876dfa 521 * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
Kojto 107:4f6c30876dfa 522 * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
Kojto 107:4f6c30876dfa 523 * @arg CAN_FLAG_FF1: FIFO 1 Full Flag
Kojto 107:4f6c30876dfa 524 * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
Kojto 107:4f6c30876dfa 525 * @arg CAN_FLAG_WKU: Wake up Flag
Kojto 107:4f6c30876dfa 526 * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 527 * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 528 * @arg CAN_FLAG_EWG: Error Warning Flag
Kojto 107:4f6c30876dfa 529 * @arg CAN_FLAG_EPV: Error Passive Flag
Kojto 107:4f6c30876dfa 530 * @arg CAN_FLAG_BOF: Bus-Off Flag
Kojto 107:4f6c30876dfa 531 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 532 */
Kojto 107:4f6c30876dfa 533 #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \
Kojto 107:4f6c30876dfa 534 ((((__FLAG__) >> 8) == 5)? ((((__HANDLE__)->Instance->TSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 535 (((__FLAG__) >> 8) == 2)? ((((__HANDLE__)->Instance->RF0R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 536 (((__FLAG__) >> 8) == 4)? ((((__HANDLE__)->Instance->RF1R) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 537 (((__FLAG__) >> 8) == 1)? ((((__HANDLE__)->Instance->MSR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 538 ((((__HANDLE__)->Instance->ESR) & (1 << ((__FLAG__) & CAN_FLAG_MASK))) == (1 << ((__FLAG__) & CAN_FLAG_MASK))))
Kojto 107:4f6c30876dfa 539
Kojto 107:4f6c30876dfa 540 /** @brief Clear the specified CAN pending flag.
Kojto 107:4f6c30876dfa 541 * @param __HANDLE__: CAN Handle.
Kojto 107:4f6c30876dfa 542 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 543 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 544 * @arg CAN_TSR_RQCP0: Request MailBox0 Flag
Kojto 107:4f6c30876dfa 545 * @arg CAN_TSR_RQCP1: Request MailBox1 Flag
Kojto 107:4f6c30876dfa 546 * @arg CAN_TSR_RQCP2: Request MailBox2 Flag
Kojto 107:4f6c30876dfa 547 * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
Kojto 107:4f6c30876dfa 548 * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
Kojto 107:4f6c30876dfa 549 * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
Kojto 107:4f6c30876dfa 550 * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
Kojto 107:4f6c30876dfa 551 * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
Kojto 107:4f6c30876dfa 552 * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
Kojto 107:4f6c30876dfa 553 * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
Kojto 107:4f6c30876dfa 554 * @arg CAN_FLAG_FF0: FIFO 0 Full Flag
Kojto 107:4f6c30876dfa 555 * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
Kojto 107:4f6c30876dfa 556 * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
Kojto 107:4f6c30876dfa 557 * @arg CAN_FLAG_FF1: FIFO 1 Full Flag
Kojto 107:4f6c30876dfa 558 * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
Kojto 107:4f6c30876dfa 559 * @arg CAN_FLAG_WKU: Wake up Flag
Kojto 107:4f6c30876dfa 560 * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 561 * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 562 * @arg CAN_FLAG_EWG: Error Warning Flag
Kojto 107:4f6c30876dfa 563 * @arg CAN_FLAG_EPV: Error Passive Flag
Kojto 107:4f6c30876dfa 564 * @arg CAN_FLAG_BOF: Bus-Off Flag
Kojto 107:4f6c30876dfa 565 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 566 */
Kojto 107:4f6c30876dfa 567 #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \
Kojto 107:4f6c30876dfa 568 ((((__FLAG__) >> 8) == 5)? (((__HANDLE__)->Instance->TSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 569 (((__FLAG__) >> 8) == 2)? (((__HANDLE__)->Instance->RF0R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 570 (((__FLAG__) >> 8) == 4)? (((__HANDLE__)->Instance->RF1R) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 571 (((__FLAG__) >> 8) == 1)? (((__HANDLE__)->Instance->MSR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 572 (((__HANDLE__)->Instance->ESR) = ~((uint32_t)1 << ((__FLAG__) & CAN_FLAG_MASK))))
Kojto 107:4f6c30876dfa 573
Kojto 107:4f6c30876dfa 574 /** @brief Check if the specified CAN interrupt source is enabled or disabled.
Kojto 107:4f6c30876dfa 575 * @param __HANDLE__: CAN Handle
Kojto 107:4f6c30876dfa 576 * @param __INTERRUPT__: specifies the CAN interrupt source to check.
Kojto 107:4f6c30876dfa 577 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 578 * @arg CAN_IT_TME: Transmit mailbox empty interrupt enable
Kojto 107:4f6c30876dfa 579 * @arg CAN_IT_FMP0: FIFO0 message pending interrupt enable
Kojto 107:4f6c30876dfa 580 * @arg CAN_IT_FMP1: FIFO1 message pending interrupt enable
Kojto 107:4f6c30876dfa 581 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 582 */
Kojto 107:4f6c30876dfa 583 #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 107:4f6c30876dfa 584
Kojto 107:4f6c30876dfa 585 /**
Kojto 107:4f6c30876dfa 586 * @brief Check the transmission status of a CAN Frame.
Kojto 107:4f6c30876dfa 587 * @param __HANDLE__: CAN Handle
Kojto 107:4f6c30876dfa 588 * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
Kojto 107:4f6c30876dfa 589 * @retval The new status of transmission (TRUE or FALSE).
Kojto 107:4f6c30876dfa 590 */
Kojto 107:4f6c30876dfa 591 #define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\
Kojto 107:4f6c30876dfa 592 (((__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)) :\
Kojto 107:4f6c30876dfa 593 ((__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)) :\
Kojto 107:4f6c30876dfa 594 ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)))
Kojto 107:4f6c30876dfa 595
Kojto 107:4f6c30876dfa 596 /**
Kojto 107:4f6c30876dfa 597 * @brief Release the specified receive FIFO.
Kojto 107:4f6c30876dfa 598 * @param __HANDLE__: CAN handle
Kojto 107:4f6c30876dfa 599 * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
Kojto 107:4f6c30876dfa 600 * @retval None
Kojto 107:4f6c30876dfa 601 */
Kojto 107:4f6c30876dfa 602 #define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
Kojto 107:4f6c30876dfa 603 ((__HANDLE__)->Instance->RF0R |= CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R |= CAN_RF1R_RFOM1))
Kojto 107:4f6c30876dfa 604
Kojto 107:4f6c30876dfa 605 /**
Kojto 107:4f6c30876dfa 606 * @brief Cancel a transmit request.
Kojto 107:4f6c30876dfa 607 * @param __HANDLE__: CAN Handle
Kojto 107:4f6c30876dfa 608 * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
Kojto 107:4f6c30876dfa 609 * @retval None
Kojto 107:4f6c30876dfa 610 */
Kojto 107:4f6c30876dfa 611 #define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\
Kojto 107:4f6c30876dfa 612 (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ0) :\
Kojto 107:4f6c30876dfa 613 ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ1) :\
Kojto 107:4f6c30876dfa 614 ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ2))
Kojto 107:4f6c30876dfa 615
Kojto 107:4f6c30876dfa 616 /**
Kojto 107:4f6c30876dfa 617 * @brief Enable or disable the DBG Freeze for CAN.
Kojto 107:4f6c30876dfa 618 * @param __HANDLE__: CAN Handle
Kojto 107:4f6c30876dfa 619 * @param __NEWSTATE__: new state of the CAN peripheral.
Kojto 107:4f6c30876dfa 620 * This parameter can be: ENABLE (CAN reception/transmission is frozen
Kojto 107:4f6c30876dfa 621 * during debug. Reception FIFOs can still be accessed/controlled normally)
Kojto 107:4f6c30876dfa 622 * or DISABLE (CAN is working during debug).
Kojto 107:4f6c30876dfa 623 * @retval None
Kojto 107:4f6c30876dfa 624 */
Kojto 107:4f6c30876dfa 625 #define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \
Kojto 107:4f6c30876dfa 626 ((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF))
Kojto 107:4f6c30876dfa 627
Kojto 107:4f6c30876dfa 628 /**
Kojto 107:4f6c30876dfa 629 * @}
Kojto 107:4f6c30876dfa 630 */
Kojto 107:4f6c30876dfa 631
Kojto 107:4f6c30876dfa 632 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 633 /** @addtogroup CAN_Exported_Functions
Kojto 107:4f6c30876dfa 634 * @{
Kojto 107:4f6c30876dfa 635 */
Kojto 107:4f6c30876dfa 636
Kojto 107:4f6c30876dfa 637 /** @addtogroup CAN_Exported_Functions_Group1
Kojto 107:4f6c30876dfa 638 * @{
Kojto 107:4f6c30876dfa 639 */
Kojto 107:4f6c30876dfa 640 /* Initialization/de-initialization functions ***********************************/
Kojto 107:4f6c30876dfa 641 HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 642 HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig);
Kojto 107:4f6c30876dfa 643 HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 644 void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 645 void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 646 /**
Kojto 107:4f6c30876dfa 647 * @}
Kojto 107:4f6c30876dfa 648 */
Kojto 107:4f6c30876dfa 649
Kojto 107:4f6c30876dfa 650 /** @addtogroup CAN_Exported_Functions_Group2
Kojto 107:4f6c30876dfa 651 * @{
Kojto 107:4f6c30876dfa 652 */
Kojto 107:4f6c30876dfa 653 /* I/O operation functions ******************************************************/
Kojto 107:4f6c30876dfa 654 HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout);
Kojto 107:4f6c30876dfa 655 HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 656 HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout);
Kojto 107:4f6c30876dfa 657 HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber);
Kojto 107:4f6c30876dfa 658 HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 659 HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 660 void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 661 void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 662 void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 663 void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 664 /**
Kojto 107:4f6c30876dfa 665 * @}
Kojto 107:4f6c30876dfa 666 */
Kojto 107:4f6c30876dfa 667
Kojto 107:4f6c30876dfa 668 /** @addtogroup CAN_Exported_Functions_Group3
Kojto 107:4f6c30876dfa 669 * @{
Kojto 107:4f6c30876dfa 670 */
Kojto 107:4f6c30876dfa 671 /* Peripheral State functions ***************************************************/
Kojto 107:4f6c30876dfa 672 uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 673 HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 674 /**
Kojto 107:4f6c30876dfa 675 * @}
Kojto 107:4f6c30876dfa 676 */
Kojto 107:4f6c30876dfa 677
Kojto 107:4f6c30876dfa 678 /**
Kojto 107:4f6c30876dfa 679 * @}
Kojto 107:4f6c30876dfa 680 */
Kojto 107:4f6c30876dfa 681
Kojto 107:4f6c30876dfa 682 /* Private types -------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 683 /** @defgroup CAN_Private_Types CAN Private Types
Kojto 107:4f6c30876dfa 684 * @{
Kojto 107:4f6c30876dfa 685 */
Kojto 107:4f6c30876dfa 686
Kojto 107:4f6c30876dfa 687 /**
Kojto 107:4f6c30876dfa 688 * @}
Kojto 107:4f6c30876dfa 689 */
Kojto 107:4f6c30876dfa 690
Kojto 107:4f6c30876dfa 691 /* Private variables ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 692 /** @defgroup CAN_Private_Variables CAN Private Variables
Kojto 107:4f6c30876dfa 693 * @{
Kojto 107:4f6c30876dfa 694 */
Kojto 107:4f6c30876dfa 695
Kojto 107:4f6c30876dfa 696 /**
Kojto 107:4f6c30876dfa 697 * @}
Kojto 107:4f6c30876dfa 698 */
Kojto 107:4f6c30876dfa 699
Kojto 107:4f6c30876dfa 700 /* Private constants ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 701 /** @defgroup CAN_Private_Constants CAN Private Constants
Kojto 107:4f6c30876dfa 702 * @{
Kojto 107:4f6c30876dfa 703 */
Kojto 107:4f6c30876dfa 704 #define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04) /*!< CAN cell did not provide CAN_TxStatus_NoMailBox */
Kojto 107:4f6c30876dfa 705 #define CAN_FLAG_MASK ((uint32_t)0x000000FF)
Kojto 107:4f6c30876dfa 706 /**
Kojto 107:4f6c30876dfa 707 * @}
Kojto 107:4f6c30876dfa 708 */
Kojto 107:4f6c30876dfa 709
Kojto 107:4f6c30876dfa 710 /* Private macros ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 711 /** @defgroup CAN_Private_Macros CAN Private Macros
Kojto 107:4f6c30876dfa 712 * @{
Kojto 107:4f6c30876dfa 713 */
Kojto 107:4f6c30876dfa 714 #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \
Kojto 107:4f6c30876dfa 715 ((MODE) == CAN_MODE_LOOPBACK)|| \
Kojto 107:4f6c30876dfa 716 ((MODE) == CAN_MODE_SILENT) || \
Kojto 107:4f6c30876dfa 717 ((MODE) == CAN_MODE_SILENT_LOOPBACK))
Kojto 107:4f6c30876dfa 718 #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \
Kojto 107:4f6c30876dfa 719 ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ))
Kojto 107:4f6c30876dfa 720 #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ)
Kojto 107:4f6c30876dfa 721 #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ)
Kojto 107:4f6c30876dfa 722 #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))
Kojto 107:4f6c30876dfa 723 #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27)
Kojto 107:4f6c30876dfa 724 #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \
Kojto 107:4f6c30876dfa 725 ((MODE) == CAN_FILTERMODE_IDLIST))
Kojto 107:4f6c30876dfa 726 #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \
Kojto 107:4f6c30876dfa 727 ((SCALE) == CAN_FILTERSCALE_32BIT))
Kojto 107:4f6c30876dfa 728 #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \
Kojto 107:4f6c30876dfa 729 ((FIFO) == CAN_FILTER_FIFO1))
Kojto 107:4f6c30876dfa 730 #define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28)
Kojto 107:4f6c30876dfa 731
Kojto 107:4f6c30876dfa 732 #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
Kojto 107:4f6c30876dfa 733 #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF))
Kojto 107:4f6c30876dfa 734 #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF))
Kojto 107:4f6c30876dfa 735 #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
Kojto 107:4f6c30876dfa 736
Kojto 107:4f6c30876dfa 737 #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \
Kojto 107:4f6c30876dfa 738 ((IDTYPE) == CAN_ID_EXT))
Kojto 107:4f6c30876dfa 739 #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))
Kojto 107:4f6c30876dfa 740 #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
Kojto 107:4f6c30876dfa 741
Kojto 107:4f6c30876dfa 742 /**
Kojto 107:4f6c30876dfa 743 * @}
Kojto 107:4f6c30876dfa 744 */
Kojto 107:4f6c30876dfa 745
Kojto 107:4f6c30876dfa 746 /* Private functions ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 747 /** @defgroup CAN_Private_Functions CAN Private Functions
Kojto 107:4f6c30876dfa 748 * @{
Kojto 107:4f6c30876dfa 749 */
Kojto 107:4f6c30876dfa 750
Kojto 107:4f6c30876dfa 751 /**
Kojto 107:4f6c30876dfa 752 * @}
Kojto 107:4f6c30876dfa 753 */
Kojto 107:4f6c30876dfa 754 /**
Kojto 107:4f6c30876dfa 755 * @}
Kojto 107:4f6c30876dfa 756 */
Kojto 107:4f6c30876dfa 757
Kojto 107:4f6c30876dfa 758 /**
Kojto 107:4f6c30876dfa 759 * @}
Kojto 107:4f6c30876dfa 760 */
Kojto 107:4f6c30876dfa 761
Kojto 107:4f6c30876dfa 762 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 763 }
Kojto 107:4f6c30876dfa 764 #endif
Kojto 107:4f6c30876dfa 765
Kojto 107:4f6c30876dfa 766 #endif /* __STM32F7xx_CAN_H */
Kojto 107:4f6c30876dfa 767
Kojto 107:4f6c30876dfa 768
Kojto 107:4f6c30876dfa 769 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/