mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Sep 28 20:15:09 2015 +0100
Revision:
634:ac7d6880524d
Parent:
632:7687fb9c4f91
Synchronized with git revision 9b7d23d47153c298a6d24de9a415202705889d11

Full URL: https://github.com/mbedmicro/mbed/commit/9b7d23d47153c298a6d24de9a415202705889d11/

Revert "[NUCLEO_F303K8] add support of the STM32F303K8"

Who changed what in which revision?

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