Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_NUCLEO_F746ZG/stm32f7xx_hal_smartcard.h@115:87f2f5183dfb, 2016-03-02 (annotated)
- Committer:
- Kojto
- Date:
- Wed Mar 02 09:58:28 2016 +0100
- Revision:
- 115:87f2f5183dfb
- Child:
- 116:c0f6e94411f5
Release 115 of the mbed library
Changes:
- new targets - NUCLEO_F746ZG
- Bugfix - STM32F7 + STM32L4 - RTC init fix
- Bugfix - STM32L4 Set NVIC_RAM_VECTOR_ADDRESS to 0x10000000
- B96B_F446VE - CAN addition
- Changed target name from NZ32SC151 to NZ32_SC151
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 115:87f2f5183dfb | 1 | /** |
Kojto | 115:87f2f5183dfb | 2 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 3 | * @file stm32f7xx_hal_smartcard.h |
Kojto | 115:87f2f5183dfb | 4 | * @author MCD Application Team |
Kojto | 115:87f2f5183dfb | 5 | * @version V1.0.1 |
Kojto | 115:87f2f5183dfb | 6 | * @date 25-June-2015 |
Kojto | 115:87f2f5183dfb | 7 | * @brief Header file of SMARTCARD HAL module. |
Kojto | 115:87f2f5183dfb | 8 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 9 | * @attention |
Kojto | 115:87f2f5183dfb | 10 | * |
Kojto | 115:87f2f5183dfb | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 115:87f2f5183dfb | 12 | * |
Kojto | 115:87f2f5183dfb | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 115:87f2f5183dfb | 14 | * are permitted provided that the following conditions are met: |
Kojto | 115:87f2f5183dfb | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 115:87f2f5183dfb | 16 | * this list of conditions and the following disclaimer. |
Kojto | 115:87f2f5183dfb | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 115:87f2f5183dfb | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 115:87f2f5183dfb | 19 | * and/or other materials provided with the distribution. |
Kojto | 115:87f2f5183dfb | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 115:87f2f5183dfb | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 115:87f2f5183dfb | 22 | * without specific prior written permission. |
Kojto | 115:87f2f5183dfb | 23 | * |
Kojto | 115:87f2f5183dfb | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 115:87f2f5183dfb | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 115:87f2f5183dfb | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 115:87f2f5183dfb | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 115:87f2f5183dfb | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 115:87f2f5183dfb | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 115:87f2f5183dfb | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 115:87f2f5183dfb | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 115:87f2f5183dfb | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 115:87f2f5183dfb | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 115:87f2f5183dfb | 34 | * |
Kojto | 115:87f2f5183dfb | 35 | ****************************************************************************** |
Kojto | 115:87f2f5183dfb | 36 | */ |
Kojto | 115:87f2f5183dfb | 37 | |
Kojto | 115:87f2f5183dfb | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 39 | #ifndef __STM32F7xx_HAL_SMARTCARD_H |
Kojto | 115:87f2f5183dfb | 40 | #define __STM32F7xx_HAL_SMARTCARD_H |
Kojto | 115:87f2f5183dfb | 41 | |
Kojto | 115:87f2f5183dfb | 42 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 43 | extern "C" { |
Kojto | 115:87f2f5183dfb | 44 | #endif |
Kojto | 115:87f2f5183dfb | 45 | |
Kojto | 115:87f2f5183dfb | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 47 | #include "stm32f7xx_hal_def.h" |
Kojto | 115:87f2f5183dfb | 48 | |
Kojto | 115:87f2f5183dfb | 49 | /** @addtogroup STM32F7xx_HAL_Driver |
Kojto | 115:87f2f5183dfb | 50 | * @{ |
Kojto | 115:87f2f5183dfb | 51 | */ |
Kojto | 115:87f2f5183dfb | 52 | |
Kojto | 115:87f2f5183dfb | 53 | /** @addtogroup SMARTCARD |
Kojto | 115:87f2f5183dfb | 54 | * @{ |
Kojto | 115:87f2f5183dfb | 55 | */ |
Kojto | 115:87f2f5183dfb | 56 | |
Kojto | 115:87f2f5183dfb | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 58 | /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types |
Kojto | 115:87f2f5183dfb | 59 | * @{ |
Kojto | 115:87f2f5183dfb | 60 | */ |
Kojto | 115:87f2f5183dfb | 61 | |
Kojto | 115:87f2f5183dfb | 62 | /** |
Kojto | 115:87f2f5183dfb | 63 | * @brief SMARTCARD Init Structure definition |
Kojto | 115:87f2f5183dfb | 64 | */ |
Kojto | 115:87f2f5183dfb | 65 | typedef struct |
Kojto | 115:87f2f5183dfb | 66 | { |
Kojto | 115:87f2f5183dfb | 67 | uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate. |
Kojto | 115:87f2f5183dfb | 68 | The baud rate register is computed using the following formula: |
Kojto | 115:87f2f5183dfb | 69 | Baud Rate Register = ((PCLKx) / ((hsc->Init.BaudRate))) */ |
Kojto | 115:87f2f5183dfb | 70 | |
Kojto | 115:87f2f5183dfb | 71 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
Kojto | 115:87f2f5183dfb | 72 | This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */ |
Kojto | 115:87f2f5183dfb | 73 | |
Kojto | 115:87f2f5183dfb | 74 | uint32_t StopBits; /*!< Specifies the number of stop bits @ref SMARTCARD_Stop_Bits. |
Kojto | 115:87f2f5183dfb | 75 | Only 1.5 stop bits are authorized in SmartCard mode. */ |
Kojto | 115:87f2f5183dfb | 76 | |
Kojto | 115:87f2f5183dfb | 77 | uint32_t Parity; /*!< Specifies the parity mode. |
Kojto | 115:87f2f5183dfb | 78 | This parameter can be a value of @ref SMARTCARD_Parity |
Kojto | 115:87f2f5183dfb | 79 | @note The parity is enabled by default (PCE is forced to 1). |
Kojto | 115:87f2f5183dfb | 80 | Since the WordLength is forced to 8 bits + parity, M is |
Kojto | 115:87f2f5183dfb | 81 | forced to 1 and the parity bit is the 9th bit. */ |
Kojto | 115:87f2f5183dfb | 82 | |
Kojto | 115:87f2f5183dfb | 83 | uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
Kojto | 115:87f2f5183dfb | 84 | This parameter can be a value of @ref SMARTCARD_Mode */ |
Kojto | 115:87f2f5183dfb | 85 | |
Kojto | 115:87f2f5183dfb | 86 | uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
Kojto | 115:87f2f5183dfb | 87 | This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ |
Kojto | 115:87f2f5183dfb | 88 | |
Kojto | 115:87f2f5183dfb | 89 | uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
Kojto | 115:87f2f5183dfb | 90 | This parameter can be a value of @ref SMARTCARD_Clock_Phase */ |
Kojto | 115:87f2f5183dfb | 91 | |
Kojto | 115:87f2f5183dfb | 92 | uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
Kojto | 115:87f2f5183dfb | 93 | data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
Kojto | 115:87f2f5183dfb | 94 | This parameter can be a value of @ref SMARTCARD_Last_Bit */ |
Kojto | 115:87f2f5183dfb | 95 | |
Kojto | 115:87f2f5183dfb | 96 | uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
Kojto | 115:87f2f5183dfb | 97 | Selecting the single sample method increases the receiver tolerance to clock |
Kojto | 115:87f2f5183dfb | 98 | deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling */ |
Kojto | 115:87f2f5183dfb | 99 | |
Kojto | 115:87f2f5183dfb | 100 | uint32_t Prescaler; /*!< Specifies the SmartCard Prescaler */ |
Kojto | 115:87f2f5183dfb | 101 | |
Kojto | 115:87f2f5183dfb | 102 | uint32_t GuardTime; /*!< Specifies the SmartCard Guard Time */ |
Kojto | 115:87f2f5183dfb | 103 | |
Kojto | 115:87f2f5183dfb | 104 | uint32_t NACKState; /*!< Specifies whether the SmartCard NACK transmission is enabled |
Kojto | 115:87f2f5183dfb | 105 | in case of parity error. |
Kojto | 115:87f2f5183dfb | 106 | This parameter can be a value of @ref SMARTCARD_NACK_State */ |
Kojto | 115:87f2f5183dfb | 107 | |
Kojto | 115:87f2f5183dfb | 108 | uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled. |
Kojto | 115:87f2f5183dfb | 109 | This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/ |
Kojto | 115:87f2f5183dfb | 110 | |
Kojto | 115:87f2f5183dfb | 111 | uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks: |
Kojto | 115:87f2f5183dfb | 112 | it is used to implement the Character Wait Time (CWT) and |
Kojto | 115:87f2f5183dfb | 113 | Block Wait Time (BWT). It is coded over 24 bits. */ |
Kojto | 115:87f2f5183dfb | 114 | |
Kojto | 115:87f2f5183dfb | 115 | uint32_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode. |
Kojto | 115:87f2f5183dfb | 116 | This parameter can be any value from 0x0 to 0xFF */ |
Kojto | 115:87f2f5183dfb | 117 | |
Kojto | 115:87f2f5183dfb | 118 | uint32_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in |
Kojto | 115:87f2f5183dfb | 119 | receive and transmit mode). When set to 0, retransmission is |
Kojto | 115:87f2f5183dfb | 120 | disabled. Otherwise, its maximum value is 7 (before signalling |
Kojto | 115:87f2f5183dfb | 121 | an error) */ |
Kojto | 115:87f2f5183dfb | 122 | |
Kojto | 115:87f2f5183dfb | 123 | }SMARTCARD_InitTypeDef; |
Kojto | 115:87f2f5183dfb | 124 | |
Kojto | 115:87f2f5183dfb | 125 | /** |
Kojto | 115:87f2f5183dfb | 126 | * @brief SMARTCARD advanced features initalization structure definition |
Kojto | 115:87f2f5183dfb | 127 | */ |
Kojto | 115:87f2f5183dfb | 128 | typedef struct |
Kojto | 115:87f2f5183dfb | 129 | { |
Kojto | 115:87f2f5183dfb | 130 | uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several |
Kojto | 115:87f2f5183dfb | 131 | advanced features may be initialized at the same time. This parameter |
Kojto | 115:87f2f5183dfb | 132 | can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */ |
Kojto | 115:87f2f5183dfb | 133 | |
Kojto | 115:87f2f5183dfb | 134 | uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
Kojto | 115:87f2f5183dfb | 135 | This parameter can be a value of @ref SMARTCARD_Tx_Inv */ |
Kojto | 115:87f2f5183dfb | 136 | |
Kojto | 115:87f2f5183dfb | 137 | uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
Kojto | 115:87f2f5183dfb | 138 | This parameter can be a value of @ref SMARTCARD_Rx_Inv */ |
Kojto | 115:87f2f5183dfb | 139 | |
Kojto | 115:87f2f5183dfb | 140 | uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic |
Kojto | 115:87f2f5183dfb | 141 | vs negative/inverted logic). |
Kojto | 115:87f2f5183dfb | 142 | This parameter can be a value of @ref SMARTCARD_Data_Inv */ |
Kojto | 115:87f2f5183dfb | 143 | |
Kojto | 115:87f2f5183dfb | 144 | uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped. |
Kojto | 115:87f2f5183dfb | 145 | This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */ |
Kojto | 115:87f2f5183dfb | 146 | |
Kojto | 115:87f2f5183dfb | 147 | uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled. |
Kojto | 115:87f2f5183dfb | 148 | This parameter can be a value of @ref SMARTCARD_Overrun_Disable */ |
Kojto | 115:87f2f5183dfb | 149 | |
Kojto | 115:87f2f5183dfb | 150 | uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error. |
Kojto | 115:87f2f5183dfb | 151 | This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */ |
Kojto | 115:87f2f5183dfb | 152 | |
Kojto | 115:87f2f5183dfb | 153 | uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line. |
Kojto | 115:87f2f5183dfb | 154 | This parameter can be a value of @ref SMARTCARD_MSB_First */ |
Kojto | 115:87f2f5183dfb | 155 | }SMARTCARD_AdvFeatureInitTypeDef; |
Kojto | 115:87f2f5183dfb | 156 | |
Kojto | 115:87f2f5183dfb | 157 | /** |
Kojto | 115:87f2f5183dfb | 158 | * @brief HAL State structures definition |
Kojto | 115:87f2f5183dfb | 159 | */ |
Kojto | 115:87f2f5183dfb | 160 | typedef enum |
Kojto | 115:87f2f5183dfb | 161 | { |
Kojto | 115:87f2f5183dfb | 162 | HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */ |
Kojto | 115:87f2f5183dfb | 163 | HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 115:87f2f5183dfb | 164 | HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 115:87f2f5183dfb | 165 | HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 115:87f2f5183dfb | 166 | HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 167 | HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 115:87f2f5183dfb | 168 | HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 115:87f2f5183dfb | 169 | HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 115:87f2f5183dfb | 170 | }HAL_SMARTCARD_StateTypeDef; |
Kojto | 115:87f2f5183dfb | 171 | |
Kojto | 115:87f2f5183dfb | 172 | |
Kojto | 115:87f2f5183dfb | 173 | /** |
Kojto | 115:87f2f5183dfb | 174 | * @brief SMARTCARD clock sources definition |
Kojto | 115:87f2f5183dfb | 175 | */ |
Kojto | 115:87f2f5183dfb | 176 | typedef enum |
Kojto | 115:87f2f5183dfb | 177 | { |
Kojto | 115:87f2f5183dfb | 178 | SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */ |
Kojto | 115:87f2f5183dfb | 179 | SMARTCARD_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */ |
Kojto | 115:87f2f5183dfb | 180 | SMARTCARD_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */ |
Kojto | 115:87f2f5183dfb | 181 | SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */ |
Kojto | 115:87f2f5183dfb | 182 | SMARTCARD_CLOCKSOURCE_LSE = 0x08 /*!< LSE clock source */ |
Kojto | 115:87f2f5183dfb | 183 | }SMARTCARD_ClockSourceTypeDef; |
Kojto | 115:87f2f5183dfb | 184 | |
Kojto | 115:87f2f5183dfb | 185 | /** |
Kojto | 115:87f2f5183dfb | 186 | * @brief SMARTCARD handle Structure definition |
Kojto | 115:87f2f5183dfb | 187 | */ |
Kojto | 115:87f2f5183dfb | 188 | typedef struct |
Kojto | 115:87f2f5183dfb | 189 | { |
Kojto | 115:87f2f5183dfb | 190 | USART_TypeDef *Instance; /* USART registers base address */ |
Kojto | 115:87f2f5183dfb | 191 | |
Kojto | 115:87f2f5183dfb | 192 | SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */ |
Kojto | 115:87f2f5183dfb | 193 | |
Kojto | 115:87f2f5183dfb | 194 | SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /* SmartCard advanced features initialization parameters */ |
Kojto | 115:87f2f5183dfb | 195 | |
Kojto | 115:87f2f5183dfb | 196 | uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */ |
Kojto | 115:87f2f5183dfb | 197 | |
Kojto | 115:87f2f5183dfb | 198 | uint16_t TxXferSize; /* SmartCard Tx Transfer size */ |
Kojto | 115:87f2f5183dfb | 199 | |
Kojto | 115:87f2f5183dfb | 200 | uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */ |
Kojto | 115:87f2f5183dfb | 201 | |
Kojto | 115:87f2f5183dfb | 202 | uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */ |
Kojto | 115:87f2f5183dfb | 203 | |
Kojto | 115:87f2f5183dfb | 204 | uint16_t RxXferSize; /* SmartCard Rx Transfer size */ |
Kojto | 115:87f2f5183dfb | 205 | |
Kojto | 115:87f2f5183dfb | 206 | uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */ |
Kojto | 115:87f2f5183dfb | 207 | |
Kojto | 115:87f2f5183dfb | 208 | DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */ |
Kojto | 115:87f2f5183dfb | 209 | |
Kojto | 115:87f2f5183dfb | 210 | DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */ |
Kojto | 115:87f2f5183dfb | 211 | |
Kojto | 115:87f2f5183dfb | 212 | HAL_LockTypeDef Lock; /* Locking object */ |
Kojto | 115:87f2f5183dfb | 213 | |
Kojto | 115:87f2f5183dfb | 214 | __IO HAL_SMARTCARD_StateTypeDef State; /* SmartCard communication state */ |
Kojto | 115:87f2f5183dfb | 215 | |
Kojto | 115:87f2f5183dfb | 216 | __IO uint32_t ErrorCode; /* SmartCard Error code */ |
Kojto | 115:87f2f5183dfb | 217 | |
Kojto | 115:87f2f5183dfb | 218 | }SMARTCARD_HandleTypeDef; |
Kojto | 115:87f2f5183dfb | 219 | |
Kojto | 115:87f2f5183dfb | 220 | /** |
Kojto | 115:87f2f5183dfb | 221 | * @} |
Kojto | 115:87f2f5183dfb | 222 | */ |
Kojto | 115:87f2f5183dfb | 223 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 224 | /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants |
Kojto | 115:87f2f5183dfb | 225 | * @{ |
Kojto | 115:87f2f5183dfb | 226 | */ |
Kojto | 115:87f2f5183dfb | 227 | /** @defgroup SMARTCARD_Error_Code SMARTCARD Error Code |
Kojto | 115:87f2f5183dfb | 228 | * @brief SMARTCARD Error Code |
Kojto | 115:87f2f5183dfb | 229 | * @{ |
Kojto | 115:87f2f5183dfb | 230 | */ |
Kojto | 115:87f2f5183dfb | 231 | #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00) /*!< No error */ |
Kojto | 115:87f2f5183dfb | 232 | #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x01) /*!< Parity error */ |
Kojto | 115:87f2f5183dfb | 233 | #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x02) /*!< Noise error */ |
Kojto | 115:87f2f5183dfb | 234 | #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x04) /*!< frame error */ |
Kojto | 115:87f2f5183dfb | 235 | #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x08) /*!< Overrun error */ |
Kojto | 115:87f2f5183dfb | 236 | #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x10) /*!< DMA transfer error */ |
Kojto | 115:87f2f5183dfb | 237 | #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x20) /*!< Receiver TimeOut error */ |
Kojto | 115:87f2f5183dfb | 238 | /** |
Kojto | 115:87f2f5183dfb | 239 | * @} |
Kojto | 115:87f2f5183dfb | 240 | */ |
Kojto | 115:87f2f5183dfb | 241 | |
Kojto | 115:87f2f5183dfb | 242 | /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length |
Kojto | 115:87f2f5183dfb | 243 | * @{ |
Kojto | 115:87f2f5183dfb | 244 | */ |
Kojto | 115:87f2f5183dfb | 245 | #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0) |
Kojto | 115:87f2f5183dfb | 246 | /** |
Kojto | 115:87f2f5183dfb | 247 | * @} |
Kojto | 115:87f2f5183dfb | 248 | */ |
Kojto | 115:87f2f5183dfb | 249 | |
Kojto | 115:87f2f5183dfb | 250 | /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Number of Stop Bits |
Kojto | 115:87f2f5183dfb | 251 | * @{ |
Kojto | 115:87f2f5183dfb | 252 | */ |
Kojto | 115:87f2f5183dfb | 253 | #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP)) |
Kojto | 115:87f2f5183dfb | 254 | /** |
Kojto | 115:87f2f5183dfb | 255 | * @} |
Kojto | 115:87f2f5183dfb | 256 | */ |
Kojto | 115:87f2f5183dfb | 257 | |
Kojto | 115:87f2f5183dfb | 258 | /** @defgroup SMARTCARD_Parity SMARTCARD Parity |
Kojto | 115:87f2f5183dfb | 259 | * @{ |
Kojto | 115:87f2f5183dfb | 260 | */ |
Kojto | 115:87f2f5183dfb | 261 | #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE) |
Kojto | 115:87f2f5183dfb | 262 | #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) |
Kojto | 115:87f2f5183dfb | 263 | /** |
Kojto | 115:87f2f5183dfb | 264 | * @} |
Kojto | 115:87f2f5183dfb | 265 | */ |
Kojto | 115:87f2f5183dfb | 266 | |
Kojto | 115:87f2f5183dfb | 267 | /** @defgroup SMARTCARD_Mode SMARTCARD Mode |
Kojto | 115:87f2f5183dfb | 268 | * @{ |
Kojto | 115:87f2f5183dfb | 269 | */ |
Kojto | 115:87f2f5183dfb | 270 | #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE) |
Kojto | 115:87f2f5183dfb | 271 | #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE) |
Kojto | 115:87f2f5183dfb | 272 | #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) |
Kojto | 115:87f2f5183dfb | 273 | /** |
Kojto | 115:87f2f5183dfb | 274 | * @} |
Kojto | 115:87f2f5183dfb | 275 | */ |
Kojto | 115:87f2f5183dfb | 276 | |
Kojto | 115:87f2f5183dfb | 277 | /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity |
Kojto | 115:87f2f5183dfb | 278 | * @{ |
Kojto | 115:87f2f5183dfb | 279 | */ |
Kojto | 115:87f2f5183dfb | 280 | #define SMARTCARD_POLARITY_LOW ((uint32_t)0x0000) |
Kojto | 115:87f2f5183dfb | 281 | #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) |
Kojto | 115:87f2f5183dfb | 282 | /** |
Kojto | 115:87f2f5183dfb | 283 | * @} |
Kojto | 115:87f2f5183dfb | 284 | */ |
Kojto | 115:87f2f5183dfb | 285 | |
Kojto | 115:87f2f5183dfb | 286 | /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase |
Kojto | 115:87f2f5183dfb | 287 | * @{ |
Kojto | 115:87f2f5183dfb | 288 | */ |
Kojto | 115:87f2f5183dfb | 289 | #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x0000) |
Kojto | 115:87f2f5183dfb | 290 | #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) |
Kojto | 115:87f2f5183dfb | 291 | /** |
Kojto | 115:87f2f5183dfb | 292 | * @} |
Kojto | 115:87f2f5183dfb | 293 | */ |
Kojto | 115:87f2f5183dfb | 294 | |
Kojto | 115:87f2f5183dfb | 295 | /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit |
Kojto | 115:87f2f5183dfb | 296 | * @{ |
Kojto | 115:87f2f5183dfb | 297 | */ |
Kojto | 115:87f2f5183dfb | 298 | #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x0000) |
Kojto | 115:87f2f5183dfb | 299 | #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) |
Kojto | 115:87f2f5183dfb | 300 | /** |
Kojto | 115:87f2f5183dfb | 301 | * @} |
Kojto | 115:87f2f5183dfb | 302 | */ |
Kojto | 115:87f2f5183dfb | 303 | |
Kojto | 115:87f2f5183dfb | 304 | /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD OneBit Sampling |
Kojto | 115:87f2f5183dfb | 305 | * @{ |
Kojto | 115:87f2f5183dfb | 306 | */ |
Kojto | 115:87f2f5183dfb | 307 | #define SMARTCARD_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x0000) |
Kojto | 115:87f2f5183dfb | 308 | #define SMARTCARD_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) |
Kojto | 115:87f2f5183dfb | 309 | /** |
Kojto | 115:87f2f5183dfb | 310 | * @} |
Kojto | 115:87f2f5183dfb | 311 | */ |
Kojto | 115:87f2f5183dfb | 312 | |
Kojto | 115:87f2f5183dfb | 313 | |
Kojto | 115:87f2f5183dfb | 314 | /** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State |
Kojto | 115:87f2f5183dfb | 315 | * @{ |
Kojto | 115:87f2f5183dfb | 316 | */ |
Kojto | 115:87f2f5183dfb | 317 | #define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK) |
Kojto | 115:87f2f5183dfb | 318 | #define SMARTCARD_NACK_DISABLE ((uint32_t)0x0000) |
Kojto | 115:87f2f5183dfb | 319 | /** |
Kojto | 115:87f2f5183dfb | 320 | * @} |
Kojto | 115:87f2f5183dfb | 321 | */ |
Kojto | 115:87f2f5183dfb | 322 | |
Kojto | 115:87f2f5183dfb | 323 | /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable |
Kojto | 115:87f2f5183dfb | 324 | * @{ |
Kojto | 115:87f2f5183dfb | 325 | */ |
Kojto | 115:87f2f5183dfb | 326 | #define SMARTCARD_TIMEOUT_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 327 | #define SMARTCARD_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN) |
Kojto | 115:87f2f5183dfb | 328 | /** |
Kojto | 115:87f2f5183dfb | 329 | * @} |
Kojto | 115:87f2f5183dfb | 330 | */ |
Kojto | 115:87f2f5183dfb | 331 | |
Kojto | 115:87f2f5183dfb | 332 | /** @defgroup SMARTCARD_DMA_Requests SMARTCARD DMA requests |
Kojto | 115:87f2f5183dfb | 333 | * @{ |
Kojto | 115:87f2f5183dfb | 334 | */ |
Kojto | 115:87f2f5183dfb | 335 | |
Kojto | 115:87f2f5183dfb | 336 | #define SMARTCARD_DMAREQ_TX ((uint32_t)USART_CR3_DMAT) |
Kojto | 115:87f2f5183dfb | 337 | #define SMARTCARD_DMAREQ_RX ((uint32_t)USART_CR3_DMAR) |
Kojto | 115:87f2f5183dfb | 338 | |
Kojto | 115:87f2f5183dfb | 339 | /** |
Kojto | 115:87f2f5183dfb | 340 | * @} |
Kojto | 115:87f2f5183dfb | 341 | */ |
Kojto | 115:87f2f5183dfb | 342 | |
Kojto | 115:87f2f5183dfb | 343 | /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD Advanced Features Initialization Type |
Kojto | 115:87f2f5183dfb | 344 | * @{ |
Kojto | 115:87f2f5183dfb | 345 | */ |
Kojto | 115:87f2f5183dfb | 346 | #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 347 | #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001) |
Kojto | 115:87f2f5183dfb | 348 | #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002) |
Kojto | 115:87f2f5183dfb | 349 | #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004) |
Kojto | 115:87f2f5183dfb | 350 | #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008) |
Kojto | 115:87f2f5183dfb | 351 | #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010) |
Kojto | 115:87f2f5183dfb | 352 | #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020) |
Kojto | 115:87f2f5183dfb | 353 | #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080) |
Kojto | 115:87f2f5183dfb | 354 | /** |
Kojto | 115:87f2f5183dfb | 355 | * @} |
Kojto | 115:87f2f5183dfb | 356 | */ |
Kojto | 115:87f2f5183dfb | 357 | |
Kojto | 115:87f2f5183dfb | 358 | /** @defgroup SMARTCARD_Tx_Inv SMARTCARD Tx Inv |
Kojto | 115:87f2f5183dfb | 359 | * @{ |
Kojto | 115:87f2f5183dfb | 360 | */ |
Kojto | 115:87f2f5183dfb | 361 | #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 362 | #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) |
Kojto | 115:87f2f5183dfb | 363 | /** |
Kojto | 115:87f2f5183dfb | 364 | * @} |
Kojto | 115:87f2f5183dfb | 365 | */ |
Kojto | 115:87f2f5183dfb | 366 | |
Kojto | 115:87f2f5183dfb | 367 | /** @defgroup SMARTCARD_Rx_Inv SMARTCARD Rx Inv |
Kojto | 115:87f2f5183dfb | 368 | * @{ |
Kojto | 115:87f2f5183dfb | 369 | */ |
Kojto | 115:87f2f5183dfb | 370 | #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 371 | #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) |
Kojto | 115:87f2f5183dfb | 372 | /** |
Kojto | 115:87f2f5183dfb | 373 | * @} |
Kojto | 115:87f2f5183dfb | 374 | */ |
Kojto | 115:87f2f5183dfb | 375 | |
Kojto | 115:87f2f5183dfb | 376 | /** @defgroup SMARTCARD_Data_Inv SMARTCARD Data Inv |
Kojto | 115:87f2f5183dfb | 377 | * @{ |
Kojto | 115:87f2f5183dfb | 378 | */ |
Kojto | 115:87f2f5183dfb | 379 | #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 380 | #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) |
Kojto | 115:87f2f5183dfb | 381 | /** |
Kojto | 115:87f2f5183dfb | 382 | * @} |
Kojto | 115:87f2f5183dfb | 383 | */ |
Kojto | 115:87f2f5183dfb | 384 | |
Kojto | 115:87f2f5183dfb | 385 | /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD Rx Tx Swap |
Kojto | 115:87f2f5183dfb | 386 | * @{ |
Kojto | 115:87f2f5183dfb | 387 | */ |
Kojto | 115:87f2f5183dfb | 388 | #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 389 | #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) |
Kojto | 115:87f2f5183dfb | 390 | /** |
Kojto | 115:87f2f5183dfb | 391 | * @} |
Kojto | 115:87f2f5183dfb | 392 | */ |
Kojto | 115:87f2f5183dfb | 393 | |
Kojto | 115:87f2f5183dfb | 394 | /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD Overrun Disable |
Kojto | 115:87f2f5183dfb | 395 | * @{ |
Kojto | 115:87f2f5183dfb | 396 | */ |
Kojto | 115:87f2f5183dfb | 397 | #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 398 | #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) |
Kojto | 115:87f2f5183dfb | 399 | /** |
Kojto | 115:87f2f5183dfb | 400 | * @} |
Kojto | 115:87f2f5183dfb | 401 | */ |
Kojto | 115:87f2f5183dfb | 402 | |
Kojto | 115:87f2f5183dfb | 403 | /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD DMA Disable on Rx Error |
Kojto | 115:87f2f5183dfb | 404 | * @{ |
Kojto | 115:87f2f5183dfb | 405 | */ |
Kojto | 115:87f2f5183dfb | 406 | #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 407 | #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) |
Kojto | 115:87f2f5183dfb | 408 | /** |
Kojto | 115:87f2f5183dfb | 409 | * @} |
Kojto | 115:87f2f5183dfb | 410 | */ |
Kojto | 115:87f2f5183dfb | 411 | |
Kojto | 115:87f2f5183dfb | 412 | /** @defgroup SMARTCARD_MSB_First SMARTCARD MSB First |
Kojto | 115:87f2f5183dfb | 413 | * @{ |
Kojto | 115:87f2f5183dfb | 414 | */ |
Kojto | 115:87f2f5183dfb | 415 | #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000) |
Kojto | 115:87f2f5183dfb | 416 | #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) |
Kojto | 115:87f2f5183dfb | 417 | /** |
Kojto | 115:87f2f5183dfb | 418 | * @} |
Kojto | 115:87f2f5183dfb | 419 | */ |
Kojto | 115:87f2f5183dfb | 420 | |
Kojto | 115:87f2f5183dfb | 421 | /** @defgroup SmartCard_Flags SMARTCARD Flags |
Kojto | 115:87f2f5183dfb | 422 | * Elements values convention: 0xXXXX |
Kojto | 115:87f2f5183dfb | 423 | * - 0xXXXX : Flag mask in the ISR register |
Kojto | 115:87f2f5183dfb | 424 | * @{ |
Kojto | 115:87f2f5183dfb | 425 | */ |
Kojto | 115:87f2f5183dfb | 426 | #define SMARTCARD_FLAG_REACK ((uint32_t)0x00400000) |
Kojto | 115:87f2f5183dfb | 427 | #define SMARTCARD_FLAG_TEACK ((uint32_t)0x00200000) |
Kojto | 115:87f2f5183dfb | 428 | #define SMARTCARD_FLAG_BUSY ((uint32_t)0x00010000) |
Kojto | 115:87f2f5183dfb | 429 | #define SMARTCARD_FLAG_EOBF ((uint32_t)0x00001000) |
Kojto | 115:87f2f5183dfb | 430 | #define SMARTCARD_FLAG_RTOF ((uint32_t)0x00000800) |
Kojto | 115:87f2f5183dfb | 431 | #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080) |
Kojto | 115:87f2f5183dfb | 432 | #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040) |
Kojto | 115:87f2f5183dfb | 433 | #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020) |
Kojto | 115:87f2f5183dfb | 434 | #define SMARTCARD_FLAG_IDLE ((uint32_t)0x00000010) |
Kojto | 115:87f2f5183dfb | 435 | #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008) |
Kojto | 115:87f2f5183dfb | 436 | #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004) |
Kojto | 115:87f2f5183dfb | 437 | #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002) |
Kojto | 115:87f2f5183dfb | 438 | #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001) |
Kojto | 115:87f2f5183dfb | 439 | /** |
Kojto | 115:87f2f5183dfb | 440 | * @} |
Kojto | 115:87f2f5183dfb | 441 | */ |
Kojto | 115:87f2f5183dfb | 442 | |
Kojto | 115:87f2f5183dfb | 443 | /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupt definition |
Kojto | 115:87f2f5183dfb | 444 | * Elements values convention: 0000ZZZZ0XXYYYYYb |
Kojto | 115:87f2f5183dfb | 445 | * - YYYYY : Interrupt source position in the XX register (5bits) |
Kojto | 115:87f2f5183dfb | 446 | * - XX : Interrupt source register (2bits) |
Kojto | 115:87f2f5183dfb | 447 | * - 01: CR1 register |
Kojto | 115:87f2f5183dfb | 448 | * - 10: CR2 register |
Kojto | 115:87f2f5183dfb | 449 | * - 11: CR3 register |
Kojto | 115:87f2f5183dfb | 450 | * - ZZZZ : Flag position in the ISR register(4bits) |
Kojto | 115:87f2f5183dfb | 451 | * @{ |
Kojto | 115:87f2f5183dfb | 452 | */ |
Kojto | 115:87f2f5183dfb | 453 | |
Kojto | 115:87f2f5183dfb | 454 | #define SMARTCARD_IT_PE ((uint16_t)0x0028) |
Kojto | 115:87f2f5183dfb | 455 | #define SMARTCARD_IT_TXE ((uint16_t)0x0727) |
Kojto | 115:87f2f5183dfb | 456 | #define SMARTCARD_IT_TC ((uint16_t)0x0626) |
Kojto | 115:87f2f5183dfb | 457 | #define SMARTCARD_IT_RXNE ((uint16_t)0x0525) |
Kojto | 115:87f2f5183dfb | 458 | #define SMARTCARD_IT_IDLE ((uint16_t)0x0424) |
Kojto | 115:87f2f5183dfb | 459 | #define SMARTCARD_IT_ERR ((uint16_t)0x0060) |
Kojto | 115:87f2f5183dfb | 460 | #define SMARTCARD_IT_ORE ((uint16_t)0x0300) |
Kojto | 115:87f2f5183dfb | 461 | #define SMARTCARD_IT_NE ((uint16_t)0x0200) |
Kojto | 115:87f2f5183dfb | 462 | #define SMARTCARD_IT_FE ((uint16_t)0x0100) |
Kojto | 115:87f2f5183dfb | 463 | |
Kojto | 115:87f2f5183dfb | 464 | #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B) |
Kojto | 115:87f2f5183dfb | 465 | #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A) |
Kojto | 115:87f2f5183dfb | 466 | /** |
Kojto | 115:87f2f5183dfb | 467 | * @} |
Kojto | 115:87f2f5183dfb | 468 | */ |
Kojto | 115:87f2f5183dfb | 469 | |
Kojto | 115:87f2f5183dfb | 470 | |
Kojto | 115:87f2f5183dfb | 471 | /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD IT CLEAR Flags |
Kojto | 115:87f2f5183dfb | 472 | * @{ |
Kojto | 115:87f2f5183dfb | 473 | */ |
Kojto | 115:87f2f5183dfb | 474 | #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */ |
Kojto | 115:87f2f5183dfb | 475 | #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */ |
Kojto | 115:87f2f5183dfb | 476 | #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */ |
Kojto | 115:87f2f5183dfb | 477 | #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
Kojto | 115:87f2f5183dfb | 478 | #define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< Idle line detected clear Flag */ |
Kojto | 115:87f2f5183dfb | 479 | #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
Kojto | 115:87f2f5183dfb | 480 | #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */ |
Kojto | 115:87f2f5183dfb | 481 | #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */ |
Kojto | 115:87f2f5183dfb | 482 | /** |
Kojto | 115:87f2f5183dfb | 483 | * @} |
Kojto | 115:87f2f5183dfb | 484 | */ |
Kojto | 115:87f2f5183dfb | 485 | |
Kojto | 115:87f2f5183dfb | 486 | /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters |
Kojto | 115:87f2f5183dfb | 487 | * @{ |
Kojto | 115:87f2f5183dfb | 488 | */ |
Kojto | 115:87f2f5183dfb | 489 | #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */ |
Kojto | 115:87f2f5183dfb | 490 | #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */ |
Kojto | 115:87f2f5183dfb | 491 | /** |
Kojto | 115:87f2f5183dfb | 492 | * @} |
Kojto | 115:87f2f5183dfb | 493 | */ |
Kojto | 115:87f2f5183dfb | 494 | |
Kojto | 115:87f2f5183dfb | 495 | |
Kojto | 115:87f2f5183dfb | 496 | /** @defgroup SMARTCARD_CR3_SCAR_CNT_LSB_POS SMARTCARD CR3 SCAR CNT LSB POS |
Kojto | 115:87f2f5183dfb | 497 | * @{ |
Kojto | 115:87f2f5183dfb | 498 | */ |
Kojto | 115:87f2f5183dfb | 499 | #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17) |
Kojto | 115:87f2f5183dfb | 500 | /** |
Kojto | 115:87f2f5183dfb | 501 | * @} |
Kojto | 115:87f2f5183dfb | 502 | */ |
Kojto | 115:87f2f5183dfb | 503 | |
Kojto | 115:87f2f5183dfb | 504 | /** @defgroup SMARTCARD_GTPR_GT_LSBPOS SMARTCARD GTPR GT LSBPOS |
Kojto | 115:87f2f5183dfb | 505 | * @{ |
Kojto | 115:87f2f5183dfb | 506 | */ |
Kojto | 115:87f2f5183dfb | 507 | #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8) |
Kojto | 115:87f2f5183dfb | 508 | /** |
Kojto | 115:87f2f5183dfb | 509 | * @} |
Kojto | 115:87f2f5183dfb | 510 | */ |
Kojto | 115:87f2f5183dfb | 511 | |
Kojto | 115:87f2f5183dfb | 512 | /** @defgroup SMARTCARD_RTOR_BLEN_LSBPOS SMARTCARD RTOR BLEN LSBPOS |
Kojto | 115:87f2f5183dfb | 513 | * @{ |
Kojto | 115:87f2f5183dfb | 514 | */ |
Kojto | 115:87f2f5183dfb | 515 | #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24) |
Kojto | 115:87f2f5183dfb | 516 | /** |
Kojto | 115:87f2f5183dfb | 517 | * @} |
Kojto | 115:87f2f5183dfb | 518 | */ |
Kojto | 115:87f2f5183dfb | 519 | |
Kojto | 115:87f2f5183dfb | 520 | /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD Interruption Mask |
Kojto | 115:87f2f5183dfb | 521 | * @{ |
Kojto | 115:87f2f5183dfb | 522 | */ |
Kojto | 115:87f2f5183dfb | 523 | #define SMARTCARD_IT_MASK ((uint16_t)0x001F) |
Kojto | 115:87f2f5183dfb | 524 | /** |
Kojto | 115:87f2f5183dfb | 525 | * @} |
Kojto | 115:87f2f5183dfb | 526 | */ |
Kojto | 115:87f2f5183dfb | 527 | |
Kojto | 115:87f2f5183dfb | 528 | /** |
Kojto | 115:87f2f5183dfb | 529 | * @} |
Kojto | 115:87f2f5183dfb | 530 | */ |
Kojto | 115:87f2f5183dfb | 531 | |
Kojto | 115:87f2f5183dfb | 532 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 533 | /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros |
Kojto | 115:87f2f5183dfb | 534 | * @{ |
Kojto | 115:87f2f5183dfb | 535 | */ |
Kojto | 115:87f2f5183dfb | 536 | |
Kojto | 115:87f2f5183dfb | 537 | /** @brief Reset SMARTCARD handle state |
Kojto | 115:87f2f5183dfb | 538 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 539 | * The Handle Instance which can be USART1 or USART2 |
Kojto | 115:87f2f5183dfb | 540 | * @retval None |
Kojto | 115:87f2f5183dfb | 541 | */ |
Kojto | 115:87f2f5183dfb | 542 | #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET) |
Kojto | 115:87f2f5183dfb | 543 | |
Kojto | 115:87f2f5183dfb | 544 | /** @brief Flush the Smartcard DR register |
Kojto | 115:87f2f5183dfb | 545 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 546 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 547 | * @retval None |
Kojto | 115:87f2f5183dfb | 548 | */ |
Kojto | 115:87f2f5183dfb | 549 | #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) (__HAL_SMARTCARD_SEND_REQ((__HANDLE__), SMARTCARD_RXDATA_FLUSH_REQUEST)) |
Kojto | 115:87f2f5183dfb | 550 | |
Kojto | 115:87f2f5183dfb | 551 | /** @brief Checks whether the specified Smartcard flag is set or not. |
Kojto | 115:87f2f5183dfb | 552 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 553 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 554 | * @param __FLAG__: specifies the flag to check. |
Kojto | 115:87f2f5183dfb | 555 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 556 | * @arg SMARTCARD_FLAG_REACK: Receive enable acknowledge flag |
Kojto | 115:87f2f5183dfb | 557 | * @arg SMARTCARD_FLAG_TEACK: Transmit enable acknowledge flag |
Kojto | 115:87f2f5183dfb | 558 | * @arg SMARTCARD_FLAG_BUSY: Busy flag |
Kojto | 115:87f2f5183dfb | 559 | * @arg SMARTCARD_FLAG_EOBF: End of block flag |
Kojto | 115:87f2f5183dfb | 560 | * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag |
Kojto | 115:87f2f5183dfb | 561 | * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag |
Kojto | 115:87f2f5183dfb | 562 | * @arg SMARTCARD_FLAG_TC: Transmission Complete flag |
Kojto | 115:87f2f5183dfb | 563 | * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag |
Kojto | 115:87f2f5183dfb | 564 | * @arg SMARTCARD_FLAG_ORE: OverRun Error flag |
Kojto | 115:87f2f5183dfb | 565 | * @arg SMARTCARD_FLAG_NE: Noise Error flag |
Kojto | 115:87f2f5183dfb | 566 | * @arg SMARTCARD_FLAG_FE: Framing Error flag |
Kojto | 115:87f2f5183dfb | 567 | * @arg SMARTCARD_FLAG_PE: Parity Error flag |
Kojto | 115:87f2f5183dfb | 568 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 115:87f2f5183dfb | 569 | */ |
Kojto | 115:87f2f5183dfb | 570 | #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
Kojto | 115:87f2f5183dfb | 571 | |
Kojto | 115:87f2f5183dfb | 572 | /** @brief Enables the specified SmartCard interrupt. |
Kojto | 115:87f2f5183dfb | 573 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 574 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 575 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable. |
Kojto | 115:87f2f5183dfb | 576 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 577 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 115:87f2f5183dfb | 578 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 115:87f2f5183dfb | 579 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 115:87f2f5183dfb | 580 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 115:87f2f5183dfb | 581 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 115:87f2f5183dfb | 582 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 115:87f2f5183dfb | 583 | * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 115:87f2f5183dfb | 584 | * @retval None |
Kojto | 115:87f2f5183dfb | 585 | */ |
Kojto | 115:87f2f5183dfb | 586 | #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5) == 1)? ((__HANDLE__)->Instance->CR1 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 115:87f2f5183dfb | 587 | ((((uint8_t)(__INTERRUPT__)) >> 5) == 2)? ((__HANDLE__)->Instance->CR2 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 115:87f2f5183dfb | 588 | ((__HANDLE__)->Instance->CR3 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 115:87f2f5183dfb | 589 | /** @brief Disables the specified SmartCard interrupt. |
Kojto | 115:87f2f5183dfb | 590 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 591 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 592 | * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable. |
Kojto | 115:87f2f5183dfb | 593 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 594 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 115:87f2f5183dfb | 595 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 115:87f2f5183dfb | 596 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 115:87f2f5183dfb | 597 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 115:87f2f5183dfb | 598 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 115:87f2f5183dfb | 599 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 115:87f2f5183dfb | 600 | * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) |
Kojto | 115:87f2f5183dfb | 601 | * @retval None |
Kojto | 115:87f2f5183dfb | 602 | */ |
Kojto | 115:87f2f5183dfb | 603 | #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 115:87f2f5183dfb | 604 | ((((uint8_t)(__INTERRUPT__)) >> 5) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
Kojto | 115:87f2f5183dfb | 605 | ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
Kojto | 115:87f2f5183dfb | 606 | |
Kojto | 115:87f2f5183dfb | 607 | /** @brief Checks whether the specified SmartCard interrupt has occurred or not. |
Kojto | 115:87f2f5183dfb | 608 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 609 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 610 | * @param __IT__: specifies the SMARTCARD interrupt to check. |
Kojto | 115:87f2f5183dfb | 611 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 612 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 115:87f2f5183dfb | 613 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 115:87f2f5183dfb | 614 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 115:87f2f5183dfb | 615 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 115:87f2f5183dfb | 616 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 115:87f2f5183dfb | 617 | * @arg SMARTCARD_IT_ORE: OverRun Error interrupt |
Kojto | 115:87f2f5183dfb | 618 | * @arg SMARTCARD_IT_NE: Noise Error interrupt |
Kojto | 115:87f2f5183dfb | 619 | * @arg SMARTCARD_IT_FE: Framing Error interrupt |
Kojto | 115:87f2f5183dfb | 620 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 115:87f2f5183dfb | 621 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 115:87f2f5183dfb | 622 | */ |
Kojto | 115:87f2f5183dfb | 623 | #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08))) |
Kojto | 115:87f2f5183dfb | 624 | |
Kojto | 115:87f2f5183dfb | 625 | /** @brief Checks whether the specified SmartCard interrupt interrupt source is enabled. |
Kojto | 115:87f2f5183dfb | 626 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 627 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 628 | * @param __IT__: specifies the SMARTCARD interrupt source to check. |
Kojto | 115:87f2f5183dfb | 629 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 630 | * @arg SMARTCARD_IT_EOBF: End Of Block interrupt |
Kojto | 115:87f2f5183dfb | 631 | * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt |
Kojto | 115:87f2f5183dfb | 632 | * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt |
Kojto | 115:87f2f5183dfb | 633 | * @arg SMARTCARD_IT_TC: Transmission complete interrupt |
Kojto | 115:87f2f5183dfb | 634 | * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt |
Kojto | 115:87f2f5183dfb | 635 | * @arg SMARTCARD_IT_ORE: OverRun Error interrupt |
Kojto | 115:87f2f5183dfb | 636 | * @arg SMARTCARD_IT_NE: Noise Error interrupt |
Kojto | 115:87f2f5183dfb | 637 | * @arg SMARTCARD_IT_FE: Framing Error interrupt |
Kojto | 115:87f2f5183dfb | 638 | * @arg SMARTCARD_IT_PE: Parity Error interrupt |
Kojto | 115:87f2f5183dfb | 639 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 115:87f2f5183dfb | 640 | */ |
Kojto | 115:87f2f5183dfb | 641 | #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \ |
Kojto | 115:87f2f5183dfb | 642 | (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \ |
Kojto | 115:87f2f5183dfb | 643 | (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK))) |
Kojto | 115:87f2f5183dfb | 644 | |
Kojto | 115:87f2f5183dfb | 645 | |
Kojto | 115:87f2f5183dfb | 646 | /** @brief Clears the specified SMARTCARD ISR flag, in setting the proper ICR register flag. |
Kojto | 115:87f2f5183dfb | 647 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 648 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 649 | * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set |
Kojto | 115:87f2f5183dfb | 650 | * to clear the corresponding interrupt |
Kojto | 115:87f2f5183dfb | 651 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 652 | * @arg USART_CLEAR_PEF: Parity Error Clear Flag |
Kojto | 115:87f2f5183dfb | 653 | * @arg USART_CLEAR_FEF: Framing Error Clear Flag |
Kojto | 115:87f2f5183dfb | 654 | * @arg USART_CLEAR_NEF: Noise detected Clear Flag |
Kojto | 115:87f2f5183dfb | 655 | * @arg USART_CLEAR_OREF: OverRun Error Clear Flag |
Kojto | 115:87f2f5183dfb | 656 | * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag |
Kojto | 115:87f2f5183dfb | 657 | * @arg USART_CLEAR_RTOF: Receiver Time Out Clear Flag |
Kojto | 115:87f2f5183dfb | 658 | * @arg USART_CLEAR_EOBF: End Of Block Clear Flag |
Kojto | 115:87f2f5183dfb | 659 | * @retval None |
Kojto | 115:87f2f5183dfb | 660 | */ |
Kojto | 115:87f2f5183dfb | 661 | #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
Kojto | 115:87f2f5183dfb | 662 | |
Kojto | 115:87f2f5183dfb | 663 | /** @brief Set a specific SMARTCARD request flag. |
Kojto | 115:87f2f5183dfb | 664 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 665 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 666 | * @param __REQ__: specifies the request flag to set |
Kojto | 115:87f2f5183dfb | 667 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 668 | * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive Data flush Request |
Kojto | 115:87f2f5183dfb | 669 | * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request |
Kojto | 115:87f2f5183dfb | 670 | * |
Kojto | 115:87f2f5183dfb | 671 | * @retval None |
Kojto | 115:87f2f5183dfb | 672 | */ |
Kojto | 115:87f2f5183dfb | 673 | #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__)) |
Kojto | 115:87f2f5183dfb | 674 | |
Kojto | 115:87f2f5183dfb | 675 | /** @brief Enable the USART associated to the SMARTCARD Handle |
Kojto | 115:87f2f5183dfb | 676 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 677 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 678 | * @retval None |
Kojto | 115:87f2f5183dfb | 679 | */ |
Kojto | 115:87f2f5183dfb | 680 | #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
Kojto | 115:87f2f5183dfb | 681 | |
Kojto | 115:87f2f5183dfb | 682 | /** @brief Disable the USART associated to the SMARTCARD Handle |
Kojto | 115:87f2f5183dfb | 683 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 684 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 685 | * @retval None |
Kojto | 115:87f2f5183dfb | 686 | */ |
Kojto | 115:87f2f5183dfb | 687 | #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
Kojto | 115:87f2f5183dfb | 688 | |
Kojto | 115:87f2f5183dfb | 689 | /** @brief Macros to enable or disable the SmartCard DMA request. |
Kojto | 115:87f2f5183dfb | 690 | * @param __HANDLE__: specifies the SMARTCARD Handle. |
Kojto | 115:87f2f5183dfb | 691 | * The Handle Instance which can be USART1 or USART2. |
Kojto | 115:87f2f5183dfb | 692 | * @param __REQUEST__: specifies the SmartCard DMA request. |
Kojto | 115:87f2f5183dfb | 693 | * This parameter can be one of the following values: |
Kojto | 115:87f2f5183dfb | 694 | * @arg SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request |
Kojto | 115:87f2f5183dfb | 695 | * @arg SMARTCARD_DMAREQ_RX: SmartCard DMA receive request |
Kojto | 115:87f2f5183dfb | 696 | */ |
Kojto | 115:87f2f5183dfb | 697 | #define __HAL_SMARTCARD_DMA_REQUEST_ENABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 |= (__REQUEST__)) |
Kojto | 115:87f2f5183dfb | 698 | #define __HAL_SMARTCARD_DMA_REQUEST_DISABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 &= ~(__REQUEST__)) |
Kojto | 115:87f2f5183dfb | 699 | /** |
Kojto | 115:87f2f5183dfb | 700 | * @} |
Kojto | 115:87f2f5183dfb | 701 | */ |
Kojto | 115:87f2f5183dfb | 702 | |
Kojto | 115:87f2f5183dfb | 703 | /* Include SMARTCARD HAL Extension module */ |
Kojto | 115:87f2f5183dfb | 704 | #include "stm32f7xx_hal_smartcard_ex.h" |
Kojto | 115:87f2f5183dfb | 705 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 706 | /** @addtogroup SMARTCARD_Exported_Functions |
Kojto | 115:87f2f5183dfb | 707 | * @{ |
Kojto | 115:87f2f5183dfb | 708 | */ |
Kojto | 115:87f2f5183dfb | 709 | |
Kojto | 115:87f2f5183dfb | 710 | /** @addtogroup SMARTCARD_Exported_Functions_Group1 |
Kojto | 115:87f2f5183dfb | 711 | * @{ |
Kojto | 115:87f2f5183dfb | 712 | */ |
Kojto | 115:87f2f5183dfb | 713 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 115:87f2f5183dfb | 714 | HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 715 | HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 716 | void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 717 | void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 718 | /** |
Kojto | 115:87f2f5183dfb | 719 | * @} |
Kojto | 115:87f2f5183dfb | 720 | */ |
Kojto | 115:87f2f5183dfb | 721 | |
Kojto | 115:87f2f5183dfb | 722 | /** @addtogroup SMARTCARD_Exported_Functions_Group2 |
Kojto | 115:87f2f5183dfb | 723 | * @{ |
Kojto | 115:87f2f5183dfb | 724 | */ |
Kojto | 115:87f2f5183dfb | 725 | /* IO operation functions *******************************************************/ |
Kojto | 115:87f2f5183dfb | 726 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 727 | HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 115:87f2f5183dfb | 728 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 729 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 730 | HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 731 | HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); |
Kojto | 115:87f2f5183dfb | 732 | void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 733 | void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 734 | void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 735 | void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 736 | /** |
Kojto | 115:87f2f5183dfb | 737 | * @} |
Kojto | 115:87f2f5183dfb | 738 | */ |
Kojto | 115:87f2f5183dfb | 739 | |
Kojto | 115:87f2f5183dfb | 740 | /** @addtogroup SMARTCARD_Exported_Functions_Group3 |
Kojto | 115:87f2f5183dfb | 741 | * @{ |
Kojto | 115:87f2f5183dfb | 742 | */ |
Kojto | 115:87f2f5183dfb | 743 | /* Peripheral State functions **************************************************/ |
Kojto | 115:87f2f5183dfb | 744 | HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 745 | uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsc); |
Kojto | 115:87f2f5183dfb | 746 | |
Kojto | 115:87f2f5183dfb | 747 | /** |
Kojto | 115:87f2f5183dfb | 748 | * @} |
Kojto | 115:87f2f5183dfb | 749 | */ |
Kojto | 115:87f2f5183dfb | 750 | |
Kojto | 115:87f2f5183dfb | 751 | /** |
Kojto | 115:87f2f5183dfb | 752 | * @} |
Kojto | 115:87f2f5183dfb | 753 | */ |
Kojto | 115:87f2f5183dfb | 754 | /* Private types -------------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 755 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 756 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 757 | /** @defgroup SMARTCARD_Private_Constants SMARTCARD Private Constants |
Kojto | 115:87f2f5183dfb | 758 | * @{ |
Kojto | 115:87f2f5183dfb | 759 | */ |
Kojto | 115:87f2f5183dfb | 760 | |
Kojto | 115:87f2f5183dfb | 761 | #define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B) |
Kojto | 115:87f2f5183dfb | 762 | #define IS_SMARTCARD_STOPBITS(__STOPBITS__) ((__STOPBITS__) == SMARTCARD_STOPBITS_1_5) |
Kojto | 115:87f2f5183dfb | 763 | #define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \ |
Kojto | 115:87f2f5183dfb | 764 | ((__PARITY__) == SMARTCARD_PARITY_ODD)) |
Kojto | 115:87f2f5183dfb | 765 | #define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & (uint32_t)0xFFF3) == 0x00) && ((__MODE__) != (uint32_t)0x00)) |
Kojto | 115:87f2f5183dfb | 766 | #define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW) || ((__CPOL__) == SMARTCARD_POLARITY_HIGH)) |
Kojto | 115:87f2f5183dfb | 767 | #define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE)) |
Kojto | 115:87f2f5183dfb | 768 | #define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 769 | ((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE)) |
Kojto | 115:87f2f5183dfb | 770 | #define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 771 | ((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE)) |
Kojto | 115:87f2f5183dfb | 772 | #define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \ |
Kojto | 115:87f2f5183dfb | 773 | ((__NACK__) == SMARTCARD_NACK_DISABLE)) |
Kojto | 115:87f2f5183dfb | 774 | #define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 775 | ((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE)) |
Kojto | 115:87f2f5183dfb | 776 | #define IS_SMARTCARD_ADVFEATURE_INIT(INIT) ((INIT) <= (SMARTCARD_ADVFEATURE_NO_INIT | \ |
Kojto | 115:87f2f5183dfb | 777 | SMARTCARD_ADVFEATURE_TXINVERT_INIT | \ |
Kojto | 115:87f2f5183dfb | 778 | SMARTCARD_ADVFEATURE_RXINVERT_INIT | \ |
Kojto | 115:87f2f5183dfb | 779 | SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \ |
Kojto | 115:87f2f5183dfb | 780 | SMARTCARD_ADVFEATURE_SWAP_INIT | \ |
Kojto | 115:87f2f5183dfb | 781 | SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \ |
Kojto | 115:87f2f5183dfb | 782 | SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \ |
Kojto | 115:87f2f5183dfb | 783 | SMARTCARD_ADVFEATURE_MSBFIRST_INIT)) |
Kojto | 115:87f2f5183dfb | 784 | #define IS_SMARTCARD_ADVFEATURE_TXINV(TXINV) (((TXINV) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 785 | ((TXINV) == SMARTCARD_ADVFEATURE_TXINV_ENABLE)) |
Kojto | 115:87f2f5183dfb | 786 | #define IS_SMARTCARD_ADVFEATURE_RXINV(RXINV) (((RXINV) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 787 | ((RXINV) == SMARTCARD_ADVFEATURE_RXINV_ENABLE)) |
Kojto | 115:87f2f5183dfb | 788 | #define IS_SMARTCARD_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 789 | ((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE)) |
Kojto | 115:87f2f5183dfb | 790 | #define IS_SMARTCARD_ADVFEATURE_SWAP(SWAP) (((SWAP) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 791 | ((SWAP) == SMARTCARD_ADVFEATURE_SWAP_ENABLE)) |
Kojto | 115:87f2f5183dfb | 792 | #define IS_SMARTCARD_OVERRUN(OVERRUN) (((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \ |
Kojto | 115:87f2f5183dfb | 793 | ((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE)) |
Kojto | 115:87f2f5183dfb | 794 | #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \ |
Kojto | 115:87f2f5183dfb | 795 | ((DMA) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR)) |
Kojto | 115:87f2f5183dfb | 796 | #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001) |
Kojto | 115:87f2f5183dfb | 797 | #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF) |
Kojto | 115:87f2f5183dfb | 798 | #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF) |
Kojto | 115:87f2f5183dfb | 799 | #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7) |
Kojto | 115:87f2f5183dfb | 800 | #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \ |
Kojto | 115:87f2f5183dfb | 801 | ((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE)) |
Kojto | 115:87f2f5183dfb | 802 | #define IS_SMARTCARD_REQUEST_PARAMETER(PARAM) (((PARAM) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \ |
Kojto | 115:87f2f5183dfb | 803 | ((PARAM) == SMARTCARD_TXDATA_FLUSH_REQUEST)) |
Kojto | 115:87f2f5183dfb | 804 | |
Kojto | 115:87f2f5183dfb | 805 | |
Kojto | 115:87f2f5183dfb | 806 | /** |
Kojto | 115:87f2f5183dfb | 807 | * @} |
Kojto | 115:87f2f5183dfb | 808 | */ |
Kojto | 115:87f2f5183dfb | 809 | |
Kojto | 115:87f2f5183dfb | 810 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 115:87f2f5183dfb | 811 | /** @defgroup SMARTCARD_Private_Functions SMARTCARD Private Functions |
Kojto | 115:87f2f5183dfb | 812 | * @{ |
Kojto | 115:87f2f5183dfb | 813 | */ |
Kojto | 115:87f2f5183dfb | 814 | |
Kojto | 115:87f2f5183dfb | 815 | /** |
Kojto | 115:87f2f5183dfb | 816 | * @} |
Kojto | 115:87f2f5183dfb | 817 | */ |
Kojto | 115:87f2f5183dfb | 818 | |
Kojto | 115:87f2f5183dfb | 819 | /** |
Kojto | 115:87f2f5183dfb | 820 | * @} |
Kojto | 115:87f2f5183dfb | 821 | */ |
Kojto | 115:87f2f5183dfb | 822 | |
Kojto | 115:87f2f5183dfb | 823 | /** |
Kojto | 115:87f2f5183dfb | 824 | * @} |
Kojto | 115:87f2f5183dfb | 825 | */ |
Kojto | 115:87f2f5183dfb | 826 | |
Kojto | 115:87f2f5183dfb | 827 | #ifdef __cplusplus |
Kojto | 115:87f2f5183dfb | 828 | } |
Kojto | 115:87f2f5183dfb | 829 | #endif |
Kojto | 115:87f2f5183dfb | 830 | |
Kojto | 115:87f2f5183dfb | 831 | #endif /* __STM32F7xx_HAL_SMARTCARD_H */ |
Kojto | 115:87f2f5183dfb | 832 | |
Kojto | 115:87f2f5183dfb | 833 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |