Generic driver for the RWD RFID Modules from IB Technology.

Dependents:   RSEDP_DPDemo

Revision:
0:a893227b988a
Child:
1:e96aaf4d5c55
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RWDModule.h	Mon Jul 12 09:31:45 2010 +0000
@@ -0,0 +1,55 @@
+
+#ifndef RWD_MODULE_H
+#define RWD_MODULE_H
+
+#include "mbed.h"
+
+typedef unsigned char byte;
+
+class RWDModule
+{
+public:
+  RWDModule(PinName tx, PinName rx, PinName cts);
+  virtual ~RWDModule();
+  
+  
+//protected:
+  void command(byte cmd, const byte* params, int paramsLen, byte* resp, int respLen, byte ackOk, byte ackOkMask); //Ack Byte is not included in the resp buf
+  
+  bool ready(); //Rady for a command / response is available
+  
+  bool result(byte* pAck = NULL);
+
+private:
+  void intClearToSend();
+  void intTx();
+  void intRx();
+
+  Serial m_serial;
+  InterruptIn m_cts;  
+  
+//  byte m_buf[64];
+  byte m_cmd;
+  byte* m_paramsBuf;
+  byte* m_respBuf;
+  int m_pos;
+  int m_paramsLen;
+  int m_respLen;
+    
+  byte m_ackOk;
+  byte m_ackOkMask;
+  
+  byte m_ack;
+  
+  enum
+  {
+    READY,
+    CMD_QUEUED,
+    SENDING_CMD,
+    WAITING_FOR_ACK,
+    RECEIVING_ACK
+  } m_state;
+
+};
+
+#endif