It is a door opener with mbed and Felica(RFID).
Dependencies: mbed Servo SDFileSystem
Diff: RCS620S.h
- Revision:
- 6:9fe8caff6142
diff -r 4242d287f7f4 -r 9fe8caff6142 RCS620S.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RCS620S.h Tue May 15 07:47:19 2012 +0000 @@ -0,0 +1,74 @@ +/* + * RC-S620/S sample library for Arduino + * + * Copyright 2010 Sony Corporation + * + * Rewrite for mbed + * + * modified by SWITCHSCIENCE + * + */ + +#include "mbed.h" +#include <inttypes.h> + +#ifndef RCS620S_H_ +#define RCS620S_H_ + +/* -------------------------------- + * Constant + * -------------------------------- */ + +#define RCS620S_MAX_CARD_RESPONSE_LEN 254 +#define RCS620S_MAX_RW_RESPONSE_LEN 265 + +/* -------------------------------- + * Class Declaration + * -------------------------------- */ + +class RCS620S +{ +public: + RCS620S(); + + int initDevice(void); + int polling(uint16_t systemCode = 0xffff); + int cardCommand( + const uint8_t* command, + uint8_t commandLen, + uint8_t response[RCS620S_MAX_CARD_RESPONSE_LEN], + uint8_t* responseLen); + int rfOff(void); + + int push( + const uint8_t* data, + uint8_t dataLen); + +private: + int rwCommand( + const uint8_t* command, + uint16_t commandLen, + uint8_t response[RCS620S_MAX_RW_RESPONSE_LEN], + uint16_t* responseLen); + void cancel(void); + uint8_t calcDCS( + const uint8_t* data, + uint16_t len); + + void writeSerial( + const uint8_t* data, + uint16_t len); + int readSerial( + uint8_t* data, + uint16_t len); + void flushSerial(void); + + int checkTimeout(time_t t0); + +public: + time_t timeout; + uint8_t idm[8]; + uint8_t pmm[8]; +}; + +#endif /* !RCS620S_H_ */ \ No newline at end of file