SmartCard reader. PC is interface through USB or TCPport. SmartCard is interfaced through UART@ 1MHz, DIV372
Dependencies: EthernetNetIf mbed
Diff: SmartCardReader.h
- Revision:
- 0:5bf6fcf71548
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SmartCardReader.h Sun Feb 27 22:20:40 2011 +0000 @@ -0,0 +1,43 @@ +#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(); + +}; + + +