mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Tue Jun 24 14:45:08 2014 +0100
Revision:
237:f3da66175598
Child:
375:3d36234a1087
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7

Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/

[NUCLEO_F334R8] Add platform files

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