my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

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