STM32F103xB HAL User Manual
|
Initialization and Configuration functions. More...
Functions | |
HAL_StatusTypeDef | HAL_SMARTCARD_Init (SMARTCARD_HandleTypeDef *hsc) |
Initializes the SmartCard mode according to the specified parameters in the SMARTCARD_InitTypeDef and create the associated handle. | |
HAL_StatusTypeDef | HAL_SMARTCARD_DeInit (SMARTCARD_HandleTypeDef *hsc) |
DeInitializes the USART SmartCard peripheral. | |
__weak void | HAL_SMARTCARD_MspInit (SMARTCARD_HandleTypeDef *hsc) |
SMARTCARD MSP Init. | |
__weak void | HAL_SMARTCARD_MspDeInit (SMARTCARD_HandleTypeDef *hsc) |
SMARTCARD MSP DeInit. | |
HAL_StatusTypeDef | HAL_SMARTCARD_RegisterCallback (SMARTCARD_HandleTypeDef *hsc, HAL_SMARTCARD_CallbackIDTypeDef CallbackID, pSMARTCARD_CallbackTypeDef pCallback) |
Register a User SMARTCARD Callback To be used instead of the weak predefined callback. | |
HAL_StatusTypeDef | HAL_SMARTCARD_UnRegisterCallback (SMARTCARD_HandleTypeDef *hsc, HAL_SMARTCARD_CallbackIDTypeDef CallbackID) |
Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback. | |
HAL_StatusTypeDef | HAL_SMARTCARD_ReInit (SMARTCARD_HandleTypeDef *hsc) |
Initialization and Configuration functions.
============================================================================== ##### Initialization and Configuration functions ##### ============================================================================== [..] This subsection provides a set of functions allowing to initialize the USART in Smartcard mode. [..] The Smartcard interface is designed to support asynchronous protocol Smartcards as defined in the ISO 7816-3 standard. [..] The USART can provide a clock to the smartcard through the SCLK output. In smartcard mode, SCLK is not associated to the communication but is simply derived from the internal peripheral input clock through a 5-bit prescaler. [..] (+) For the Smartcard mode only these parameters can be configured: (++) Baud Rate (++) Word Length => Should be 9 bits (8 bits + parity) (++) Stop Bit (++) Parity: => Should be enabled (++) USART polarity (++) USART phase (++) USART LastBit (++) Receiver/transmitter modes (++) Prescaler (++) GuardTime (++) NACKState: The Smartcard NACK state (+) Recommended SmartCard interface configuration to get the Answer to Reset from the Card: (++) Word Length = 9 Bits (++) 1.5 Stop Bit (++) Even parity (++) BaudRate = 12096 baud (++) Tx and Rx enabled [..] Please refer to the ISO 7816-3 specification for more details. [..] (@) It is also possible to choose 0.5 stop bit for receiving but it is recommended to use 1.5 stop bits for both transmitting and receiving to avoid switching between the two configurations. [..] The HAL_SMARTCARD_Init() function follows the USART SmartCard configuration procedures (details for the procedures are available in reference manuals (RM0008 for STM32F10Xxx MCUs and RM0041 for STM32F100xx MCUs)).
The SMARTCARD frame format is given in the following table: +-------------------------------------------------------------+ | M bit | PCE bit | SMARTCARD frame | |---------------------|---------------------------------------| | 1 | 1 | | SB | 8 bit data | PB | STB | | +-------------------------------------------------------------+
HAL_StatusTypeDef HAL_SMARTCARD_DeInit | ( | SMARTCARD_HandleTypeDef * | hsc | ) |
DeInitializes the USART SmartCard peripheral.
hsc | Pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. |
HAL | status |
Definition at line 375 of file stm32f1xx_hal_smartcard.c.
References __HAL_SMARTCARD_DISABLE, assert_param, __SMARTCARD_HandleTypeDef::ErrorCode, __SMARTCARD_HandleTypeDef::gState, HAL_SMARTCARD_ERROR_NONE, HAL_SMARTCARD_MspDeInit(), HAL_SMARTCARD_STATE_BUSY, HAL_SMARTCARD_STATE_RESET, __SMARTCARD_HandleTypeDef::Instance, __SMARTCARD_HandleTypeDef::MspDeInitCallback, and __SMARTCARD_HandleTypeDef::RxState.
HAL_StatusTypeDef HAL_SMARTCARD_Init | ( | SMARTCARD_HandleTypeDef * | hsc | ) |
Initializes the SmartCard mode according to the specified parameters in the SMARTCARD_InitTypeDef and create the associated handle.
hsc | Pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. |
HAL | status |
Definition at line 296 of file stm32f1xx_hal_smartcard.c.
References __HAL_SMARTCARD_ENABLE, assert_param, __SMARTCARD_HandleTypeDef::ErrorCode, __SMARTCARD_HandleTypeDef::gState, SMARTCARD_InitTypeDef::GuardTime, HAL_SMARTCARD_ERROR_NONE, HAL_SMARTCARD_MspInit(), HAL_SMARTCARD_STATE_BUSY, HAL_SMARTCARD_STATE_READY, HAL_SMARTCARD_STATE_RESET, __SMARTCARD_HandleTypeDef::Init, __SMARTCARD_HandleTypeDef::Instance, IS_SMARTCARD_NACK_STATE, __SMARTCARD_HandleTypeDef::Lock, __SMARTCARD_HandleTypeDef::MspInitCallback, SMARTCARD_InitTypeDef::NACKState, SMARTCARD_InitTypeDef::Prescaler, __SMARTCARD_HandleTypeDef::RxState, SMARTCARD_InitCallbacksToDefault(), and SMARTCARD_SetConfig().
void HAL_SMARTCARD_MspDeInit | ( | SMARTCARD_HandleTypeDef * | hsc | ) |
SMARTCARD MSP DeInit.
hsc | Pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. |
None |
Definition at line 435 of file stm32f1xx_hal_smartcard.c.
Referenced by HAL_SMARTCARD_DeInit(), and HAL_SMARTCARD_UnRegisterCallback().
void HAL_SMARTCARD_MspInit | ( | SMARTCARD_HandleTypeDef * | hsc | ) |
SMARTCARD MSP Init.
hsc | Pointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for SMARTCARD module. |
None |
Definition at line 419 of file stm32f1xx_hal_smartcard.c.
Referenced by HAL_SMARTCARD_Init(), and HAL_SMARTCARD_UnRegisterCallback().
HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback | ( | SMARTCARD_HandleTypeDef * | hsc, |
HAL_SMARTCARD_CallbackIDTypeDef | CallbackID, | ||
pSMARTCARD_CallbackTypeDef | pCallback | ||
) |
Register a User SMARTCARD Callback To be used instead of the weak predefined callback.
hsc | smartcard handle |
CallbackID | ID of the callback to be registered This parameter can be one of the following values:
|
pCallback | pointer to the Callback function |
HAL | status |
Definition at line 463 of file stm32f1xx_hal_smartcard.c.
References __SMARTCARD_HandleTypeDef::AbortCpltCallback, __SMARTCARD_HandleTypeDef::AbortReceiveCpltCallback, __SMARTCARD_HandleTypeDef::AbortTransmitCpltCallback, __SMARTCARD_HandleTypeDef::ErrorCallback, __SMARTCARD_HandleTypeDef::ErrorCode, __SMARTCARD_HandleTypeDef::gState, HAL_SMARTCARD_ABORT_COMPLETE_CB_ID, HAL_SMARTCARD_ABORT_RECEIVE_COMPLETE_CB_ID, HAL_SMARTCARD_ABORT_TRANSMIT_COMPLETE_CB_ID, HAL_SMARTCARD_ERROR_CB_ID, HAL_SMARTCARD_ERROR_INVALID_CALLBACK, HAL_SMARTCARD_MSPDEINIT_CB_ID, HAL_SMARTCARD_MSPINIT_CB_ID, HAL_SMARTCARD_RX_COMPLETE_CB_ID, HAL_SMARTCARD_STATE_READY, HAL_SMARTCARD_STATE_RESET, HAL_SMARTCARD_TX_COMPLETE_CB_ID, __SMARTCARD_HandleTypeDef::MspDeInitCallback, __SMARTCARD_HandleTypeDef::MspInitCallback, __SMARTCARD_HandleTypeDef::RxCpltCallback, and __SMARTCARD_HandleTypeDef::TxCpltCallback.
HAL_StatusTypeDef HAL_SMARTCARD_ReInit | ( | SMARTCARD_HandleTypeDef * | hsc | ) |
HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback | ( | SMARTCARD_HandleTypeDef * | hsc, |
HAL_SMARTCARD_CallbackIDTypeDef | CallbackID | ||
) |
Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback.
hsc | smartcard handle |
CallbackID | ID of the callback to be unregistered This parameter can be one of the following values:
|
HAL | status |
Definition at line 576 of file stm32f1xx_hal_smartcard.c.
References __SMARTCARD_HandleTypeDef::AbortCpltCallback, __SMARTCARD_HandleTypeDef::AbortReceiveCpltCallback, __SMARTCARD_HandleTypeDef::AbortTransmitCpltCallback, __SMARTCARD_HandleTypeDef::ErrorCallback, __SMARTCARD_HandleTypeDef::ErrorCode, __SMARTCARD_HandleTypeDef::gState, HAL_SMARTCARD_ABORT_COMPLETE_CB_ID, HAL_SMARTCARD_ABORT_RECEIVE_COMPLETE_CB_ID, HAL_SMARTCARD_ABORT_TRANSMIT_COMPLETE_CB_ID, HAL_SMARTCARD_AbortCpltCallback(), HAL_SMARTCARD_AbortReceiveCpltCallback(), HAL_SMARTCARD_AbortTransmitCpltCallback(), HAL_SMARTCARD_ERROR_CB_ID, HAL_SMARTCARD_ERROR_INVALID_CALLBACK, HAL_SMARTCARD_ErrorCallback(), HAL_SMARTCARD_MspDeInit(), HAL_SMARTCARD_MSPDEINIT_CB_ID, HAL_SMARTCARD_MspInit(), HAL_SMARTCARD_MSPINIT_CB_ID, HAL_SMARTCARD_RX_COMPLETE_CB_ID, HAL_SMARTCARD_RxCpltCallback(), HAL_SMARTCARD_STATE_READY, HAL_SMARTCARD_STATE_RESET, HAL_SMARTCARD_TX_COMPLETE_CB_ID, HAL_SMARTCARD_TxCpltCallback(), __SMARTCARD_HandleTypeDef::MspDeInitCallback, __SMARTCARD_HandleTypeDef::MspInitCallback, __SMARTCARD_HandleTypeDef::RxCpltCallback, and __SMARTCARD_HandleTypeDef::TxCpltCallback.