smartcard2 2.1.0.0
Smart Card 2 Click Driver

API for configuring and manipulating Smart Card 2 Click driver. More...

Topics

 Smart Card 2 Device Settings
 Settings for registers of Smart Card 2 Click driver.
 
 Smart Card 2 MikroBUS Map
 MikroBUS pin mapping of Smart Card 2 Click driver.
 

Functions

void smartcard2_cfg_setup (smartcard2_cfg_t *cfg)
 Smart Card 2 configuration object setup function.
 
err_t smartcard2_init (smartcard2_t *ctx, smartcard2_cfg_t *cfg)
 Smart Card 2 initialization function.
 
err_t smartcard2_generic_write (smartcard2_t *ctx, char *data_in, uint16_t len)
 Smart Card 2 data writing function.
 
err_t smartcard2_generic_read (smartcard2_t *ctx, char *data_out, uint16_t len)
 Smart Card 2 data reading function.
 
void smartcard2_enable_device (smartcard2_t *ctx)
 Smart Card 2 enable device function.
 
void smartcard2_disable_device (smartcard2_t *ctx)
 Smart Card 2 disable device function.
 
err_t smartcard2_send_ccid (smartcard2_t *ctx, smartcard2_ccid_t *data_in)
 Smart Card 2 send ccid function.
 
err_t smartcard2_read_ccid (smartcard2_t *ctx, smartcard2_ccid_t *data_out)
 Smart Card 2 read ccid function.
 
err_t smartcard2_icc_power_on (smartcard2_t *ctx, uint8_t power_sel)
 Smart Card 2 icc power on function.
 
err_t smartcard2_icc_power_off (smartcard2_t *ctx)
 Smart Card 2 icc power off function.
 
err_t smartcard2_get_slot_status (smartcard2_t *ctx)
 Smart Card 2 get slot status function.
 

Detailed Description

API for configuring and manipulating Smart Card 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ smartcard2_cfg_setup()

void smartcard2_cfg_setup ( smartcard2_cfg_t * cfg)

Smart Card 2 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See smartcard2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ smartcard2_disable_device()

void smartcard2_disable_device ( smartcard2_t * ctx)

Smart Card 2 disable device function.

This function disables device by setting the RST pin to high logic state.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ smartcard2_enable_device()

void smartcard2_enable_device ( smartcard2_t * ctx)

Smart Card 2 enable device function.

This function enables device by setting the RST pin to low logic state.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ smartcard2_generic_read()

err_t smartcard2_generic_read ( smartcard2_t * ctx,
char * data_out,
uint16_t len )

Smart Card 2 data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_generic_write()

err_t smartcard2_generic_write ( smartcard2_t * ctx,
char * data_in,
uint16_t len )

Smart Card 2 data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_get_slot_status()

err_t smartcard2_get_slot_status ( smartcard2_t * ctx)

Smart Card 2 get slot status function.

This function performs a get slot status command. The device will respond with a slot status message.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error - wrong parameter. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_icc_power_off()

err_t smartcard2_icc_power_off ( smartcard2_t * ctx)

Smart Card 2 icc power off function.

This function deactivates the card by performing an ICC power OFF command. The device will respond with a slot status message.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error - wrong parameter. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_icc_power_on()

err_t smartcard2_icc_power_on ( smartcard2_t * ctx,
uint8_t power_sel )

Smart Card 2 icc power on function.

This function activates the card by performing an ICC power ON command. The device will respond with a data block containing ICC ATR (Answer to Reset) message.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[in]power_sel: Power selection:
  • 0 - Auto,
  • 1 - 5V,
  • 2 - 3V,
  • 3 - 1.8V.
Returns
  • 0 - Success,
  • -1 - Error - wrong parameter. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_init()

err_t smartcard2_init ( smartcard2_t * ctx,
smartcard2_cfg_t * cfg )

Smart Card 2 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See smartcard2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_read_ccid()

err_t smartcard2_read_ccid ( smartcard2_t * ctx,
smartcard2_ccid_t * data_out )

Smart Card 2 read ccid function.

This function reads a CCID response or event message by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[out]data_out: CCID response message. See smartcard2_ccid_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error - wrong parameter,
  • -2 - Error - read,
  • -3 - Error - checksum,
  • -4 - Error - timeout. See #err_t definition for detailed explanation.
Note
None.

◆ smartcard2_send_ccid()

err_t smartcard2_send_ccid ( smartcard2_t * ctx,
smartcard2_ccid_t * data_in )

Smart Card 2 send ccid function.

This function sends the CCID command message by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartcard2_t object definition for detailed explanation.
[in]data_in: CCID command message. See smartcard2_ccid_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error - wrong parameter, See #err_t definition for detailed explanation.
Note
None.