Ryota Hanyu / Mbed 2 deprecated RC-S620_test

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RCS620S.h Source File

RCS620S.h

00001 /*
00002  * RC-S620/S sample library for Arduino
00003  *
00004  * Copyright 2010 Sony Corporation
00005  *
00006  * Rewrite for mbed
00007  *
00008  * modified by SWITCHSCIENCE
00009  * 
00010  */
00011 
00012 #include "mbed.h"
00013 #include <inttypes.h>
00014 
00015 #ifndef RCS620S_H_
00016 #define RCS620S_H_
00017 
00018 /* --------------------------------
00019  * Constant
00020  * -------------------------------- */
00021 
00022 #define RCS620S_MAX_CARD_RESPONSE_LEN    254
00023 #define RCS620S_MAX_RW_RESPONSE_LEN      265
00024 
00025 /* --------------------------------
00026  * Class Declaration
00027  * -------------------------------- */
00028 
00029 class RCS620S
00030 {
00031 public:
00032     RCS620S();
00033 
00034     int initDevice(void);
00035     int polling(uint16_t systemCode = 0xffff);
00036     int cardCommand(
00037         const uint8_t* command,
00038         uint8_t commandLen,
00039         uint8_t response[RCS620S_MAX_CARD_RESPONSE_LEN],
00040         uint8_t* responseLen);
00041     int rfOff(void);
00042 
00043     int push(
00044         const uint8_t* data,
00045         uint8_t dataLen);
00046 
00047 private:
00048     int rwCommand(
00049         const uint8_t* command,
00050         uint16_t commandLen,
00051         uint8_t response[RCS620S_MAX_RW_RESPONSE_LEN],
00052         uint16_t* responseLen);
00053     void cancel(void);
00054     uint8_t calcDCS(
00055         const uint8_t* data,
00056         uint16_t len);
00057 
00058     void writeSerial(
00059         const uint8_t* data,
00060         uint16_t len);
00061     int readSerial(
00062         uint8_t* data,
00063         uint16_t len);
00064     void flushSerial(void);
00065 
00066     int checkTimeout(time_t t0);
00067 
00068 public:
00069     time_t timeout;
00070     uint8_t idm[8];
00071     uint8_t pmm[8];
00072 };
00073 
00074 #endif /* !RCS620S_H_ */