my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Child:
92:4fc01daae5a5
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

Who changed what in which revision?

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