Einstein Filho
/
MANGUEBAJA2019_BOX
Mangue Baja Box
mbed/TARGET_NUCLEO_F103RB/stm32f10x_can.h@0:0dee8840a1c0, 2019-07-29 (annotated)
- Committer:
- einsteingustavo
- Date:
- Mon Jul 29 20:38:00 2019 +0000
- Revision:
- 0:0dee8840a1c0
Mangue Baja Box
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
einsteingustavo | 0:0dee8840a1c0 | 1 | /** |
einsteingustavo | 0:0dee8840a1c0 | 2 | ****************************************************************************** |
einsteingustavo | 0:0dee8840a1c0 | 3 | * @file stm32f10x_can.h |
einsteingustavo | 0:0dee8840a1c0 | 4 | * @author MCD Application Team |
einsteingustavo | 0:0dee8840a1c0 | 5 | * @version V3.6.1 |
einsteingustavo | 0:0dee8840a1c0 | 6 | * @date 05-March-2012 |
einsteingustavo | 0:0dee8840a1c0 | 7 | * @brief This file contains all the functions prototypes for the CAN firmware |
einsteingustavo | 0:0dee8840a1c0 | 8 | * library. |
einsteingustavo | 0:0dee8840a1c0 | 9 | ******************************************************************************* |
einsteingustavo | 0:0dee8840a1c0 | 10 | * Copyright (c) 2014, STMicroelectronics |
einsteingustavo | 0:0dee8840a1c0 | 11 | * All rights reserved. |
einsteingustavo | 0:0dee8840a1c0 | 12 | * |
einsteingustavo | 0:0dee8840a1c0 | 13 | * Redistribution and use in source and binary forms, with or without |
einsteingustavo | 0:0dee8840a1c0 | 14 | * modification, are permitted provided that the following conditions are met: |
einsteingustavo | 0:0dee8840a1c0 | 15 | * |
einsteingustavo | 0:0dee8840a1c0 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
einsteingustavo | 0:0dee8840a1c0 | 17 | * this list of conditions and the following disclaimer. |
einsteingustavo | 0:0dee8840a1c0 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
einsteingustavo | 0:0dee8840a1c0 | 19 | * this list of conditions and the following disclaimer in the documentation |
einsteingustavo | 0:0dee8840a1c0 | 20 | * and/or other materials provided with the distribution. |
einsteingustavo | 0:0dee8840a1c0 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
einsteingustavo | 0:0dee8840a1c0 | 22 | * may be used to endorse or promote products derived from this software |
einsteingustavo | 0:0dee8840a1c0 | 23 | * without specific prior written permission. |
einsteingustavo | 0:0dee8840a1c0 | 24 | * |
einsteingustavo | 0:0dee8840a1c0 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
einsteingustavo | 0:0dee8840a1c0 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
einsteingustavo | 0:0dee8840a1c0 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
einsteingustavo | 0:0dee8840a1c0 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
einsteingustavo | 0:0dee8840a1c0 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
einsteingustavo | 0:0dee8840a1c0 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
einsteingustavo | 0:0dee8840a1c0 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
einsteingustavo | 0:0dee8840a1c0 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
einsteingustavo | 0:0dee8840a1c0 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
einsteingustavo | 0:0dee8840a1c0 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
einsteingustavo | 0:0dee8840a1c0 | 35 | ******************************************************************************* |
einsteingustavo | 0:0dee8840a1c0 | 36 | */ |
einsteingustavo | 0:0dee8840a1c0 | 37 | |
einsteingustavo | 0:0dee8840a1c0 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
einsteingustavo | 0:0dee8840a1c0 | 39 | #ifndef __STM32F10x_CAN_H |
einsteingustavo | 0:0dee8840a1c0 | 40 | #define __STM32F10x_CAN_H |
einsteingustavo | 0:0dee8840a1c0 | 41 | |
einsteingustavo | 0:0dee8840a1c0 | 42 | #ifdef __cplusplus |
einsteingustavo | 0:0dee8840a1c0 | 43 | extern "C" { |
einsteingustavo | 0:0dee8840a1c0 | 44 | #endif |
einsteingustavo | 0:0dee8840a1c0 | 45 | |
einsteingustavo | 0:0dee8840a1c0 | 46 | /* Includes ------------------------------------------------------------------*/ |
einsteingustavo | 0:0dee8840a1c0 | 47 | #include "stm32f10x.h" |
einsteingustavo | 0:0dee8840a1c0 | 48 | |
einsteingustavo | 0:0dee8840a1c0 | 49 | /** @addtogroup STM32F10x_StdPeriph_Driver |
einsteingustavo | 0:0dee8840a1c0 | 50 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 51 | */ |
einsteingustavo | 0:0dee8840a1c0 | 52 | |
einsteingustavo | 0:0dee8840a1c0 | 53 | /** @addtogroup CAN |
einsteingustavo | 0:0dee8840a1c0 | 54 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 55 | */ |
einsteingustavo | 0:0dee8840a1c0 | 56 | |
einsteingustavo | 0:0dee8840a1c0 | 57 | /** @defgroup CAN_Exported_Types |
einsteingustavo | 0:0dee8840a1c0 | 58 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 59 | */ |
einsteingustavo | 0:0dee8840a1c0 | 60 | |
einsteingustavo | 0:0dee8840a1c0 | 61 | #define IS_CAN_ALL_PERIPH(PERIPH) (((PERIPH) == CAN1) || \ |
einsteingustavo | 0:0dee8840a1c0 | 62 | ((PERIPH) == CAN2)) |
einsteingustavo | 0:0dee8840a1c0 | 63 | |
einsteingustavo | 0:0dee8840a1c0 | 64 | /** |
einsteingustavo | 0:0dee8840a1c0 | 65 | * @brief CAN init structure definition |
einsteingustavo | 0:0dee8840a1c0 | 66 | */ |
einsteingustavo | 0:0dee8840a1c0 | 67 | |
einsteingustavo | 0:0dee8840a1c0 | 68 | typedef struct |
einsteingustavo | 0:0dee8840a1c0 | 69 | { |
einsteingustavo | 0:0dee8840a1c0 | 70 | uint16_t CAN_Prescaler; /*!< Specifies the length of a time quantum. |
einsteingustavo | 0:0dee8840a1c0 | 71 | It ranges from 1 to 1024. */ |
einsteingustavo | 0:0dee8840a1c0 | 72 | |
einsteingustavo | 0:0dee8840a1c0 | 73 | uint8_t CAN_Mode; /*!< Specifies the CAN operating mode. |
einsteingustavo | 0:0dee8840a1c0 | 74 | This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 75 | @ref CAN_operating_mode */ |
einsteingustavo | 0:0dee8840a1c0 | 76 | |
einsteingustavo | 0:0dee8840a1c0 | 77 | uint8_t CAN_SJW; /*!< Specifies the maximum number of time quanta |
einsteingustavo | 0:0dee8840a1c0 | 78 | the CAN hardware is allowed to lengthen or |
einsteingustavo | 0:0dee8840a1c0 | 79 | shorten a bit to perform resynchronization. |
einsteingustavo | 0:0dee8840a1c0 | 80 | This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 81 | @ref CAN_synchronisation_jump_width */ |
einsteingustavo | 0:0dee8840a1c0 | 82 | |
einsteingustavo | 0:0dee8840a1c0 | 83 | uint8_t CAN_BS1; /*!< Specifies the number of time quanta in Bit |
einsteingustavo | 0:0dee8840a1c0 | 84 | Segment 1. This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 85 | @ref CAN_time_quantum_in_bit_segment_1 */ |
einsteingustavo | 0:0dee8840a1c0 | 86 | |
einsteingustavo | 0:0dee8840a1c0 | 87 | uint8_t CAN_BS2; /*!< Specifies the number of time quanta in Bit |
einsteingustavo | 0:0dee8840a1c0 | 88 | Segment 2. |
einsteingustavo | 0:0dee8840a1c0 | 89 | This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 90 | @ref CAN_time_quantum_in_bit_segment_2 */ |
einsteingustavo | 0:0dee8840a1c0 | 91 | |
einsteingustavo | 0:0dee8840a1c0 | 92 | FunctionalState CAN_TTCM; /*!< Enable or disable the time triggered |
einsteingustavo | 0:0dee8840a1c0 | 93 | communication mode. This parameter can be set |
einsteingustavo | 0:0dee8840a1c0 | 94 | either to ENABLE or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 95 | |
einsteingustavo | 0:0dee8840a1c0 | 96 | FunctionalState CAN_ABOM; /*!< Enable or disable the automatic bus-off |
einsteingustavo | 0:0dee8840a1c0 | 97 | management. This parameter can be set either |
einsteingustavo | 0:0dee8840a1c0 | 98 | to ENABLE or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 99 | |
einsteingustavo | 0:0dee8840a1c0 | 100 | FunctionalState CAN_AWUM; /*!< Enable or disable the automatic wake-up mode. |
einsteingustavo | 0:0dee8840a1c0 | 101 | This parameter can be set either to ENABLE or |
einsteingustavo | 0:0dee8840a1c0 | 102 | DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 103 | |
einsteingustavo | 0:0dee8840a1c0 | 104 | FunctionalState CAN_NART; /*!< Enable or disable the no-automatic |
einsteingustavo | 0:0dee8840a1c0 | 105 | retransmission mode. This parameter can be |
einsteingustavo | 0:0dee8840a1c0 | 106 | set either to ENABLE or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 107 | |
einsteingustavo | 0:0dee8840a1c0 | 108 | FunctionalState CAN_RFLM; /*!< Enable or disable the Receive FIFO Locked mode. |
einsteingustavo | 0:0dee8840a1c0 | 109 | This parameter can be set either to ENABLE |
einsteingustavo | 0:0dee8840a1c0 | 110 | or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 111 | |
einsteingustavo | 0:0dee8840a1c0 | 112 | FunctionalState CAN_TXFP; /*!< Enable or disable the transmit FIFO priority. |
einsteingustavo | 0:0dee8840a1c0 | 113 | This parameter can be set either to ENABLE |
einsteingustavo | 0:0dee8840a1c0 | 114 | or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 115 | } CAN_InitTypeDef; |
einsteingustavo | 0:0dee8840a1c0 | 116 | |
einsteingustavo | 0:0dee8840a1c0 | 117 | /** |
einsteingustavo | 0:0dee8840a1c0 | 118 | * @brief CAN filter init structure definition |
einsteingustavo | 0:0dee8840a1c0 | 119 | */ |
einsteingustavo | 0:0dee8840a1c0 | 120 | |
einsteingustavo | 0:0dee8840a1c0 | 121 | typedef struct |
einsteingustavo | 0:0dee8840a1c0 | 122 | { |
einsteingustavo | 0:0dee8840a1c0 | 123 | uint16_t CAN_FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit |
einsteingustavo | 0:0dee8840a1c0 | 124 | configuration, first one for a 16-bit configuration). |
einsteingustavo | 0:0dee8840a1c0 | 125 | This parameter can be a value between 0x0000 and 0xFFFF */ |
einsteingustavo | 0:0dee8840a1c0 | 126 | |
einsteingustavo | 0:0dee8840a1c0 | 127 | uint16_t CAN_FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit |
einsteingustavo | 0:0dee8840a1c0 | 128 | configuration, second one for a 16-bit configuration). |
einsteingustavo | 0:0dee8840a1c0 | 129 | This parameter can be a value between 0x0000 and 0xFFFF */ |
einsteingustavo | 0:0dee8840a1c0 | 130 | |
einsteingustavo | 0:0dee8840a1c0 | 131 | uint16_t CAN_FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, |
einsteingustavo | 0:0dee8840a1c0 | 132 | according to the mode (MSBs for a 32-bit configuration, |
einsteingustavo | 0:0dee8840a1c0 | 133 | first one for a 16-bit configuration). |
einsteingustavo | 0:0dee8840a1c0 | 134 | This parameter can be a value between 0x0000 and 0xFFFF */ |
einsteingustavo | 0:0dee8840a1c0 | 135 | |
einsteingustavo | 0:0dee8840a1c0 | 136 | uint16_t CAN_FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, |
einsteingustavo | 0:0dee8840a1c0 | 137 | according to the mode (LSBs for a 32-bit configuration, |
einsteingustavo | 0:0dee8840a1c0 | 138 | second one for a 16-bit configuration). |
einsteingustavo | 0:0dee8840a1c0 | 139 | This parameter can be a value between 0x0000 and 0xFFFF */ |
einsteingustavo | 0:0dee8840a1c0 | 140 | |
einsteingustavo | 0:0dee8840a1c0 | 141 | uint16_t CAN_FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter. |
einsteingustavo | 0:0dee8840a1c0 | 142 | This parameter can be a value of @ref CAN_filter_FIFO */ |
einsteingustavo | 0:0dee8840a1c0 | 143 | |
einsteingustavo | 0:0dee8840a1c0 | 144 | uint8_t CAN_FilterNumber; /*!< Specifies the filter which will be initialized. It ranges from 0 to 13. */ |
einsteingustavo | 0:0dee8840a1c0 | 145 | |
einsteingustavo | 0:0dee8840a1c0 | 146 | uint8_t CAN_FilterMode; /*!< Specifies the filter mode to be initialized. |
einsteingustavo | 0:0dee8840a1c0 | 147 | This parameter can be a value of @ref CAN_filter_mode */ |
einsteingustavo | 0:0dee8840a1c0 | 148 | |
einsteingustavo | 0:0dee8840a1c0 | 149 | uint8_t CAN_FilterScale; /*!< Specifies the filter scale. |
einsteingustavo | 0:0dee8840a1c0 | 150 | This parameter can be a value of @ref CAN_filter_scale */ |
einsteingustavo | 0:0dee8840a1c0 | 151 | |
einsteingustavo | 0:0dee8840a1c0 | 152 | FunctionalState CAN_FilterActivation; /*!< Enable or disable the filter. |
einsteingustavo | 0:0dee8840a1c0 | 153 | This parameter can be set either to ENABLE or DISABLE. */ |
einsteingustavo | 0:0dee8840a1c0 | 154 | } CAN_FilterInitTypeDef; |
einsteingustavo | 0:0dee8840a1c0 | 155 | |
einsteingustavo | 0:0dee8840a1c0 | 156 | /** |
einsteingustavo | 0:0dee8840a1c0 | 157 | * @brief CAN Tx message structure definition |
einsteingustavo | 0:0dee8840a1c0 | 158 | */ |
einsteingustavo | 0:0dee8840a1c0 | 159 | |
einsteingustavo | 0:0dee8840a1c0 | 160 | typedef struct |
einsteingustavo | 0:0dee8840a1c0 | 161 | { |
einsteingustavo | 0:0dee8840a1c0 | 162 | uint32_t StdId; /*!< Specifies the standard identifier. |
einsteingustavo | 0:0dee8840a1c0 | 163 | This parameter can be a value between 0 to 0x7FF. */ |
einsteingustavo | 0:0dee8840a1c0 | 164 | |
einsteingustavo | 0:0dee8840a1c0 | 165 | uint32_t ExtId; /*!< Specifies the extended identifier. |
einsteingustavo | 0:0dee8840a1c0 | 166 | This parameter can be a value between 0 to 0x1FFFFFFF. */ |
einsteingustavo | 0:0dee8840a1c0 | 167 | |
einsteingustavo | 0:0dee8840a1c0 | 168 | uint8_t IDE; /*!< Specifies the type of identifier for the message that |
einsteingustavo | 0:0dee8840a1c0 | 169 | will be transmitted. This parameter can be a value |
einsteingustavo | 0:0dee8840a1c0 | 170 | of @ref CAN_identifier_type */ |
einsteingustavo | 0:0dee8840a1c0 | 171 | |
einsteingustavo | 0:0dee8840a1c0 | 172 | uint8_t RTR; /*!< Specifies the type of frame for the message that will |
einsteingustavo | 0:0dee8840a1c0 | 173 | be transmitted. This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 174 | @ref CAN_remote_transmission_request */ |
einsteingustavo | 0:0dee8840a1c0 | 175 | |
einsteingustavo | 0:0dee8840a1c0 | 176 | uint8_t DLC; /*!< Specifies the length of the frame that will be |
einsteingustavo | 0:0dee8840a1c0 | 177 | transmitted. This parameter can be a value between |
einsteingustavo | 0:0dee8840a1c0 | 178 | 0 to 8 */ |
einsteingustavo | 0:0dee8840a1c0 | 179 | |
einsteingustavo | 0:0dee8840a1c0 | 180 | uint8_t Data[8]; /*!< Contains the data to be transmitted. It ranges from 0 |
einsteingustavo | 0:0dee8840a1c0 | 181 | to 0xFF. */ |
einsteingustavo | 0:0dee8840a1c0 | 182 | } CanTxMsg; |
einsteingustavo | 0:0dee8840a1c0 | 183 | |
einsteingustavo | 0:0dee8840a1c0 | 184 | /** |
einsteingustavo | 0:0dee8840a1c0 | 185 | * @brief CAN Rx message structure definition |
einsteingustavo | 0:0dee8840a1c0 | 186 | */ |
einsteingustavo | 0:0dee8840a1c0 | 187 | |
einsteingustavo | 0:0dee8840a1c0 | 188 | typedef struct |
einsteingustavo | 0:0dee8840a1c0 | 189 | { |
einsteingustavo | 0:0dee8840a1c0 | 190 | uint32_t StdId; /*!< Specifies the standard identifier. |
einsteingustavo | 0:0dee8840a1c0 | 191 | This parameter can be a value between 0 to 0x7FF. */ |
einsteingustavo | 0:0dee8840a1c0 | 192 | |
einsteingustavo | 0:0dee8840a1c0 | 193 | uint32_t ExtId; /*!< Specifies the extended identifier. |
einsteingustavo | 0:0dee8840a1c0 | 194 | This parameter can be a value between 0 to 0x1FFFFFFF. */ |
einsteingustavo | 0:0dee8840a1c0 | 195 | |
einsteingustavo | 0:0dee8840a1c0 | 196 | uint8_t IDE; /*!< Specifies the type of identifier for the message that |
einsteingustavo | 0:0dee8840a1c0 | 197 | will be received. This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 198 | @ref CAN_identifier_type */ |
einsteingustavo | 0:0dee8840a1c0 | 199 | |
einsteingustavo | 0:0dee8840a1c0 | 200 | uint8_t RTR; /*!< Specifies the type of frame for the received message. |
einsteingustavo | 0:0dee8840a1c0 | 201 | This parameter can be a value of |
einsteingustavo | 0:0dee8840a1c0 | 202 | @ref CAN_remote_transmission_request */ |
einsteingustavo | 0:0dee8840a1c0 | 203 | |
einsteingustavo | 0:0dee8840a1c0 | 204 | uint8_t DLC; /*!< Specifies the length of the frame that will be received. |
einsteingustavo | 0:0dee8840a1c0 | 205 | This parameter can be a value between 0 to 8 */ |
einsteingustavo | 0:0dee8840a1c0 | 206 | |
einsteingustavo | 0:0dee8840a1c0 | 207 | uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to |
einsteingustavo | 0:0dee8840a1c0 | 208 | 0xFF. */ |
einsteingustavo | 0:0dee8840a1c0 | 209 | |
einsteingustavo | 0:0dee8840a1c0 | 210 | uint8_t FMI; /*!< Specifies the index of the filter the message stored in |
einsteingustavo | 0:0dee8840a1c0 | 211 | the mailbox passes through. This parameter can be a |
einsteingustavo | 0:0dee8840a1c0 | 212 | value between 0 to 0xFF */ |
einsteingustavo | 0:0dee8840a1c0 | 213 | } CanRxMsg; |
einsteingustavo | 0:0dee8840a1c0 | 214 | |
einsteingustavo | 0:0dee8840a1c0 | 215 | /** |
einsteingustavo | 0:0dee8840a1c0 | 216 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 217 | */ |
einsteingustavo | 0:0dee8840a1c0 | 218 | |
einsteingustavo | 0:0dee8840a1c0 | 219 | /** @defgroup CAN_Exported_Constants |
einsteingustavo | 0:0dee8840a1c0 | 220 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 221 | */ |
einsteingustavo | 0:0dee8840a1c0 | 222 | |
einsteingustavo | 0:0dee8840a1c0 | 223 | /** @defgroup CAN_sleep_constants |
einsteingustavo | 0:0dee8840a1c0 | 224 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 225 | */ |
einsteingustavo | 0:0dee8840a1c0 | 226 | |
einsteingustavo | 0:0dee8840a1c0 | 227 | #define CAN_InitStatus_Failed ((uint8_t)0x00) /*!< CAN initialization failed */ |
einsteingustavo | 0:0dee8840a1c0 | 228 | #define CAN_InitStatus_Success ((uint8_t)0x01) /*!< CAN initialization OK */ |
einsteingustavo | 0:0dee8840a1c0 | 229 | |
einsteingustavo | 0:0dee8840a1c0 | 230 | /** |
einsteingustavo | 0:0dee8840a1c0 | 231 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 232 | */ |
einsteingustavo | 0:0dee8840a1c0 | 233 | |
einsteingustavo | 0:0dee8840a1c0 | 234 | /** @defgroup CAN_Mode |
einsteingustavo | 0:0dee8840a1c0 | 235 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 236 | */ |
einsteingustavo | 0:0dee8840a1c0 | 237 | |
einsteingustavo | 0:0dee8840a1c0 | 238 | #define CAN_Mode_Normal ((uint8_t)0x00) /*!< normal mode */ |
einsteingustavo | 0:0dee8840a1c0 | 239 | #define CAN_Mode_LoopBack ((uint8_t)0x01) /*!< loopback mode */ |
einsteingustavo | 0:0dee8840a1c0 | 240 | #define CAN_Mode_Silent ((uint8_t)0x02) /*!< silent mode */ |
einsteingustavo | 0:0dee8840a1c0 | 241 | #define CAN_Mode_Silent_LoopBack ((uint8_t)0x03) /*!< loopback combined with silent mode */ |
einsteingustavo | 0:0dee8840a1c0 | 242 | |
einsteingustavo | 0:0dee8840a1c0 | 243 | #define IS_CAN_MODE(MODE) (((MODE) == CAN_Mode_Normal) || \ |
einsteingustavo | 0:0dee8840a1c0 | 244 | ((MODE) == CAN_Mode_LoopBack)|| \ |
einsteingustavo | 0:0dee8840a1c0 | 245 | ((MODE) == CAN_Mode_Silent) || \ |
einsteingustavo | 0:0dee8840a1c0 | 246 | ((MODE) == CAN_Mode_Silent_LoopBack)) |
einsteingustavo | 0:0dee8840a1c0 | 247 | /** |
einsteingustavo | 0:0dee8840a1c0 | 248 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 249 | */ |
einsteingustavo | 0:0dee8840a1c0 | 250 | |
einsteingustavo | 0:0dee8840a1c0 | 251 | |
einsteingustavo | 0:0dee8840a1c0 | 252 | /** |
einsteingustavo | 0:0dee8840a1c0 | 253 | * @defgroup CAN_Operating_Mode |
einsteingustavo | 0:0dee8840a1c0 | 254 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 255 | */ |
einsteingustavo | 0:0dee8840a1c0 | 256 | #define CAN_OperatingMode_Initialization ((uint8_t)0x00) /*!< Initialization mode */ |
einsteingustavo | 0:0dee8840a1c0 | 257 | #define CAN_OperatingMode_Normal ((uint8_t)0x01) /*!< Normal mode */ |
einsteingustavo | 0:0dee8840a1c0 | 258 | #define CAN_OperatingMode_Sleep ((uint8_t)0x02) /*!< sleep mode */ |
einsteingustavo | 0:0dee8840a1c0 | 259 | |
einsteingustavo | 0:0dee8840a1c0 | 260 | |
einsteingustavo | 0:0dee8840a1c0 | 261 | #define IS_CAN_OPERATING_MODE(MODE) (((MODE) == CAN_OperatingMode_Initialization) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 262 | ((MODE) == CAN_OperatingMode_Normal)|| \ |
einsteingustavo | 0:0dee8840a1c0 | 263 | ((MODE) == CAN_OperatingMode_Sleep)) |
einsteingustavo | 0:0dee8840a1c0 | 264 | /** |
einsteingustavo | 0:0dee8840a1c0 | 265 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 266 | */ |
einsteingustavo | 0:0dee8840a1c0 | 267 | |
einsteingustavo | 0:0dee8840a1c0 | 268 | /** |
einsteingustavo | 0:0dee8840a1c0 | 269 | * @defgroup CAN_Mode_Status |
einsteingustavo | 0:0dee8840a1c0 | 270 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 271 | */ |
einsteingustavo | 0:0dee8840a1c0 | 272 | |
einsteingustavo | 0:0dee8840a1c0 | 273 | #define CAN_ModeStatus_Failed ((uint8_t)0x00) /*!< CAN entering the specific mode failed */ |
einsteingustavo | 0:0dee8840a1c0 | 274 | #define CAN_ModeStatus_Success ((uint8_t)!CAN_ModeStatus_Failed) /*!< CAN entering the specific mode Succeed */ |
einsteingustavo | 0:0dee8840a1c0 | 275 | |
einsteingustavo | 0:0dee8840a1c0 | 276 | |
einsteingustavo | 0:0dee8840a1c0 | 277 | /** |
einsteingustavo | 0:0dee8840a1c0 | 278 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 279 | */ |
einsteingustavo | 0:0dee8840a1c0 | 280 | |
einsteingustavo | 0:0dee8840a1c0 | 281 | /** @defgroup CAN_synchronisation_jump_width |
einsteingustavo | 0:0dee8840a1c0 | 282 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 283 | */ |
einsteingustavo | 0:0dee8840a1c0 | 284 | |
einsteingustavo | 0:0dee8840a1c0 | 285 | #define CAN_SJW_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 286 | #define CAN_SJW_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 287 | #define CAN_SJW_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 288 | #define CAN_SJW_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 289 | |
einsteingustavo | 0:0dee8840a1c0 | 290 | #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1tq) || ((SJW) == CAN_SJW_2tq)|| \ |
einsteingustavo | 0:0dee8840a1c0 | 291 | ((SJW) == CAN_SJW_3tq) || ((SJW) == CAN_SJW_4tq)) |
einsteingustavo | 0:0dee8840a1c0 | 292 | /** |
einsteingustavo | 0:0dee8840a1c0 | 293 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 294 | */ |
einsteingustavo | 0:0dee8840a1c0 | 295 | |
einsteingustavo | 0:0dee8840a1c0 | 296 | /** @defgroup CAN_time_quantum_in_bit_segment_1 |
einsteingustavo | 0:0dee8840a1c0 | 297 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 298 | */ |
einsteingustavo | 0:0dee8840a1c0 | 299 | |
einsteingustavo | 0:0dee8840a1c0 | 300 | #define CAN_BS1_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 301 | #define CAN_BS1_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 302 | #define CAN_BS1_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 303 | #define CAN_BS1_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 304 | #define CAN_BS1_5tq ((uint8_t)0x04) /*!< 5 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 305 | #define CAN_BS1_6tq ((uint8_t)0x05) /*!< 6 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 306 | #define CAN_BS1_7tq ((uint8_t)0x06) /*!< 7 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 307 | #define CAN_BS1_8tq ((uint8_t)0x07) /*!< 8 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 308 | #define CAN_BS1_9tq ((uint8_t)0x08) /*!< 9 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 309 | #define CAN_BS1_10tq ((uint8_t)0x09) /*!< 10 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 310 | #define CAN_BS1_11tq ((uint8_t)0x0A) /*!< 11 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 311 | #define CAN_BS1_12tq ((uint8_t)0x0B) /*!< 12 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 312 | #define CAN_BS1_13tq ((uint8_t)0x0C) /*!< 13 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 313 | #define CAN_BS1_14tq ((uint8_t)0x0D) /*!< 14 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 314 | #define CAN_BS1_15tq ((uint8_t)0x0E) /*!< 15 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 315 | #define CAN_BS1_16tq ((uint8_t)0x0F) /*!< 16 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 316 | |
einsteingustavo | 0:0dee8840a1c0 | 317 | #define IS_CAN_BS1(BS1) ((BS1) <= CAN_BS1_16tq) |
einsteingustavo | 0:0dee8840a1c0 | 318 | /** |
einsteingustavo | 0:0dee8840a1c0 | 319 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 320 | */ |
einsteingustavo | 0:0dee8840a1c0 | 321 | |
einsteingustavo | 0:0dee8840a1c0 | 322 | /** @defgroup CAN_time_quantum_in_bit_segment_2 |
einsteingustavo | 0:0dee8840a1c0 | 323 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 324 | */ |
einsteingustavo | 0:0dee8840a1c0 | 325 | |
einsteingustavo | 0:0dee8840a1c0 | 326 | #define CAN_BS2_1tq ((uint8_t)0x00) /*!< 1 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 327 | #define CAN_BS2_2tq ((uint8_t)0x01) /*!< 2 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 328 | #define CAN_BS2_3tq ((uint8_t)0x02) /*!< 3 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 329 | #define CAN_BS2_4tq ((uint8_t)0x03) /*!< 4 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 330 | #define CAN_BS2_5tq ((uint8_t)0x04) /*!< 5 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 331 | #define CAN_BS2_6tq ((uint8_t)0x05) /*!< 6 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 332 | #define CAN_BS2_7tq ((uint8_t)0x06) /*!< 7 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 333 | #define CAN_BS2_8tq ((uint8_t)0x07) /*!< 8 time quantum */ |
einsteingustavo | 0:0dee8840a1c0 | 334 | |
einsteingustavo | 0:0dee8840a1c0 | 335 | #define IS_CAN_BS2(BS2) ((BS2) <= CAN_BS2_8tq) |
einsteingustavo | 0:0dee8840a1c0 | 336 | |
einsteingustavo | 0:0dee8840a1c0 | 337 | /** |
einsteingustavo | 0:0dee8840a1c0 | 338 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 339 | */ |
einsteingustavo | 0:0dee8840a1c0 | 340 | |
einsteingustavo | 0:0dee8840a1c0 | 341 | /** @defgroup CAN_clock_prescaler |
einsteingustavo | 0:0dee8840a1c0 | 342 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 343 | */ |
einsteingustavo | 0:0dee8840a1c0 | 344 | |
einsteingustavo | 0:0dee8840a1c0 | 345 | #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 1024)) |
einsteingustavo | 0:0dee8840a1c0 | 346 | |
einsteingustavo | 0:0dee8840a1c0 | 347 | /** |
einsteingustavo | 0:0dee8840a1c0 | 348 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 349 | */ |
einsteingustavo | 0:0dee8840a1c0 | 350 | |
einsteingustavo | 0:0dee8840a1c0 | 351 | /** @defgroup CAN_filter_number |
einsteingustavo | 0:0dee8840a1c0 | 352 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 353 | */ |
einsteingustavo | 0:0dee8840a1c0 | 354 | #ifndef STM32F10X_CL |
einsteingustavo | 0:0dee8840a1c0 | 355 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13) |
einsteingustavo | 0:0dee8840a1c0 | 356 | #else |
einsteingustavo | 0:0dee8840a1c0 | 357 | #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27) |
einsteingustavo | 0:0dee8840a1c0 | 358 | #endif /* STM32F10X_CL */ |
einsteingustavo | 0:0dee8840a1c0 | 359 | /** |
einsteingustavo | 0:0dee8840a1c0 | 360 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 361 | */ |
einsteingustavo | 0:0dee8840a1c0 | 362 | |
einsteingustavo | 0:0dee8840a1c0 | 363 | /** @defgroup CAN_filter_mode |
einsteingustavo | 0:0dee8840a1c0 | 364 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 365 | */ |
einsteingustavo | 0:0dee8840a1c0 | 366 | |
einsteingustavo | 0:0dee8840a1c0 | 367 | #define CAN_FilterMode_IdMask ((uint8_t)0x00) /*!< identifier/mask mode */ |
einsteingustavo | 0:0dee8840a1c0 | 368 | #define CAN_FilterMode_IdList ((uint8_t)0x01) /*!< identifier list mode */ |
einsteingustavo | 0:0dee8840a1c0 | 369 | |
einsteingustavo | 0:0dee8840a1c0 | 370 | #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FilterMode_IdMask) || \ |
einsteingustavo | 0:0dee8840a1c0 | 371 | ((MODE) == CAN_FilterMode_IdList)) |
einsteingustavo | 0:0dee8840a1c0 | 372 | /** |
einsteingustavo | 0:0dee8840a1c0 | 373 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 374 | */ |
einsteingustavo | 0:0dee8840a1c0 | 375 | |
einsteingustavo | 0:0dee8840a1c0 | 376 | /** @defgroup CAN_filter_scale |
einsteingustavo | 0:0dee8840a1c0 | 377 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 378 | */ |
einsteingustavo | 0:0dee8840a1c0 | 379 | |
einsteingustavo | 0:0dee8840a1c0 | 380 | #define CAN_FilterScale_16bit ((uint8_t)0x00) /*!< Two 16-bit filters */ |
einsteingustavo | 0:0dee8840a1c0 | 381 | #define CAN_FilterScale_32bit ((uint8_t)0x01) /*!< One 32-bit filter */ |
einsteingustavo | 0:0dee8840a1c0 | 382 | |
einsteingustavo | 0:0dee8840a1c0 | 383 | #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FilterScale_16bit) || \ |
einsteingustavo | 0:0dee8840a1c0 | 384 | ((SCALE) == CAN_FilterScale_32bit)) |
einsteingustavo | 0:0dee8840a1c0 | 385 | |
einsteingustavo | 0:0dee8840a1c0 | 386 | /** |
einsteingustavo | 0:0dee8840a1c0 | 387 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 388 | */ |
einsteingustavo | 0:0dee8840a1c0 | 389 | |
einsteingustavo | 0:0dee8840a1c0 | 390 | /** @defgroup CAN_filter_FIFO |
einsteingustavo | 0:0dee8840a1c0 | 391 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 392 | */ |
einsteingustavo | 0:0dee8840a1c0 | 393 | |
einsteingustavo | 0:0dee8840a1c0 | 394 | #define CAN_Filter_FIFO0 ((uint8_t)0x00) /*!< Filter FIFO 0 assignment for filter x */ |
einsteingustavo | 0:0dee8840a1c0 | 395 | #define CAN_Filter_FIFO1 ((uint8_t)0x01) /*!< Filter FIFO 1 assignment for filter x */ |
einsteingustavo | 0:0dee8840a1c0 | 396 | #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FilterFIFO0) || \ |
einsteingustavo | 0:0dee8840a1c0 | 397 | ((FIFO) == CAN_FilterFIFO1)) |
einsteingustavo | 0:0dee8840a1c0 | 398 | /** |
einsteingustavo | 0:0dee8840a1c0 | 399 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 400 | */ |
einsteingustavo | 0:0dee8840a1c0 | 401 | |
einsteingustavo | 0:0dee8840a1c0 | 402 | /** @defgroup Start_bank_filter_for_slave_CAN |
einsteingustavo | 0:0dee8840a1c0 | 403 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 404 | */ |
einsteingustavo | 0:0dee8840a1c0 | 405 | #define IS_CAN_BANKNUMBER(BANKNUMBER) (((BANKNUMBER) >= 1) && ((BANKNUMBER) <= 27)) |
einsteingustavo | 0:0dee8840a1c0 | 406 | /** |
einsteingustavo | 0:0dee8840a1c0 | 407 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 408 | */ |
einsteingustavo | 0:0dee8840a1c0 | 409 | |
einsteingustavo | 0:0dee8840a1c0 | 410 | /** @defgroup CAN_Tx |
einsteingustavo | 0:0dee8840a1c0 | 411 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 412 | */ |
einsteingustavo | 0:0dee8840a1c0 | 413 | |
einsteingustavo | 0:0dee8840a1c0 | 414 | #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= ((uint8_t)0x02)) |
einsteingustavo | 0:0dee8840a1c0 | 415 | #define IS_CAN_STDID(STDID) ((STDID) <= ((uint32_t)0x7FF)) |
einsteingustavo | 0:0dee8840a1c0 | 416 | #define IS_CAN_EXTID(EXTID) ((EXTID) <= ((uint32_t)0x1FFFFFFF)) |
einsteingustavo | 0:0dee8840a1c0 | 417 | #define IS_CAN_DLC(DLC) ((DLC) <= ((uint8_t)0x08)) |
einsteingustavo | 0:0dee8840a1c0 | 418 | |
einsteingustavo | 0:0dee8840a1c0 | 419 | /** |
einsteingustavo | 0:0dee8840a1c0 | 420 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 421 | */ |
einsteingustavo | 0:0dee8840a1c0 | 422 | |
einsteingustavo | 0:0dee8840a1c0 | 423 | /** @defgroup CAN_identifier_type |
einsteingustavo | 0:0dee8840a1c0 | 424 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 425 | */ |
einsteingustavo | 0:0dee8840a1c0 | 426 | |
einsteingustavo | 0:0dee8840a1c0 | 427 | #define CAN_Id_Standard ((uint32_t)0x00000000) /*!< Standard Id */ |
einsteingustavo | 0:0dee8840a1c0 | 428 | #define CAN_Id_Extended ((uint32_t)0x00000004) /*!< Extended Id */ |
einsteingustavo | 0:0dee8840a1c0 | 429 | #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_Id_Standard) || \ |
einsteingustavo | 0:0dee8840a1c0 | 430 | ((IDTYPE) == CAN_Id_Extended)) |
einsteingustavo | 0:0dee8840a1c0 | 431 | /** |
einsteingustavo | 0:0dee8840a1c0 | 432 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 433 | */ |
einsteingustavo | 0:0dee8840a1c0 | 434 | |
einsteingustavo | 0:0dee8840a1c0 | 435 | /** @defgroup CAN_remote_transmission_request |
einsteingustavo | 0:0dee8840a1c0 | 436 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 437 | */ |
einsteingustavo | 0:0dee8840a1c0 | 438 | |
einsteingustavo | 0:0dee8840a1c0 | 439 | #define CAN_RTR_Data ((uint32_t)0x00000000) /*!< Data frame */ |
einsteingustavo | 0:0dee8840a1c0 | 440 | #define CAN_RTR_Remote ((uint32_t)0x00000002) /*!< Remote frame */ |
einsteingustavo | 0:0dee8840a1c0 | 441 | #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_Data) || ((RTR) == CAN_RTR_Remote)) |
einsteingustavo | 0:0dee8840a1c0 | 442 | |
einsteingustavo | 0:0dee8840a1c0 | 443 | /** |
einsteingustavo | 0:0dee8840a1c0 | 444 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 445 | */ |
einsteingustavo | 0:0dee8840a1c0 | 446 | |
einsteingustavo | 0:0dee8840a1c0 | 447 | /** @defgroup CAN_transmit_constants |
einsteingustavo | 0:0dee8840a1c0 | 448 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 449 | */ |
einsteingustavo | 0:0dee8840a1c0 | 450 | |
einsteingustavo | 0:0dee8840a1c0 | 451 | #define CAN_TxStatus_Failed ((uint8_t)0x00)/*!< CAN transmission failed */ |
einsteingustavo | 0:0dee8840a1c0 | 452 | #define CAN_TxStatus_Ok ((uint8_t)0x01) /*!< CAN transmission succeeded */ |
einsteingustavo | 0:0dee8840a1c0 | 453 | #define CAN_TxStatus_Pending ((uint8_t)0x02) /*!< CAN transmission pending */ |
einsteingustavo | 0:0dee8840a1c0 | 454 | #define CAN_TxStatus_NoMailBox ((uint8_t)0x04) /*!< CAN cell did not provide an empty mailbox */ |
einsteingustavo | 0:0dee8840a1c0 | 455 | |
einsteingustavo | 0:0dee8840a1c0 | 456 | /** |
einsteingustavo | 0:0dee8840a1c0 | 457 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 458 | */ |
einsteingustavo | 0:0dee8840a1c0 | 459 | |
einsteingustavo | 0:0dee8840a1c0 | 460 | /** @defgroup CAN_receive_FIFO_number_constants |
einsteingustavo | 0:0dee8840a1c0 | 461 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 462 | */ |
einsteingustavo | 0:0dee8840a1c0 | 463 | |
einsteingustavo | 0:0dee8840a1c0 | 464 | #define CAN_FIFO0 ((uint8_t)0x00) /*!< CAN FIFO 0 used to receive */ |
einsteingustavo | 0:0dee8840a1c0 | 465 | #define CAN_FIFO1 ((uint8_t)0x01) /*!< CAN FIFO 1 used to receive */ |
einsteingustavo | 0:0dee8840a1c0 | 466 | |
einsteingustavo | 0:0dee8840a1c0 | 467 | #define IS_CAN_FIFO(FIFO) (((FIFO) == CAN_FIFO0) || ((FIFO) == CAN_FIFO1)) |
einsteingustavo | 0:0dee8840a1c0 | 468 | |
einsteingustavo | 0:0dee8840a1c0 | 469 | /** |
einsteingustavo | 0:0dee8840a1c0 | 470 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 471 | */ |
einsteingustavo | 0:0dee8840a1c0 | 472 | |
einsteingustavo | 0:0dee8840a1c0 | 473 | /** @defgroup CAN_sleep_constants |
einsteingustavo | 0:0dee8840a1c0 | 474 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 475 | */ |
einsteingustavo | 0:0dee8840a1c0 | 476 | |
einsteingustavo | 0:0dee8840a1c0 | 477 | #define CAN_Sleep_Failed ((uint8_t)0x00) /*!< CAN did not enter the sleep mode */ |
einsteingustavo | 0:0dee8840a1c0 | 478 | #define CAN_Sleep_Ok ((uint8_t)0x01) /*!< CAN entered the sleep mode */ |
einsteingustavo | 0:0dee8840a1c0 | 479 | |
einsteingustavo | 0:0dee8840a1c0 | 480 | /** |
einsteingustavo | 0:0dee8840a1c0 | 481 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 482 | */ |
einsteingustavo | 0:0dee8840a1c0 | 483 | |
einsteingustavo | 0:0dee8840a1c0 | 484 | /** @defgroup CAN_wake_up_constants |
einsteingustavo | 0:0dee8840a1c0 | 485 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 486 | */ |
einsteingustavo | 0:0dee8840a1c0 | 487 | |
einsteingustavo | 0:0dee8840a1c0 | 488 | #define CAN_WakeUp_Failed ((uint8_t)0x00) /*!< CAN did not leave the sleep mode */ |
einsteingustavo | 0:0dee8840a1c0 | 489 | #define CAN_WakeUp_Ok ((uint8_t)0x01) /*!< CAN leaved the sleep mode */ |
einsteingustavo | 0:0dee8840a1c0 | 490 | |
einsteingustavo | 0:0dee8840a1c0 | 491 | /** |
einsteingustavo | 0:0dee8840a1c0 | 492 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 493 | */ |
einsteingustavo | 0:0dee8840a1c0 | 494 | |
einsteingustavo | 0:0dee8840a1c0 | 495 | /** |
einsteingustavo | 0:0dee8840a1c0 | 496 | * @defgroup CAN_Error_Code_constants |
einsteingustavo | 0:0dee8840a1c0 | 497 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 498 | */ |
einsteingustavo | 0:0dee8840a1c0 | 499 | |
einsteingustavo | 0:0dee8840a1c0 | 500 | #define CAN_ErrorCode_NoErr ((uint8_t)0x00) /*!< No Error */ |
einsteingustavo | 0:0dee8840a1c0 | 501 | #define CAN_ErrorCode_StuffErr ((uint8_t)0x10) /*!< Stuff Error */ |
einsteingustavo | 0:0dee8840a1c0 | 502 | #define CAN_ErrorCode_FormErr ((uint8_t)0x20) /*!< Form Error */ |
einsteingustavo | 0:0dee8840a1c0 | 503 | #define CAN_ErrorCode_ACKErr ((uint8_t)0x30) /*!< Acknowledgment Error */ |
einsteingustavo | 0:0dee8840a1c0 | 504 | #define CAN_ErrorCode_BitRecessiveErr ((uint8_t)0x40) /*!< Bit Recessive Error */ |
einsteingustavo | 0:0dee8840a1c0 | 505 | #define CAN_ErrorCode_BitDominantErr ((uint8_t)0x50) /*!< Bit Dominant Error */ |
einsteingustavo | 0:0dee8840a1c0 | 506 | #define CAN_ErrorCode_CRCErr ((uint8_t)0x60) /*!< CRC Error */ |
einsteingustavo | 0:0dee8840a1c0 | 507 | #define CAN_ErrorCode_SoftwareSetErr ((uint8_t)0x70) /*!< Software Set Error */ |
einsteingustavo | 0:0dee8840a1c0 | 508 | |
einsteingustavo | 0:0dee8840a1c0 | 509 | |
einsteingustavo | 0:0dee8840a1c0 | 510 | /** |
einsteingustavo | 0:0dee8840a1c0 | 511 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 512 | */ |
einsteingustavo | 0:0dee8840a1c0 | 513 | |
einsteingustavo | 0:0dee8840a1c0 | 514 | /** @defgroup CAN_flags |
einsteingustavo | 0:0dee8840a1c0 | 515 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 516 | */ |
einsteingustavo | 0:0dee8840a1c0 | 517 | /* If the flag is 0x3XXXXXXX, it means that it can be used with CAN_GetFlagStatus() |
einsteingustavo | 0:0dee8840a1c0 | 518 | and CAN_ClearFlag() functions. */ |
einsteingustavo | 0:0dee8840a1c0 | 519 | /* If the flag is 0x1XXXXXXX, it means that it can only be used with CAN_GetFlagStatus() function. */ |
einsteingustavo | 0:0dee8840a1c0 | 520 | |
einsteingustavo | 0:0dee8840a1c0 | 521 | /* Transmit Flags */ |
einsteingustavo | 0:0dee8840a1c0 | 522 | #define CAN_FLAG_RQCP0 ((uint32_t)0x38000001) /*!< Request MailBox0 Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 523 | #define CAN_FLAG_RQCP1 ((uint32_t)0x38000100) /*!< Request MailBox1 Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 524 | #define CAN_FLAG_RQCP2 ((uint32_t)0x38010000) /*!< Request MailBox2 Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 525 | |
einsteingustavo | 0:0dee8840a1c0 | 526 | /* Receive Flags */ |
einsteingustavo | 0:0dee8840a1c0 | 527 | #define CAN_FLAG_FMP0 ((uint32_t)0x12000003) /*!< FIFO 0 Message Pending Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 528 | #define CAN_FLAG_FF0 ((uint32_t)0x32000008) /*!< FIFO 0 Full Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 529 | #define CAN_FLAG_FOV0 ((uint32_t)0x32000010) /*!< FIFO 0 Overrun Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 530 | #define CAN_FLAG_FMP1 ((uint32_t)0x14000003) /*!< FIFO 1 Message Pending Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 531 | #define CAN_FLAG_FF1 ((uint32_t)0x34000008) /*!< FIFO 1 Full Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 532 | #define CAN_FLAG_FOV1 ((uint32_t)0x34000010) /*!< FIFO 1 Overrun Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 533 | |
einsteingustavo | 0:0dee8840a1c0 | 534 | /* Operating Mode Flags */ |
einsteingustavo | 0:0dee8840a1c0 | 535 | #define CAN_FLAG_WKU ((uint32_t)0x31000008) /*!< Wake up Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 536 | #define CAN_FLAG_SLAK ((uint32_t)0x31000012) /*!< Sleep acknowledge Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 537 | /* Note: When SLAK intterupt is disabled (SLKIE=0), no polling on SLAKI is possible. |
einsteingustavo | 0:0dee8840a1c0 | 538 | In this case the SLAK bit can be polled.*/ |
einsteingustavo | 0:0dee8840a1c0 | 539 | |
einsteingustavo | 0:0dee8840a1c0 | 540 | /* Error Flags */ |
einsteingustavo | 0:0dee8840a1c0 | 541 | #define CAN_FLAG_EWG ((uint32_t)0x10F00001) /*!< Error Warning Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 542 | #define CAN_FLAG_EPV ((uint32_t)0x10F00002) /*!< Error Passive Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 543 | #define CAN_FLAG_BOF ((uint32_t)0x10F00004) /*!< Bus-Off Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 544 | #define CAN_FLAG_LEC ((uint32_t)0x30F00070) /*!< Last error code Flag */ |
einsteingustavo | 0:0dee8840a1c0 | 545 | |
einsteingustavo | 0:0dee8840a1c0 | 546 | #define IS_CAN_GET_FLAG(FLAG) (((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_BOF) || \ |
einsteingustavo | 0:0dee8840a1c0 | 547 | ((FLAG) == CAN_FLAG_EPV) || ((FLAG) == CAN_FLAG_EWG) || \ |
einsteingustavo | 0:0dee8840a1c0 | 548 | ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_FOV0) || \ |
einsteingustavo | 0:0dee8840a1c0 | 549 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FMP0) || \ |
einsteingustavo | 0:0dee8840a1c0 | 550 | ((FLAG) == CAN_FLAG_FOV1) || ((FLAG) == CAN_FLAG_FF1) || \ |
einsteingustavo | 0:0dee8840a1c0 | 551 | ((FLAG) == CAN_FLAG_FMP1) || ((FLAG) == CAN_FLAG_RQCP2) || \ |
einsteingustavo | 0:0dee8840a1c0 | 552 | ((FLAG) == CAN_FLAG_RQCP1)|| ((FLAG) == CAN_FLAG_RQCP0) || \ |
einsteingustavo | 0:0dee8840a1c0 | 553 | ((FLAG) == CAN_FLAG_SLAK )) |
einsteingustavo | 0:0dee8840a1c0 | 554 | |
einsteingustavo | 0:0dee8840a1c0 | 555 | #define IS_CAN_CLEAR_FLAG(FLAG)(((FLAG) == CAN_FLAG_LEC) || ((FLAG) == CAN_FLAG_RQCP2) || \ |
einsteingustavo | 0:0dee8840a1c0 | 556 | ((FLAG) == CAN_FLAG_RQCP1) || ((FLAG) == CAN_FLAG_RQCP0) || \ |
einsteingustavo | 0:0dee8840a1c0 | 557 | ((FLAG) == CAN_FLAG_FF0) || ((FLAG) == CAN_FLAG_FOV0) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 558 | ((FLAG) == CAN_FLAG_FF1) || ((FLAG) == CAN_FLAG_FOV1) || \ |
einsteingustavo | 0:0dee8840a1c0 | 559 | ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_SLAK)) |
einsteingustavo | 0:0dee8840a1c0 | 560 | /** |
einsteingustavo | 0:0dee8840a1c0 | 561 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 562 | */ |
einsteingustavo | 0:0dee8840a1c0 | 563 | |
einsteingustavo | 0:0dee8840a1c0 | 564 | |
einsteingustavo | 0:0dee8840a1c0 | 565 | /** @defgroup CAN_interrupts |
einsteingustavo | 0:0dee8840a1c0 | 566 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 567 | */ |
einsteingustavo | 0:0dee8840a1c0 | 568 | |
einsteingustavo | 0:0dee8840a1c0 | 569 | |
einsteingustavo | 0:0dee8840a1c0 | 570 | |
einsteingustavo | 0:0dee8840a1c0 | 571 | #define CAN_IT_TME ((uint32_t)0x00000001) /*!< Transmit mailbox empty Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 572 | |
einsteingustavo | 0:0dee8840a1c0 | 573 | /* Receive Interrupts */ |
einsteingustavo | 0:0dee8840a1c0 | 574 | #define CAN_IT_FMP0 ((uint32_t)0x00000002) /*!< FIFO 0 message pending Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 575 | #define CAN_IT_FF0 ((uint32_t)0x00000004) /*!< FIFO 0 full Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 576 | #define CAN_IT_FOV0 ((uint32_t)0x00000008) /*!< FIFO 0 overrun Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 577 | #define CAN_IT_FMP1 ((uint32_t)0x00000010) /*!< FIFO 1 message pending Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 578 | #define CAN_IT_FF1 ((uint32_t)0x00000020) /*!< FIFO 1 full Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 579 | #define CAN_IT_FOV1 ((uint32_t)0x00000040) /*!< FIFO 1 overrun Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 580 | |
einsteingustavo | 0:0dee8840a1c0 | 581 | /* Operating Mode Interrupts */ |
einsteingustavo | 0:0dee8840a1c0 | 582 | #define CAN_IT_WKU ((uint32_t)0x00010000) /*!< Wake-up Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 583 | #define CAN_IT_SLK ((uint32_t)0x00020000) /*!< Sleep acknowledge Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 584 | |
einsteingustavo | 0:0dee8840a1c0 | 585 | /* Error Interrupts */ |
einsteingustavo | 0:0dee8840a1c0 | 586 | #define CAN_IT_EWG ((uint32_t)0x00000100) /*!< Error warning Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 587 | #define CAN_IT_EPV ((uint32_t)0x00000200) /*!< Error passive Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 588 | #define CAN_IT_BOF ((uint32_t)0x00000400) /*!< Bus-off Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 589 | #define CAN_IT_LEC ((uint32_t)0x00000800) /*!< Last error code Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 590 | #define CAN_IT_ERR ((uint32_t)0x00008000) /*!< Error Interrupt*/ |
einsteingustavo | 0:0dee8840a1c0 | 591 | |
einsteingustavo | 0:0dee8840a1c0 | 592 | /* Flags named as Interrupts : kept only for FW compatibility */ |
einsteingustavo | 0:0dee8840a1c0 | 593 | #define CAN_IT_RQCP0 CAN_IT_TME |
einsteingustavo | 0:0dee8840a1c0 | 594 | #define CAN_IT_RQCP1 CAN_IT_TME |
einsteingustavo | 0:0dee8840a1c0 | 595 | #define CAN_IT_RQCP2 CAN_IT_TME |
einsteingustavo | 0:0dee8840a1c0 | 596 | |
einsteingustavo | 0:0dee8840a1c0 | 597 | |
einsteingustavo | 0:0dee8840a1c0 | 598 | #define IS_CAN_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FMP0) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 599 | ((IT) == CAN_IT_FF0) || ((IT) == CAN_IT_FOV0) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 600 | ((IT) == CAN_IT_FMP1) || ((IT) == CAN_IT_FF1) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 601 | ((IT) == CAN_IT_FOV1) || ((IT) == CAN_IT_EWG) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 602 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 603 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 604 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
einsteingustavo | 0:0dee8840a1c0 | 605 | |
einsteingustavo | 0:0dee8840a1c0 | 606 | #define IS_CAN_CLEAR_IT(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FF0) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 607 | ((IT) == CAN_IT_FOV0)|| ((IT) == CAN_IT_FF1) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 608 | ((IT) == CAN_IT_FOV1)|| ((IT) == CAN_IT_EWG) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 609 | ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 610 | ((IT) == CAN_IT_LEC) || ((IT) == CAN_IT_ERR) ||\ |
einsteingustavo | 0:0dee8840a1c0 | 611 | ((IT) == CAN_IT_WKU) || ((IT) == CAN_IT_SLK)) |
einsteingustavo | 0:0dee8840a1c0 | 612 | |
einsteingustavo | 0:0dee8840a1c0 | 613 | /** |
einsteingustavo | 0:0dee8840a1c0 | 614 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 615 | */ |
einsteingustavo | 0:0dee8840a1c0 | 616 | |
einsteingustavo | 0:0dee8840a1c0 | 617 | /** @defgroup CAN_Legacy |
einsteingustavo | 0:0dee8840a1c0 | 618 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 619 | */ |
einsteingustavo | 0:0dee8840a1c0 | 620 | #define CANINITFAILED CAN_InitStatus_Failed |
einsteingustavo | 0:0dee8840a1c0 | 621 | #define CANINITOK CAN_InitStatus_Success |
einsteingustavo | 0:0dee8840a1c0 | 622 | #define CAN_FilterFIFO0 CAN_Filter_FIFO0 |
einsteingustavo | 0:0dee8840a1c0 | 623 | #define CAN_FilterFIFO1 CAN_Filter_FIFO1 |
einsteingustavo | 0:0dee8840a1c0 | 624 | #define CAN_ID_STD CAN_Id_Standard |
einsteingustavo | 0:0dee8840a1c0 | 625 | #define CAN_ID_EXT CAN_Id_Extended |
einsteingustavo | 0:0dee8840a1c0 | 626 | #define CAN_RTR_DATA CAN_RTR_Data |
einsteingustavo | 0:0dee8840a1c0 | 627 | #define CAN_RTR_REMOTE CAN_RTR_Remote |
einsteingustavo | 0:0dee8840a1c0 | 628 | #define CANTXFAILE CAN_TxStatus_Failed |
einsteingustavo | 0:0dee8840a1c0 | 629 | #define CANTXOK CAN_TxStatus_Ok |
einsteingustavo | 0:0dee8840a1c0 | 630 | #define CANTXPENDING CAN_TxStatus_Pending |
einsteingustavo | 0:0dee8840a1c0 | 631 | #define CAN_NO_MB CAN_TxStatus_NoMailBox |
einsteingustavo | 0:0dee8840a1c0 | 632 | #define CANSLEEPFAILED CAN_Sleep_Failed |
einsteingustavo | 0:0dee8840a1c0 | 633 | #define CANSLEEPOK CAN_Sleep_Ok |
einsteingustavo | 0:0dee8840a1c0 | 634 | #define CANWAKEUPFAILED CAN_WakeUp_Failed |
einsteingustavo | 0:0dee8840a1c0 | 635 | #define CANWAKEUPOK CAN_WakeUp_Ok |
einsteingustavo | 0:0dee8840a1c0 | 636 | |
einsteingustavo | 0:0dee8840a1c0 | 637 | /** |
einsteingustavo | 0:0dee8840a1c0 | 638 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 639 | */ |
einsteingustavo | 0:0dee8840a1c0 | 640 | |
einsteingustavo | 0:0dee8840a1c0 | 641 | /** |
einsteingustavo | 0:0dee8840a1c0 | 642 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 643 | */ |
einsteingustavo | 0:0dee8840a1c0 | 644 | |
einsteingustavo | 0:0dee8840a1c0 | 645 | /** @defgroup CAN_Exported_Macros |
einsteingustavo | 0:0dee8840a1c0 | 646 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 647 | */ |
einsteingustavo | 0:0dee8840a1c0 | 648 | |
einsteingustavo | 0:0dee8840a1c0 | 649 | /** |
einsteingustavo | 0:0dee8840a1c0 | 650 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 651 | */ |
einsteingustavo | 0:0dee8840a1c0 | 652 | |
einsteingustavo | 0:0dee8840a1c0 | 653 | /** @defgroup CAN_Exported_Functions |
einsteingustavo | 0:0dee8840a1c0 | 654 | * @{ |
einsteingustavo | 0:0dee8840a1c0 | 655 | */ |
einsteingustavo | 0:0dee8840a1c0 | 656 | /* Function used to set the CAN configuration to the default reset state *****/ |
einsteingustavo | 0:0dee8840a1c0 | 657 | void CAN_DeInit(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 658 | |
einsteingustavo | 0:0dee8840a1c0 | 659 | /* Initialization and Configuration functions *********************************/ |
einsteingustavo | 0:0dee8840a1c0 | 660 | uint8_t CAN_Init(CAN_TypeDef* CANx, CAN_InitTypeDef* CAN_InitStruct); |
einsteingustavo | 0:0dee8840a1c0 | 661 | void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct); |
einsteingustavo | 0:0dee8840a1c0 | 662 | void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct); |
einsteingustavo | 0:0dee8840a1c0 | 663 | void CAN_SlaveStartBank(uint8_t CAN_BankNumber); |
einsteingustavo | 0:0dee8840a1c0 | 664 | void CAN_DBGFreeze(CAN_TypeDef* CANx, FunctionalState NewState); |
einsteingustavo | 0:0dee8840a1c0 | 665 | void CAN_TTComModeCmd(CAN_TypeDef* CANx, FunctionalState NewState); |
einsteingustavo | 0:0dee8840a1c0 | 666 | |
einsteingustavo | 0:0dee8840a1c0 | 667 | /* Transmit functions *********************************************************/ |
einsteingustavo | 0:0dee8840a1c0 | 668 | uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage); |
einsteingustavo | 0:0dee8840a1c0 | 669 | uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox); |
einsteingustavo | 0:0dee8840a1c0 | 670 | void CAN_CancelTransmit(CAN_TypeDef* CANx, uint8_t Mailbox); |
einsteingustavo | 0:0dee8840a1c0 | 671 | |
einsteingustavo | 0:0dee8840a1c0 | 672 | /* Receive functions **********************************************************/ |
einsteingustavo | 0:0dee8840a1c0 | 673 | void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage); |
einsteingustavo | 0:0dee8840a1c0 | 674 | void CAN_FIFORelease(CAN_TypeDef* CANx, uint8_t FIFONumber); |
einsteingustavo | 0:0dee8840a1c0 | 675 | uint8_t CAN_MessagePending(CAN_TypeDef* CANx, uint8_t FIFONumber); |
einsteingustavo | 0:0dee8840a1c0 | 676 | |
einsteingustavo | 0:0dee8840a1c0 | 677 | |
einsteingustavo | 0:0dee8840a1c0 | 678 | /* Operation modes functions **************************************************/ |
einsteingustavo | 0:0dee8840a1c0 | 679 | uint8_t CAN_OperatingModeRequest(CAN_TypeDef* CANx, uint8_t CAN_OperatingMode); |
einsteingustavo | 0:0dee8840a1c0 | 680 | uint8_t CAN_Sleep(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 681 | uint8_t CAN_WakeUp(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 682 | |
einsteingustavo | 0:0dee8840a1c0 | 683 | /* Error management functions *************************************************/ |
einsteingustavo | 0:0dee8840a1c0 | 684 | uint8_t CAN_GetLastErrorCode(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 685 | uint8_t CAN_GetReceiveErrorCounter(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 686 | uint8_t CAN_GetLSBTransmitErrorCounter(CAN_TypeDef* CANx); |
einsteingustavo | 0:0dee8840a1c0 | 687 | |
einsteingustavo | 0:0dee8840a1c0 | 688 | /* Interrupts and flags management functions **********************************/ |
einsteingustavo | 0:0dee8840a1c0 | 689 | void CAN_ITConfig(CAN_TypeDef* CANx, uint32_t CAN_IT, FunctionalState NewState); |
einsteingustavo | 0:0dee8840a1c0 | 690 | FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG); |
einsteingustavo | 0:0dee8840a1c0 | 691 | void CAN_ClearFlag(CAN_TypeDef* CANx, uint32_t CAN_FLAG); |
einsteingustavo | 0:0dee8840a1c0 | 692 | ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT); |
einsteingustavo | 0:0dee8840a1c0 | 693 | void CAN_ClearITPendingBit(CAN_TypeDef* CANx, uint32_t CAN_IT); |
einsteingustavo | 0:0dee8840a1c0 | 694 | |
einsteingustavo | 0:0dee8840a1c0 | 695 | #ifdef __cplusplus |
einsteingustavo | 0:0dee8840a1c0 | 696 | } |
einsteingustavo | 0:0dee8840a1c0 | 697 | #endif |
einsteingustavo | 0:0dee8840a1c0 | 698 | |
einsteingustavo | 0:0dee8840a1c0 | 699 | #endif /* __STM32F10x_CAN_H */ |
einsteingustavo | 0:0dee8840a1c0 | 700 | /** |
einsteingustavo | 0:0dee8840a1c0 | 701 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 702 | */ |
einsteingustavo | 0:0dee8840a1c0 | 703 | |
einsteingustavo | 0:0dee8840a1c0 | 704 | /** |
einsteingustavo | 0:0dee8840a1c0 | 705 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 706 | */ |
einsteingustavo | 0:0dee8840a1c0 | 707 | |
einsteingustavo | 0:0dee8840a1c0 | 708 | /** |
einsteingustavo | 0:0dee8840a1c0 | 709 | * @} |
einsteingustavo | 0:0dee8840a1c0 | 710 | */ |
einsteingustavo | 0:0dee8840a1c0 | 711 | |
einsteingustavo | 0:0dee8840a1c0 | 712 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
einsteingustavo | 0:0dee8840a1c0 | 713 |