Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
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 stm32l4xx_hal_can.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-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 __STM32L4xx_CAN_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_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 "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_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 uint32_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 CAN_Error_Code CAN Error Code
Kojto 107:4f6c30876dfa 249 * @{
Kojto 107:4f6c30876dfa 250 */
Kojto 107:4f6c30876dfa 251 #define HAL_CAN_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
Kojto 107:4f6c30876dfa 252 #define HAL_CAN_ERROR_EWG ((uint32_t)0x00000001) /*!< EWG error */
Kojto 107:4f6c30876dfa 253 #define HAL_CAN_ERROR_EPV ((uint32_t)0x00000002) /*!< EPV error */
Kojto 107:4f6c30876dfa 254 #define HAL_CAN_ERROR_BOF ((uint32_t)0x00000004) /*!< BOF error */
Kojto 107:4f6c30876dfa 255 #define HAL_CAN_ERROR_STF ((uint32_t)0x00000008) /*!< Stuff error */
Kojto 107:4f6c30876dfa 256 #define HAL_CAN_ERROR_FOR ((uint32_t)0x00000010) /*!< Form error */
Kojto 107:4f6c30876dfa 257 #define HAL_CAN_ERROR_ACK ((uint32_t)0x00000020) /*!< Acknowledgment error */
Kojto 107:4f6c30876dfa 258 #define HAL_CAN_ERROR_BR ((uint32_t)0x00000040) /*!< Bit recessive */
Kojto 107:4f6c30876dfa 259 #define HAL_CAN_ERROR_BD ((uint32_t)0x00000080) /*!< LEC dominant */
Kojto 107:4f6c30876dfa 260 #define HAL_CAN_ERROR_CRC ((uint32_t)0x00000100) /*!< 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 initialization Status
Kojto 107:4f6c30876dfa 266 * @{
Kojto 107:4f6c30876dfa 267 */
Kojto 107:4f6c30876dfa 268 #define CAN_INITSTATUS_FAILED ((uint32_t)0x00000000) /*!< CAN initialization failed */
Kojto 107:4f6c30876dfa 269 #define CAN_INITSTATUS_SUCCESS ((uint32_t)0x00000001) /*!< 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
Kojto 107:4f6c30876dfa 286 /** @defgroup CAN_synchronisation_jump_width CAN Synchronization Jump Width
Kojto 107:4f6c30876dfa 287 * @{
Kojto 107:4f6c30876dfa 288 */
Kojto 107:4f6c30876dfa 289 #define CAN_SJW_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 290 #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 291 #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 292 #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 293 /**
Kojto 107:4f6c30876dfa 294 * @}
Kojto 107:4f6c30876dfa 295 */
Kojto 107:4f6c30876dfa 296
Kojto 107:4f6c30876dfa 297 /** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in Bit Segment 1
Kojto 107:4f6c30876dfa 298 * @{
Kojto 107:4f6c30876dfa 299 */
Kojto 107:4f6c30876dfa 300 #define CAN_BS1_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 301 #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 302 #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 303 #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 304 #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */
Kojto 107:4f6c30876dfa 305 #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */
Kojto 107:4f6c30876dfa 306 #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */
Kojto 107:4f6c30876dfa 307 #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */
Kojto 107:4f6c30876dfa 308 #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */
Kojto 107:4f6c30876dfa 309 #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */
Kojto 107:4f6c30876dfa 310 #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */
Kojto 107:4f6c30876dfa 311 #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */
Kojto 107:4f6c30876dfa 312 #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */
Kojto 107:4f6c30876dfa 313 #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */
Kojto 107:4f6c30876dfa 314 #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */
Kojto 107:4f6c30876dfa 315 #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */
Kojto 107:4f6c30876dfa 316 /**
Kojto 107:4f6c30876dfa 317 * @}
Kojto 107:4f6c30876dfa 318 */
Kojto 107:4f6c30876dfa 319
Kojto 107:4f6c30876dfa 320 /** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in Bit Segment 2
Kojto 107:4f6c30876dfa 321 * @{
Kojto 107:4f6c30876dfa 322 */
Kojto 107:4f6c30876dfa 323 #define CAN_BS2_1TQ ((uint32_t)0x00000000) /*!< 1 time quantum */
Kojto 107:4f6c30876dfa 324 #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */
Kojto 107:4f6c30876dfa 325 #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */
Kojto 107:4f6c30876dfa 326 #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */
Kojto 107:4f6c30876dfa 327 #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */
Kojto 107:4f6c30876dfa 328 #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */
Kojto 107:4f6c30876dfa 329 #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */
Kojto 107:4f6c30876dfa 330 #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */
Kojto 107:4f6c30876dfa 331 /**
Kojto 107:4f6c30876dfa 332 * @}
Kojto 107:4f6c30876dfa 333 */
Kojto 107:4f6c30876dfa 334
Kojto 107:4f6c30876dfa 335 /** @defgroup CAN_filter_mode CAN Filter Mode
Kojto 107:4f6c30876dfa 336 * @{
Kojto 107:4f6c30876dfa 337 */
Kojto 107:4f6c30876dfa 338 #define CAN_FILTERMODE_IDMASK ((uint8_t)0x00) /*!< Identifier mask mode */
Kojto 107:4f6c30876dfa 339 #define CAN_FILTERMODE_IDLIST ((uint8_t)0x01) /*!< Identifier list mode */
Kojto 107:4f6c30876dfa 340 /**
Kojto 107:4f6c30876dfa 341 * @}
Kojto 107:4f6c30876dfa 342 */
Kojto 107:4f6c30876dfa 343
Kojto 107:4f6c30876dfa 344 /** @defgroup CAN_filter_scale CAN Filter Scale
Kojto 107:4f6c30876dfa 345 * @{
Kojto 107:4f6c30876dfa 346 */
Kojto 107:4f6c30876dfa 347 #define CAN_FILTERSCALE_16BIT ((uint8_t)0x00) /*!< Two 16-bit filters */
Kojto 107:4f6c30876dfa 348 #define CAN_FILTERSCALE_32BIT ((uint8_t)0x01) /*!< One 32-bit filter */
Kojto 107:4f6c30876dfa 349 /**
Kojto 107:4f6c30876dfa 350 * @}
Kojto 107:4f6c30876dfa 351 */
Kojto 107:4f6c30876dfa 352
Kojto 107:4f6c30876dfa 353 /** @defgroup CAN_filter_FIFO CAN Filter FIFO
Kojto 107:4f6c30876dfa 354 * @{
Kojto 107:4f6c30876dfa 355 */
Kojto 107:4f6c30876dfa 356 #define CAN_FILTER_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */
Kojto 107:4f6c30876dfa 357 #define CAN_FILTER_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */
Kojto 107:4f6c30876dfa 358 /**
Kojto 107:4f6c30876dfa 359 * @}
Kojto 107:4f6c30876dfa 360 */
Kojto 107:4f6c30876dfa 361
Kojto 107:4f6c30876dfa 362 /** @defgroup CAN_identifier_type CAN Identifier Type
Kojto 107:4f6c30876dfa 363 * @{
Kojto 107:4f6c30876dfa 364 */
Kojto 107:4f6c30876dfa 365 #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */
Kojto 107:4f6c30876dfa 366 #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */
Kojto 107:4f6c30876dfa 367 /**
Kojto 107:4f6c30876dfa 368 * @}
Kojto 107:4f6c30876dfa 369 */
Kojto 107:4f6c30876dfa 370
Kojto 107:4f6c30876dfa 371 /** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request
Kojto 107:4f6c30876dfa 372 * @{
Kojto 107:4f6c30876dfa 373 */
Kojto 107:4f6c30876dfa 374 #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */
Kojto 107:4f6c30876dfa 375 #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */
Kojto 107:4f6c30876dfa 376 /**
Kojto 107:4f6c30876dfa 377 * @}
Kojto 107:4f6c30876dfa 378 */
Kojto 107:4f6c30876dfa 379
Kojto 107:4f6c30876dfa 380 /** @defgroup CAN_receive_FIFO_number_constants CAN Receive FIFO Number
Kojto 107:4f6c30876dfa 381 * @{
Kojto 107:4f6c30876dfa 382 */
Kojto 107:4f6c30876dfa 383 #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */
Kojto 107:4f6c30876dfa 384 #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */
Kojto 107:4f6c30876dfa 385 /**
Kojto 107:4f6c30876dfa 386 * @}
Kojto 107:4f6c30876dfa 387 */
Kojto 107:4f6c30876dfa 388
Kojto 107:4f6c30876dfa 389 /** @defgroup CAN_flags CAN Flags
Kojto 107:4f6c30876dfa 390 * @{
Kojto 107:4f6c30876dfa 391 */
Kojto 107:4f6c30876dfa 392 /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus()
Kojto 107:4f6c30876dfa 393 and CAN_ClearFlag() functions. */
Kojto 107:4f6c30876dfa 394 /* If the flag is 0x1XXXXXXX, it means that it can only be used with
Kojto 107:4f6c30876dfa 395 CAN_GetFlagStatus() function. */
Kojto 107:4f6c30876dfa 396
Kojto 107:4f6c30876dfa 397 /* Transmit Flags */
Kojto 107:4f6c30876dfa 398 #define CAN_FLAG_RQCP0 ((uint32_t)0x00000500) /*!< Request MailBox0 flag */
Kojto 107:4f6c30876dfa 399 #define CAN_FLAG_RQCP1 ((uint32_t)0x00000508) /*!< Request MailBox1 flag */
Kojto 107:4f6c30876dfa 400 #define CAN_FLAG_RQCP2 ((uint32_t)0x00000510) /*!< Request MailBox2 flag */
Kojto 107:4f6c30876dfa 401 #define CAN_FLAG_TXOK0 ((uint32_t)0x00000501) /*!< Transmission OK MailBox0 flag */
Kojto 107:4f6c30876dfa 402 #define CAN_FLAG_TXOK1 ((uint32_t)0x00000509) /*!< Transmission OK MailBox1 flag */
Kojto 107:4f6c30876dfa 403 #define CAN_FLAG_TXOK2 ((uint32_t)0x00000511) /*!< Transmission OK MailBox2 flag */
Kojto 107:4f6c30876dfa 404 #define CAN_FLAG_TME0 ((uint32_t)0x0000051A) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 405 #define CAN_FLAG_TME1 ((uint32_t)0x0000051B) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 406 #define CAN_FLAG_TME2 ((uint32_t)0x0000051C) /*!< Transmit mailbox 0 empty flag */
Kojto 107:4f6c30876dfa 407
Kojto 107:4f6c30876dfa 408 /* Receive Flags */
Kojto 107:4f6c30876dfa 409 #define CAN_FLAG_FF0 ((uint32_t)0x00000203) /*!< FIFO 0 Full flag */
Kojto 107:4f6c30876dfa 410 #define CAN_FLAG_FOV0 ((uint32_t)0x00000204) /*!< FIFO 0 Overrun flag */
Kojto 107:4f6c30876dfa 411
Kojto 107:4f6c30876dfa 412 #define CAN_FLAG_FF1 ((uint32_t)0x00000403) /*!< FIFO 1 Full flag */
Kojto 107:4f6c30876dfa 413 #define CAN_FLAG_FOV1 ((uint32_t)0x00000404) /*!< FIFO 1 Overrun flag */
Kojto 107:4f6c30876dfa 414
Kojto 107:4f6c30876dfa 415 /* Operating Mode Flags */
Kojto 107:4f6c30876dfa 416 #define CAN_FLAG_WKU ((uint32_t)0x00000103) /*!< Wake up flag */
Kojto 107:4f6c30876dfa 417 #define CAN_FLAG_SLAK ((uint32_t)0x00000101) /*!< Sleep acknowledge flag */
Kojto 107:4f6c30876dfa 418 #define CAN_FLAG_SLAKI ((uint32_t)0x00000104) /*!< Sleep acknowledge flag */
Kojto 107:4f6c30876dfa 419 /* @note When SLAK interrupt is disabled (SLKIE=0), no polling on SLAKI is possible.
Kojto 107:4f6c30876dfa 420 In this case the SLAK bit can be polled.*/
Kojto 107:4f6c30876dfa 421
Kojto 107:4f6c30876dfa 422 /* Error Flags */
Kojto 107:4f6c30876dfa 423 #define CAN_FLAG_EWG ((uint32_t)0x00000300) /*!< Error warning flag */
Kojto 107:4f6c30876dfa 424 #define CAN_FLAG_EPV ((uint32_t)0x00000301) /*!< Error passive flag */
Kojto 107:4f6c30876dfa 425 #define CAN_FLAG_BOF ((uint32_t)0x00000302) /*!< Bus-Off flag */
Kojto 107:4f6c30876dfa 426 /**
Kojto 107:4f6c30876dfa 427 * @}
Kojto 107:4f6c30876dfa 428 */
Kojto 107:4f6c30876dfa 429
Kojto 107:4f6c30876dfa 430 /** @defgroup CAN_interrupts CAN Interrupts
Kojto 107:4f6c30876dfa 431 * @{
Kojto 107:4f6c30876dfa 432 */
Kojto 107:4f6c30876dfa 433 #define CAN_IT_TME ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */
Kojto 107:4f6c30876dfa 434
Kojto 107:4f6c30876dfa 435 /* Receive Interrupts */
Kojto 107:4f6c30876dfa 436 #define CAN_IT_FMP0 ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */
Kojto 107:4f6c30876dfa 437 #define CAN_IT_FF0 ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */
Kojto 107:4f6c30876dfa 438 #define CAN_IT_FOV0 ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */
Kojto 107:4f6c30876dfa 439 #define CAN_IT_FMP1 ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */
Kojto 107:4f6c30876dfa 440 #define CAN_IT_FF1 ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */
Kojto 107:4f6c30876dfa 441 #define CAN_IT_FOV1 ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */
Kojto 107:4f6c30876dfa 442
Kojto 107:4f6c30876dfa 443 /* Operating Mode Interrupts */
Kojto 107:4f6c30876dfa 444 #define CAN_IT_WKU ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */
Kojto 107:4f6c30876dfa 445 #define CAN_IT_SLK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */
Kojto 107:4f6c30876dfa 446
Kojto 107:4f6c30876dfa 447 /* Error Interrupts */
Kojto 107:4f6c30876dfa 448 #define CAN_IT_EWG ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */
Kojto 107:4f6c30876dfa 449 #define CAN_IT_EPV ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */
Kojto 107:4f6c30876dfa 450 #define CAN_IT_BOF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */
Kojto 107:4f6c30876dfa 451 #define CAN_IT_LEC ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */
Kojto 107:4f6c30876dfa 452 #define CAN_IT_ERR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */
Kojto 107:4f6c30876dfa 453
Kojto 107:4f6c30876dfa 454 /**
Kojto 107:4f6c30876dfa 455 * @}
Kojto 107:4f6c30876dfa 456 */
Kojto 107:4f6c30876dfa 457
Kojto 107:4f6c30876dfa 458 /* Mailboxes definition */
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 /* Exported macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 468 /** @defgroup CAN_Exported_Macro CAN Exported Macros
Kojto 107:4f6c30876dfa 469 * @{
Kojto 107:4f6c30876dfa 470 */
Kojto 107:4f6c30876dfa 471
Kojto 107:4f6c30876dfa 472 /** @brief Reset CAN handle state.
Kojto 107:4f6c30876dfa 473 * @param __HANDLE__: CAN handle.
Kojto 107:4f6c30876dfa 474 * @retval None
Kojto 107:4f6c30876dfa 475 */
Kojto 107:4f6c30876dfa 476 #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET)
Kojto 107:4f6c30876dfa 477
Kojto 107:4f6c30876dfa 478 /**
Kojto 107:4f6c30876dfa 479 * @brief Enable the specified CAN interrupt.
Kojto 107:4f6c30876dfa 480 * @param __HANDLE__: CAN handle.
Kojto 107:4f6c30876dfa 481 * @param __INTERRUPT__: CAN Interrupt.
Kojto 107:4f6c30876dfa 482 * @retval None
Kojto 107:4f6c30876dfa 483 */
Kojto 107:4f6c30876dfa 484 #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
Kojto 107:4f6c30876dfa 485
Kojto 107:4f6c30876dfa 486 /**
Kojto 107:4f6c30876dfa 487 * @brief Disable the specified CAN interrupt.
Kojto 107:4f6c30876dfa 488 * @param __HANDLE__: CAN handle.
Kojto 107:4f6c30876dfa 489 * @param __INTERRUPT__: CAN Interrupt.
Kojto 107:4f6c30876dfa 490 * @retval None
Kojto 107:4f6c30876dfa 491 */
Kojto 107:4f6c30876dfa 492 #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
Kojto 107:4f6c30876dfa 493
Kojto 107:4f6c30876dfa 494 /**
Kojto 107:4f6c30876dfa 495 * @brief Return the number of pending received messages.
Kojto 107:4f6c30876dfa 496 * @param __HANDLE__: CAN handle.
Kojto 107:4f6c30876dfa 497 * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
Kojto 107:4f6c30876dfa 498 * @retval The number of pending message.
Kojto 107:4f6c30876dfa 499 */
Kojto 107:4f6c30876dfa 500 #define __HAL_CAN_MSG_PENDING(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
Kojto 107:4f6c30876dfa 501 ((uint8_t)((__HANDLE__)->Instance->RF0R&(uint32_t)0x03)) : ((uint8_t)((__HANDLE__)->Instance->RF1R&(uint32_t)0x03)))
Kojto 107:4f6c30876dfa 502
Kojto 107:4f6c30876dfa 503 /** @brief Check whether the specified CAN flag is set or not.
Kojto 107:4f6c30876dfa 504 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 505 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 506 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 507 * @arg CAN_TSR_RQCP0: Request MailBox0 Flag
Kojto 107:4f6c30876dfa 508 * @arg CAN_TSR_RQCP1: Request MailBox1 Flag
Kojto 107:4f6c30876dfa 509 * @arg CAN_TSR_RQCP2: Request MailBox2 Flag
Kojto 107:4f6c30876dfa 510 * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
Kojto 107:4f6c30876dfa 511 * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
Kojto 107:4f6c30876dfa 512 * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
Kojto 107:4f6c30876dfa 513 * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
Kojto 107:4f6c30876dfa 514 * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
Kojto 107:4f6c30876dfa 515 * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
Kojto 107:4f6c30876dfa 516 * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
Kojto 107:4f6c30876dfa 517 * @arg CAN_FLAG_FF0: FIFO 0 Full Flag
Kojto 107:4f6c30876dfa 518 * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
Kojto 107:4f6c30876dfa 519 * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
Kojto 107:4f6c30876dfa 520 * @arg CAN_FLAG_FF1: FIFO 1 Full Flag
Kojto 107:4f6c30876dfa 521 * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
Kojto 107:4f6c30876dfa 522 * @arg CAN_FLAG_WKU: Wake up Flag
Kojto 107:4f6c30876dfa 523 * @arg CAN_FLAG_SLAK: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 524 * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 525 * @arg CAN_FLAG_EWG: Error Warning Flag
Kojto 107:4f6c30876dfa 526 * @arg CAN_FLAG_EPV: Error Passive Flag
Kojto 107:4f6c30876dfa 527 * @arg CAN_FLAG_BOF: Bus-Off Flag
Kojto 107:4f6c30876dfa 528 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 529 */
Kojto 107:4f6c30876dfa 530 #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \
Kojto 107:4f6c30876dfa 531 ((((__FLAG__) >> 8) == 5)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 532 (((__FLAG__) >> 8) == 2)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 533 (((__FLAG__) >> 8) == 4)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 534 (((__FLAG__) >> 8) == 1)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 535 ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))))
Kojto 107:4f6c30876dfa 536
Kojto 107:4f6c30876dfa 537 /** @brief Clear the specified CAN pending flag.
Kojto 107:4f6c30876dfa 538 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 539 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 540 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 541 * @arg CAN_TSR_RQCP0: Request MailBox0 Flag
Kojto 107:4f6c30876dfa 542 * @arg CAN_TSR_RQCP1: Request MailBox1 Flag
Kojto 107:4f6c30876dfa 543 * @arg CAN_TSR_RQCP2: Request MailBox2 Flag
Kojto 107:4f6c30876dfa 544 * @arg CAN_FLAG_TXOK0: Transmission OK MailBox0 Flag
Kojto 107:4f6c30876dfa 545 * @arg CAN_FLAG_TXOK1: Transmission OK MailBox1 Flag
Kojto 107:4f6c30876dfa 546 * @arg CAN_FLAG_TXOK2: Transmission OK MailBox2 Flag
Kojto 107:4f6c30876dfa 547 * @arg CAN_FLAG_TME0: Transmit mailbox 0 empty Flag
Kojto 107:4f6c30876dfa 548 * @arg CAN_FLAG_TME1: Transmit mailbox 1 empty Flag
Kojto 107:4f6c30876dfa 549 * @arg CAN_FLAG_TME2: Transmit mailbox 2 empty Flag
Kojto 107:4f6c30876dfa 550 * @arg CAN_FLAG_FMP0: FIFO 0 Message Pending Flag
Kojto 107:4f6c30876dfa 551 * @arg CAN_FLAG_FF0: FIFO 0 Full Flag
Kojto 107:4f6c30876dfa 552 * @arg CAN_FLAG_FOV0: FIFO 0 Overrun Flag
Kojto 107:4f6c30876dfa 553 * @arg CAN_FLAG_FMP1: FIFO 1 Message Pending Flag
Kojto 107:4f6c30876dfa 554 * @arg CAN_FLAG_FF1: FIFO 1 Full Flag
Kojto 107:4f6c30876dfa 555 * @arg CAN_FLAG_FOV1: FIFO 1 Overrun Flag
Kojto 107:4f6c30876dfa 556 * @arg CAN_FLAG_WKU: Wake up Flag
Kojto 107:4f6c30876dfa 557 * @arg CAN_FLAG_SLAKI: Sleep acknowledge Flag
Kojto 107:4f6c30876dfa 558 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 559 */
Kojto 107:4f6c30876dfa 560 #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \
Kojto 107:4f6c30876dfa 561 ((((__FLAG__) >> 8U) == 5)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 562 (((__FLAG__) >> 8U) == 2)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 563 (((__FLAG__) >> 8U) == 4)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \
Kojto 107:4f6c30876dfa 564 (((__FLAG__) >> 8U) == 1)? (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0)
Kojto 107:4f6c30876dfa 565
Kojto 107:4f6c30876dfa 566
Kojto 107:4f6c30876dfa 567 /** @brief Check whether the specified CAN interrupt source is enabled or not.
Kojto 107:4f6c30876dfa 568 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 569 * @param __INTERRUPT__: specifies the CAN interrupt source to check.
Kojto 107:4f6c30876dfa 570 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 571 * @arg CAN_IT_TME: Transmit mailbox empty interrupt enable
Kojto 107:4f6c30876dfa 572 * @arg CAN_IT_FMP0: FIFO0 message pending interrupt enable
Kojto 107:4f6c30876dfa 573 * @arg CAN_IT_FMP1: FIFO1 message pending interrupt enable
Kojto 107:4f6c30876dfa 574 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 575 */
Kojto 107:4f6c30876dfa 576 #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 107:4f6c30876dfa 577
Kojto 107:4f6c30876dfa 578 /**
Kojto 107:4f6c30876dfa 579 * @brief Check the transmission status of a CAN Frame.
Kojto 107:4f6c30876dfa 580 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 581 * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
Kojto 107:4f6c30876dfa 582 * @retval The new status of transmission (TRUE or FALSE).
Kojto 107:4f6c30876dfa 583 */
Kojto 107:4f6c30876dfa 584 #define __HAL_CAN_TRANSMIT_STATUS(__HANDLE__, __TRANSMITMAILBOX__)\
Kojto 107:4f6c30876dfa 585 (((__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 586 ((__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 587 ((((__HANDLE__)->Instance->TSR) & (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)) == (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2)))
Kojto 107:4f6c30876dfa 588
Kojto 107:4f6c30876dfa 589
Kojto 107:4f6c30876dfa 590
Kojto 107:4f6c30876dfa 591 /**
Kojto 107:4f6c30876dfa 592 * @brief Release the specified receive FIFO.
Kojto 107:4f6c30876dfa 593 * @param __HANDLE__: CAN handle.
Kojto 107:4f6c30876dfa 594 * @param __FIFONUMBER__: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
Kojto 107:4f6c30876dfa 595 * @retval None
Kojto 107:4f6c30876dfa 596 */
Kojto 107:4f6c30876dfa 597 #define __HAL_CAN_FIFO_RELEASE(__HANDLE__, __FIFONUMBER__) (((__FIFONUMBER__) == CAN_FIFO0)? \
Kojto 107:4f6c30876dfa 598 ((__HANDLE__)->Instance->RF0R |= CAN_RF0R_RFOM0) : ((__HANDLE__)->Instance->RF1R |= CAN_RF1R_RFOM1))
Kojto 107:4f6c30876dfa 599
Kojto 107:4f6c30876dfa 600 /**
Kojto 107:4f6c30876dfa 601 * @brief Cancel a transmit request.
Kojto 107:4f6c30876dfa 602 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 603 * @param __TRANSMITMAILBOX__: the number of the mailbox that is used for transmission.
Kojto 107:4f6c30876dfa 604 * @retval None
Kojto 107:4f6c30876dfa 605 */
Kojto 107:4f6c30876dfa 606 #define __HAL_CAN_CANCEL_TRANSMIT(__HANDLE__, __TRANSMITMAILBOX__)\
Kojto 107:4f6c30876dfa 607 (((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_0)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ0) :\
Kojto 107:4f6c30876dfa 608 ((__TRANSMITMAILBOX__) == CAN_TXMAILBOX_1)? ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ1) :\
Kojto 107:4f6c30876dfa 609 ((__HANDLE__)->Instance->TSR |= CAN_TSR_ABRQ2))
Kojto 107:4f6c30876dfa 610
Kojto 107:4f6c30876dfa 611 /**
Kojto 107:4f6c30876dfa 612 * @brief Enable or disable the DBG Freeze for CAN.
Kojto 107:4f6c30876dfa 613 * @param __HANDLE__: specifies the CAN Handle.
Kojto 107:4f6c30876dfa 614 * @param __NEWSTATE__: new state of the CAN peripheral.
Kojto 107:4f6c30876dfa 615 * This parameter can be: ENABLE (CAN reception/transmission is frozen
Kojto 107:4f6c30876dfa 616 * during debug. Reception FIFO can still be accessed/controlled normally)
Kojto 107:4f6c30876dfa 617 * or DISABLE (CAN is working during debug).
Kojto 107:4f6c30876dfa 618 * @retval None
Kojto 107:4f6c30876dfa 619 */
Kojto 107:4f6c30876dfa 620 #define __HAL_CAN_DBG_FREEZE(__HANDLE__, __NEWSTATE__) (((__NEWSTATE__) == ENABLE)? \
Kojto 107:4f6c30876dfa 621 ((__HANDLE__)->Instance->MCR |= CAN_MCR_DBF) : ((__HANDLE__)->Instance->MCR &= ~CAN_MCR_DBF))
Kojto 107:4f6c30876dfa 622
Kojto 107:4f6c30876dfa 623 /**
Kojto 107:4f6c30876dfa 624 * @}
Kojto 107:4f6c30876dfa 625 */
Kojto 107:4f6c30876dfa 626
Kojto 107:4f6c30876dfa 627 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 628 /** @addtogroup CAN_Exported_Functions CAN Exported Functions
Kojto 107:4f6c30876dfa 629 * @{
Kojto 107:4f6c30876dfa 630 */
Kojto 107:4f6c30876dfa 631
Kojto 107:4f6c30876dfa 632 /** @defgroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 107:4f6c30876dfa 633 * @brief Initialization and Configuration functions
Kojto 107:4f6c30876dfa 634 * @{
Kojto 107:4f6c30876dfa 635 */
Kojto 107:4f6c30876dfa 636 /* addtogroup and de-initialization functions *****************************/
Kojto 107:4f6c30876dfa 637 HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 638 HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig);
Kojto 107:4f6c30876dfa 639 HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 640 void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 641 void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 642 /**
Kojto 107:4f6c30876dfa 643 * @}
Kojto 107:4f6c30876dfa 644 */
Kojto 107:4f6c30876dfa 645
Kojto 107:4f6c30876dfa 646 /** @addtogroup CAN_Exported_Functions_Group2 Input and Output operation functions
Kojto 107:4f6c30876dfa 647 * @brief I/O operation functions
Kojto 107:4f6c30876dfa 648 * @{
Kojto 107:4f6c30876dfa 649 */
Kojto 107:4f6c30876dfa 650 /* IO operation functions *****************************************************/
Kojto 107:4f6c30876dfa 651 HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout);
Kojto 107:4f6c30876dfa 652 HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 653 HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef *hcan, uint8_t FIFONumber, uint32_t Timeout);
Kojto 107:4f6c30876dfa 654 HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef *hcan, uint8_t FIFONumber);
Kojto 107:4f6c30876dfa 655 HAL_StatusTypeDef HAL_CAN_Sleep(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 656 HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 657 void HAL_CAN_IRQHandler(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 658 void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 659 void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 660 void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 661 /**
Kojto 107:4f6c30876dfa 662 * @}
Kojto 107:4f6c30876dfa 663 */
Kojto 107:4f6c30876dfa 664
Kojto 107:4f6c30876dfa 665 /** @addtogroup CAN_Exported_Functions_Group3 Peripheral State and Error functions
Kojto 107:4f6c30876dfa 666 * @brief CAN Peripheral State functions
Kojto 107:4f6c30876dfa 667 * @{
Kojto 107:4f6c30876dfa 668 */
Kojto 107:4f6c30876dfa 669 /* Peripheral State and Error functions ***************************************/
Kojto 107:4f6c30876dfa 670 uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan);
Kojto 107:4f6c30876dfa 671 HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan);
Kojto 107:4f6c30876dfa 672 /**
Kojto 107:4f6c30876dfa 673 * @}
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 /* Private types -------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 681 /* Private constants ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 682 /** @defgroup CAN_Private_Constants CAN Private Constants
Kojto 107:4f6c30876dfa 683 * @{
Kojto 107:4f6c30876dfa 684 */
Kojto 107:4f6c30876dfa 685 /** @defgroup CAN_transmit_constants CAN Transmit Constants
Kojto 107:4f6c30876dfa 686 * @{
Kojto 107:4f6c30876dfa 687 */
Kojto 107:4f6c30876dfa 688 #define CAN_TXSTATUS_FAILED ((uint8_t)0x00) /*!< CAN transmission failed */
Kojto 107:4f6c30876dfa 689 #define CAN_TXSTATUS_OK ((uint8_t)0x01) /*!< CAN transmission succeeded */
Kojto 107:4f6c30876dfa 690 #define CAN_TXSTATUS_PENDING ((uint8_t)0x02) /*!< CAN transmission pending */
Kojto 107:4f6c30876dfa 691 #define CAN_TXSTATUS_NOMAILBOX ((uint8_t)0x04) /*!< CAN cell did not provide CAN_TxStatus_NoMailBox */
Kojto 107:4f6c30876dfa 692 /**
Kojto 107:4f6c30876dfa 693 * @}
Kojto 107:4f6c30876dfa 694 */
Kojto 107:4f6c30876dfa 695 #define CAN_FLAG_MASK ((uint32_t)0x000000FF)
Kojto 107:4f6c30876dfa 696
Kojto 107:4f6c30876dfa 697
Kojto 107:4f6c30876dfa 698 /**
Kojto 107:4f6c30876dfa 699 * @}
Kojto 107:4f6c30876dfa 700 */
Kojto 107:4f6c30876dfa 701
Kojto 107:4f6c30876dfa 702 /* Private macros ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 703 /** @defgroup CAN_Private_Macros CAN Private Macros
Kojto 107:4f6c30876dfa 704 * @{
Kojto 107:4f6c30876dfa 705 */
Kojto 107:4f6c30876dfa 706
Kojto 107:4f6c30876dfa 707 #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \
Kojto 107:4f6c30876dfa 708 ((MODE) == CAN_MODE_LOOPBACK)|| \
Kojto 107:4f6c30876dfa 709 ((MODE) == CAN_MODE_SILENT) || \
Kojto 107:4f6c30876dfa 710 ((MODE) == CAN_MODE_SILENT_LOOPBACK))
Kojto 107:4f6c30876dfa 711
Kojto 107:4f6c30876dfa 712 #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ)|| \
Kojto 107:4f6c30876dfa 713 ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ))
Kojto 107:4f6c30876dfa 714
Kojto 107:4f6c30876dfa 715 #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16TQ)
Kojto 107:4f6c30876dfa 716
Kojto 107:4f6c30876dfa 717 #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8TQ)
Kojto 107:4f6c30876dfa 718
Kojto 107:4f6c30876dfa 719 #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024))
Kojto 107:4f6c30876dfa 720
Kojto 107:4f6c30876dfa 721 #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27)
Kojto 107:4f6c30876dfa 722
Kojto 107:4f6c30876dfa 723 #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \
Kojto 107:4f6c30876dfa 724 ((MODE) == CAN_FILTERMODE_IDLIST))
Kojto 107:4f6c30876dfa 725
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
Kojto 107:4f6c30876dfa 729 #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \
Kojto 107:4f6c30876dfa 730 ((FIFO) == CAN_FILTER_FIFO1))
Kojto 107:4f6c30876dfa 731
Kojto 107:4f6c30876dfa 732 #define IS_CAN_BANKNUMBER(BANKNUMBER) ((BANKNUMBER) <= 28)
Kojto 107:4f6c30876dfa 733
Kojto 107:4f6c30876dfa 734 #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02))
Kojto 107:4f6c30876dfa 735
Kojto 107:4f6c30876dfa 736 #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF))
Kojto 107:4f6c30876dfa 737
Kojto 107:4f6c30876dfa 738 #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF))
Kojto 107:4f6c30876dfa 739
Kojto 107:4f6c30876dfa 740 #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08))
Kojto 107:4f6c30876dfa 741
Kojto 107:4f6c30876dfa 742 #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \
Kojto 107:4f6c30876dfa 743 ((IDTYPE) == CAN_ID_EXT))
Kojto 107:4f6c30876dfa 744
Kojto 107:4f6c30876dfa 745 #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE))
Kojto 107:4f6c30876dfa 746
Kojto 107:4f6c30876dfa 747 #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1))
Kojto 107:4f6c30876dfa 748
Kojto 107:4f6c30876dfa 749 /**
Kojto 107:4f6c30876dfa 750 * @}
Kojto 107:4f6c30876dfa 751 */
Kojto 107:4f6c30876dfa 752
Kojto 107:4f6c30876dfa 753 /* Private functions ---------------------------------------------------------*/
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
Kojto 107:4f6c30876dfa 763
Kojto 107:4f6c30876dfa 764 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 765 }
Kojto 107:4f6c30876dfa 766 #endif
Kojto 107:4f6c30876dfa 767
Kojto 107:4f6c30876dfa 768 #endif /* __STM32L4xx_CAN_H */
Kojto 107:4f6c30876dfa 769
Kojto 107:4f6c30876dfa 770
Kojto 107:4f6c30876dfa 771 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/