STM32L486xx HAL User Manual
Functions
Initialization and de-initialization functions
SMARTCARD Exported Functions

Initialization and Configuration functions. More...

Functions

HAL_StatusTypeDef HAL_SMARTCARD_Init (SMARTCARD_HandleTypeDef *hsmartcard)
 Initialize the SMARTCARD mode according to the specified parameters in the SMARTCARD_HandleTypeDef and initialize the associated handle.
HAL_StatusTypeDef HAL_SMARTCARD_DeInit (SMARTCARD_HandleTypeDef *hsmartcard)
 DeInitialize the SMARTCARD peripheral.
__weak void HAL_SMARTCARD_MspInit (SMARTCARD_HandleTypeDef *hsmartcard)
 Initialize the SMARTCARD MSP.
__weak void HAL_SMARTCARD_MspDeInit (SMARTCARD_HandleTypeDef *hsmartcard)
 DeInitialize the SMARTCARD MSP.
HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback (SMARTCARD_HandleTypeDef *hsmartcard, 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 *hsmartcard, HAL_SMARTCARD_CallbackIDTypeDef CallbackID)
 Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback.

Detailed Description

Initialization and Configuration functions.

  ==============================================================================
              ##### Initialization and Configuration functions #####
  ==============================================================================
  [..]
  This subsection provides a set of functions allowing to initialize the USARTx
  associated to the SmartCard.
  (+) These parameters can be configured:
      (++) Baud Rate
      (++) Parity: parity should be enabled, frame Length is fixed to 8 bits plus parity
      (++) Receiver/transmitter modes
      (++) Synchronous mode (and if enabled, phase, polarity and last bit parameters)
      (++) Prescaler value
      (++) Guard bit time
      (++) NACK enabling or disabling on transmission error

  (+) The following advanced features can be configured as well:
      (++) TX and/or RX pin level inversion
      (++) data logical level inversion
      (++) RX and TX pins swap
      (++) RX overrun detection disabling
      (++) DMA disabling on RX error
      (++) MSB first on communication line
      (++) Time out enabling (and if activated, timeout value)
      (++) Block length
      (++) Auto-retry counter
  [..]
  The HAL_SMARTCARD_Init() API follows the USART synchronous configuration procedures
  (details for the procedures are available in reference manual).

The USART frame format is given in the following table:

Table 1. USART frame format. +---------------------------------------------------------------+ | M1M0 bits | PCE bit | USART frame | |-----------------------|---------------------------------------| | 01 | 1 | | SB | 8 bit data | PB | STB | | +---------------------------------------------------------------+


Function Documentation

HAL_StatusTypeDef HAL_SMARTCARD_DeInit ( SMARTCARD_HandleTypeDef hsmartcard)

DeInitialize the SMARTCARD peripheral.

Parameters:
hsmartcardPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for the specified SMARTCARD module.
Return values:
HALstatus

Definition at line 427 of file stm32l4xx_hal_smartcard.c.

References 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 hsmartcard)

Initialize the SMARTCARD mode according to the specified parameters in the SMARTCARD_HandleTypeDef and initialize the associated handle.

Parameters:
hsmartcardPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for the specified SMARTCARD module.
Return values:
HALstatus

Definition at line 354 of file stm32l4xx_hal_smartcard.c.

References __SMARTCARD_HandleTypeDef::AdvancedInit, SMARTCARD_AdvFeatureInitTypeDef::AdvFeatureInit, assert_param, __SMARTCARD_HandleTypeDef::gState, HAL_SMARTCARD_MspInit(), HAL_SMARTCARD_STATE_BUSY, HAL_SMARTCARD_STATE_RESET, __SMARTCARD_HandleTypeDef::Instance, __SMARTCARD_HandleTypeDef::Lock, __SMARTCARD_HandleTypeDef::MspInitCallback, SMARTCARD_ADVFEATURE_NO_INIT, SMARTCARD_AdvFeatureConfig(), SMARTCARD_CheckIdleState(), SMARTCARD_InitCallbacksToDefault(), SMARTCARD_SetConfig(), and SMARTCARD_TRANSMISSION_COMPLETION_SETTING.

DeInitialize the SMARTCARD MSP.

Parameters:
hsmartcardPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for the specified SMARTCARD module.
Return values:
None

Definition at line 493 of file stm32l4xx_hal_smartcard.c.

Referenced by HAL_SMARTCARD_DeInit(), and HAL_SMARTCARD_UnRegisterCallback().

Initialize the SMARTCARD MSP.

Parameters:
hsmartcardPointer to a SMARTCARD_HandleTypeDef structure that contains the configuration information for the specified SMARTCARD module.
Return values:
None

Definition at line 477 of file stm32l4xx_hal_smartcard.c.

Referenced by HAL_SMARTCARD_Init(), and HAL_SMARTCARD_UnRegisterCallback().

Register a User SMARTCARD Callback To be used instead of the weak predefined callback.

Parameters:
hsmartcardsmartcard handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
pCallbackpointer to the Callback function
Return values:
HALstatus

Definition at line 523 of file stm32l4xx_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_RX_FIFO_FULL_CB_ID, HAL_SMARTCARD_STATE_READY, HAL_SMARTCARD_STATE_RESET, HAL_SMARTCARD_TX_COMPLETE_CB_ID, HAL_SMARTCARD_TX_FIFO_EMPTY_CB_ID, __SMARTCARD_HandleTypeDef::MspDeInitCallback, __SMARTCARD_HandleTypeDef::MspInitCallback, __SMARTCARD_HandleTypeDef::RxCpltCallback, __SMARTCARD_HandleTypeDef::RxFifoFullCallback, __SMARTCARD_HandleTypeDef::TxCpltCallback, and __SMARTCARD_HandleTypeDef::TxFifoEmptyCallback.

Unregister an SMARTCARD callback SMARTCARD callback is redirected to the weak predefined callback.

Parameters:
hsmartcardsmartcard handle
CallbackIDID of the callback to be unregistered This parameter can be one of the following values:
Return values:
HALstatus

Definition at line 647 of file stm32l4xx_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_RX_FIFO_FULL_CB_ID, HAL_SMARTCARD_RxCpltCallback(), HAL_SMARTCARD_STATE_READY, HAL_SMARTCARD_STATE_RESET, HAL_SMARTCARD_TX_COMPLETE_CB_ID, HAL_SMARTCARD_TX_FIFO_EMPTY_CB_ID, HAL_SMARTCARD_TxCpltCallback(), __SMARTCARD_HandleTypeDef::MspDeInitCallback, __SMARTCARD_HandleTypeDef::MspInitCallback, __SMARTCARD_HandleTypeDef::RxCpltCallback, __SMARTCARD_HandleTypeDef::RxFifoFullCallback, __SMARTCARD_HandleTypeDef::TxCpltCallback, and __SMARTCARD_HandleTypeDef::TxFifoEmptyCallback.