SmartCard reader. PC is interface through USB or TCPport. SmartCard is interfaced through UART@ 1MHz, DIV372

Dependencies:   EthernetNetIf mbed

SmartCardReader.h

Committer:
bcalin1984
Date:
2011-02-27
Revision:
0:5bf6fcf71548

File content as of revision 0:5bf6fcf71548:

#include "mbed.h"
class SmartCardReader
{
    int freq;
    int divfact;
    char format[4];
    int BytesToIgnore;
    
    #define ReceiveBufferLen 1024
    char ReceiveBuffer[ReceiveBufferLen];
    int ReceiveBufferIndex;
    
    //void (*onReceiveFromDut)(char* buf, int len);
    Timer tim;
    
    Serial *dut;
    DigitalOut *rst;
    DigitalOut *vcc;
    PwmOut *clk;

    public: 
    SmartCardReader(Serial *_dut, DigitalOut *_vcc, DigitalOut *_rst,PwmOut *_clock, char *_format);
    void setClock(int Hz);
    void cold_reset();
    void warm_reset();
    void doEvents();
    
    void send(char *buf, int len);
    int receive(char *buf);
    
    /*
    void SetReceivePcCallback(void (*f)(char*buf, int len))
    {
        onReceiveFromDut = f;
    }*/
    
    private : 
    void Relay_PC_SC();
    
};