libsle4442
0.2-5
|
Bit banging driver to SLE4442. More...
#include <stdint.h>
#include <stdlib.h>
#include <avr/io.h>
#include <util/delay.h>
#include "sle_bbg.h"
Functions | |
void | ck_pulse (void) |
void | set_io (const uint8_t io) |
void | send_start (void) |
void | send_stop (void) |
uint8_t | read_byte (void) |
void | send_byte (uint8_t byte) |
void | send_rst (uint8_t *atr) |
void | send_cmd (const uint8_t control, const uint8_t address, const uint8_t data) |
uint8_t | processing (void) |
Bit banging driver to SLE4442.
Low level bit banging driver to read and write to Sle4442 card.
void ck_pulse | ( | void | ) |
Single clock pulse.
This function generates a single clock cycle onto the clock line.
uint8_t processing | ( | void | ) |
Wait for the card to process the command.
uint8_t read_byte | ( | void | ) |
Read a byte from IO line.
The function geneates 8 clock pulse cycle and on each of them a bit is read from the IO line.
void send_byte | ( | uint8_t | byte | ) |
Write a byte to the IO line.
The function write a byte a singe bit at a time, the bit is written on the 0 phase of the ck line, see datasheet.
byte | the byte to be sent. |
void send_cmd | ( | const uint8_t | control, |
const uint8_t | address, | ||
const uint8_t | data | ||
) |
Send a complete command sequence.
control | the control byte. |
address | the address byte. |
data | the data byte. |
void send_rst | ( | uint8_t * | atr | ) |
Send the reset (rst) sequence to the card.
See datasheet for details on the RST sequence.
*atr | ptr to mem area where this function stores the 4 byte ATR returned after the RST. |
void send_start | ( | void | ) |
Send the START sequence.
void send_stop | ( | void | ) |
Send the STOP sequence.
void set_io | ( | const uint8_t | io | ) |
Set's I/O line to one of: IN, OUT, 0 or 1.
IN: The port is in input, the subsequent call with: 0 - Disable internal pull-up resistor. 1 - Enable internal pull-up resistor.
OUT: The port in in output mode, the subsequent call with: 0 - Line is logic 0 (GND). 1 - Line is logic 1 (+5V).
io | can be 0, 1, IN, OUT |