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:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
109:9296ab0bfc11
.

Who changed what in which revision?

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