mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
92:4fc01daae5a5
remove SerialHalfDuplex.h

Who changed what in which revision?

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