smartcard2 2.1.0.0
smartcard2.h File Reference

This file contains API for Smart Card 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  smartcard2_ccid_t
 Smart Card 2 Click context object. More...
 
struct  smartcard2_t
 Smart Card 2 Click context object. More...
 
struct  smartcard2_cfg_t
 Smart Card 2 Click configuration object. More...
 

Macros

#define SMARTCARD2_CMD_ICC_POWER_ON   0x62
 Smart Card 2 command pipe, bulk-out commands.
 
#define SMARTCARD2_CMD_ICC_POWER_OFF   0x63
 
#define SMARTCARD2_CMD_GET_SLOT_STATUS   0x65
 
#define SMARTCARD2_CMD_XFR_BLOCK   0x6F
 
#define SMARTCARD2_CMD_GET_PARAMETERS   0x6C
 
#define SMARTCARD2_CMD_RESET_PARAMETERS   0x6D
 
#define SMARTCARD2_CMD_SET_PARAMETERS   0x61
 
#define SMARTCARD2_CMD_ESCAPE   0x6B
 
#define SMARTCARD2_CMD_ICC_ESCAPE   0x6E
 
#define SMARTCARD2_CMD_T0_APDU   0x6A
 
#define SMARTCARD2_CMD_SECURE   0x69
 
#define SMARTCARD2_CMD_MECHANICAL   0x71
 
#define SMARTCARD2_CMD_ABORT   0x72
 
#define SMARTCARD2_CMD_SET_DATA_RATE_CLK_FREQ   0x73
 
#define SMARTCARD2_RSP_DATA_BLOCK   0x80
 Smart Card 2 response pipe, bulk-in messages.
 
#define SMARTCARD2_RSP_SLOT_STATUS   0x81
 
#define SMARTCARD2_RSP_PARAMETERS   0x82
 
#define SMARTCARD2_RSP_ESCAPE   0x83
 
#define SMARTCARD2_RSP_DATA_RATE_CLK_FREQ   0x84
 
#define SMARTCARD2_EVT_NOTIFY_SLOT_CHANGE   0x50
 Smart Card 2 interrupt-in messages.
 
#define SMARTCARD2_CARD_ABSENT   0x02
 
#define SMARTCARD2_CARD_PRESENT   0x03
 
#define SMARTCARD2_EVT_HARDWARE_ERROR   0x51
 
#define SMARTCARD2_OVERCURRENT   0x01
 
#define SMARTCARD2_SYNC   0x03
 Smart Card 2 ccid message settings.
 
#define SMARTCARD2_CTRL_ACK   0x06
 
#define SMARTCARD2_CTRL_NACK   0x15
 
#define SMARTCARD2_SHORT_APDU_MAX_SIZE   261
 
#define SMARTCARD2_MAX_BUF_SIZE   ( SMARTCARD2_SHORT_APDU_MAX_SIZE + 13 )
 
#define SMARTCARD2_TIMEOUT_MS   5000
 
#define SMARTCARD2_CLK_STATUS_RUNNING   0x00
 Smart Card 2 clock status bytes.
 
#define SMARTCARD2_CLK_STATUS_STATE_L   0x01
 
#define SMARTCARD2_CLK_STATUS_STATE_H   0x02
 
#define SMARTCARD2_POWER_SEL_AUTO   0x00
 Smart Card 2 power select bytes.
 
#define SMARTCARD2_POWER_SEL_5V   0x01
 
#define SMARTCARD2_POWER_SEL_3V   0x02
 
#define SMARTCARD2_POWER_SEL_1_8V   0x03
 
#define SMARTCARD2_ICC_ACTIVE   0
 Smart Card 2 ICC status setting.
 
#define SMARTCARD2_ICC_PRESENT   1
 
#define SMARTCARD2_ICC_ABSENT   2
 
#define SMARTCARD2_ICC_STATUS_MASK   0x03
 
#define SMARTCARD2_TX_DRV_BUFFER_SIZE   SMARTCARD2_MAX_BUF_SIZE
 Smart Card 2 driver buffer size.
 
#define SMARTCARD2_RX_DRV_BUFFER_SIZE   ( SMARTCARD2_MAX_BUF_SIZE * 2 )
 
#define SMARTCARD2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  smartcard2_return_value_t {
  SMARTCARD2_OK = 0 , SMARTCARD2_ERROR = -1 , SMARTCARD2_READ_ERROR = -2 , SMARTCARD2_CHECKSUM_ERROR = -3 ,
  SMARTCARD2_TIMEOUT_ERROR = -4
}
 Smart Card 2 Click return value data. More...
 

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

This file contains API for Smart Card 2 Click Driver.

Enumeration Type Documentation

◆ smartcard2_return_value_t

Smart Card 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
SMARTCARD2_OK 
SMARTCARD2_ERROR 
SMARTCARD2_READ_ERROR 
SMARTCARD2_CHECKSUM_ERROR 
SMARTCARD2_TIMEOUT_ERROR