It is a door opener with mbed and Felica(RFID).
Dependencies: mbed Servo SDFileSystem
RCS620S.h@6:9fe8caff6142, 2012-05-15 (annotated)
- Committer:
- ryought
- Date:
- Tue May 15 07:47:19 2012 +0000
- Revision:
- 6:9fe8caff6142
FINAL
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryought | 6:9fe8caff6142 | 1 | /* |
ryought | 6:9fe8caff6142 | 2 | * RC-S620/S sample library for Arduino |
ryought | 6:9fe8caff6142 | 3 | * |
ryought | 6:9fe8caff6142 | 4 | * Copyright 2010 Sony Corporation |
ryought | 6:9fe8caff6142 | 5 | * |
ryought | 6:9fe8caff6142 | 6 | * Rewrite for mbed |
ryought | 6:9fe8caff6142 | 7 | * |
ryought | 6:9fe8caff6142 | 8 | * modified by SWITCHSCIENCE |
ryought | 6:9fe8caff6142 | 9 | * |
ryought | 6:9fe8caff6142 | 10 | */ |
ryought | 6:9fe8caff6142 | 11 | |
ryought | 6:9fe8caff6142 | 12 | #include "mbed.h" |
ryought | 6:9fe8caff6142 | 13 | #include <inttypes.h> |
ryought | 6:9fe8caff6142 | 14 | |
ryought | 6:9fe8caff6142 | 15 | #ifndef RCS620S_H_ |
ryought | 6:9fe8caff6142 | 16 | #define RCS620S_H_ |
ryought | 6:9fe8caff6142 | 17 | |
ryought | 6:9fe8caff6142 | 18 | /* -------------------------------- |
ryought | 6:9fe8caff6142 | 19 | * Constant |
ryought | 6:9fe8caff6142 | 20 | * -------------------------------- */ |
ryought | 6:9fe8caff6142 | 21 | |
ryought | 6:9fe8caff6142 | 22 | #define RCS620S_MAX_CARD_RESPONSE_LEN 254 |
ryought | 6:9fe8caff6142 | 23 | #define RCS620S_MAX_RW_RESPONSE_LEN 265 |
ryought | 6:9fe8caff6142 | 24 | |
ryought | 6:9fe8caff6142 | 25 | /* -------------------------------- |
ryought | 6:9fe8caff6142 | 26 | * Class Declaration |
ryought | 6:9fe8caff6142 | 27 | * -------------------------------- */ |
ryought | 6:9fe8caff6142 | 28 | |
ryought | 6:9fe8caff6142 | 29 | class RCS620S |
ryought | 6:9fe8caff6142 | 30 | { |
ryought | 6:9fe8caff6142 | 31 | public: |
ryought | 6:9fe8caff6142 | 32 | RCS620S(); |
ryought | 6:9fe8caff6142 | 33 | |
ryought | 6:9fe8caff6142 | 34 | int initDevice(void); |
ryought | 6:9fe8caff6142 | 35 | int polling(uint16_t systemCode = 0xffff); |
ryought | 6:9fe8caff6142 | 36 | int cardCommand( |
ryought | 6:9fe8caff6142 | 37 | const uint8_t* command, |
ryought | 6:9fe8caff6142 | 38 | uint8_t commandLen, |
ryought | 6:9fe8caff6142 | 39 | uint8_t response[RCS620S_MAX_CARD_RESPONSE_LEN], |
ryought | 6:9fe8caff6142 | 40 | uint8_t* responseLen); |
ryought | 6:9fe8caff6142 | 41 | int rfOff(void); |
ryought | 6:9fe8caff6142 | 42 | |
ryought | 6:9fe8caff6142 | 43 | int push( |
ryought | 6:9fe8caff6142 | 44 | const uint8_t* data, |
ryought | 6:9fe8caff6142 | 45 | uint8_t dataLen); |
ryought | 6:9fe8caff6142 | 46 | |
ryought | 6:9fe8caff6142 | 47 | private: |
ryought | 6:9fe8caff6142 | 48 | int rwCommand( |
ryought | 6:9fe8caff6142 | 49 | const uint8_t* command, |
ryought | 6:9fe8caff6142 | 50 | uint16_t commandLen, |
ryought | 6:9fe8caff6142 | 51 | uint8_t response[RCS620S_MAX_RW_RESPONSE_LEN], |
ryought | 6:9fe8caff6142 | 52 | uint16_t* responseLen); |
ryought | 6:9fe8caff6142 | 53 | void cancel(void); |
ryought | 6:9fe8caff6142 | 54 | uint8_t calcDCS( |
ryought | 6:9fe8caff6142 | 55 | const uint8_t* data, |
ryought | 6:9fe8caff6142 | 56 | uint16_t len); |
ryought | 6:9fe8caff6142 | 57 | |
ryought | 6:9fe8caff6142 | 58 | void writeSerial( |
ryought | 6:9fe8caff6142 | 59 | const uint8_t* data, |
ryought | 6:9fe8caff6142 | 60 | uint16_t len); |
ryought | 6:9fe8caff6142 | 61 | int readSerial( |
ryought | 6:9fe8caff6142 | 62 | uint8_t* data, |
ryought | 6:9fe8caff6142 | 63 | uint16_t len); |
ryought | 6:9fe8caff6142 | 64 | void flushSerial(void); |
ryought | 6:9fe8caff6142 | 65 | |
ryought | 6:9fe8caff6142 | 66 | int checkTimeout(time_t t0); |
ryought | 6:9fe8caff6142 | 67 | |
ryought | 6:9fe8caff6142 | 68 | public: |
ryought | 6:9fe8caff6142 | 69 | time_t timeout; |
ryought | 6:9fe8caff6142 | 70 | uint8_t idm[8]; |
ryought | 6:9fe8caff6142 | 71 | uint8_t pmm[8]; |
ryought | 6:9fe8caff6142 | 72 | }; |
ryought | 6:9fe8caff6142 | 73 | |
ryought | 6:9fe8caff6142 | 74 | #endif /* !RCS620S_H_ */ |