my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
93:e188a91d3eaa
First reale BlueNRG module for nucleo 401 board

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