mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

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

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

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

Import librarymbed

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

Committer:
mbed_official
Date:
Thu Oct 09 08:15:07 2014 +0100
Revision:
340:28d1f895c6fe
Synchronized with git revision b5a4c8e80393336b2656fb29ab46d405d3068602

Full URL: https://github.com/mbedmicro/mbed/commit/b5a4c8e80393336b2656fb29ab46d405d3068602/

HAL: nrf51822 - Few fixes for PWM and Serial

Who changed what in which revision?

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