Dependencies:   mbed

Committer:
nucho
Date:
Mon Aug 01 14:45:42 2011 +0000
Revision:
1:ab3c75cf5906
Parent:
0:a70ea71286b6

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 0:a70ea71286b6 1 /*******************************************
nucho 0:a70ea71286b6 2 * Packet.h
nucho 0:a70ea71286b6 3 * @author Yuki Suga
nucho 0:a70ea71286b6 4 * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010.
nucho 0:a70ea71286b6 5 * @license LGPLv3
nucho 0:a70ea71286b6 6 *****************************************/
nucho 0:a70ea71286b6 7
nucho 0:a70ea71286b6 8 #ifndef PACKET_HEADER_INCLUDED
nucho 0:a70ea71286b6 9 #define PACKET_HEADER_INCLUDED
nucho 0:a70ea71286b6 10
nucho 0:a70ea71286b6 11 // Return Values
nucho 0:a70ea71286b6 12 #define TIMEOUT 1
nucho 0:a70ea71286b6 13 #define DATA_TIMEOUT 2
nucho 0:a70ea71286b6 14 #define CHECKSUM_ERROR 3
nucho 0:a70ea71286b6 15
nucho 0:a70ea71286b6 16 #define INVALID_PACKET_INTERFACE 65
nucho 0:a70ea71286b6 17 #define INVALID_PACKET_DATASIZE 66
nucho 0:a70ea71286b6 18
nucho 0:a70ea71286b6 19 // Packet Settings
nucho 0:a70ea71286b6 20 #define PACKET_HEADER_SIZE 2
nucho 0:a70ea71286b6 21 #define INTERFACE 0
nucho 0:a70ea71286b6 22 #define DATA_LENGTH 1
nucho 0:a70ea71286b6 23 #define DATA_START_ADDR 2
nucho 0:a70ea71286b6 24
nucho 0:a70ea71286b6 25 // Protocol
nucho 0:a70ea71286b6 26 // Interface
nucho 0:a70ea71286b6 27 #define INITIALIZE 'I'
nucho 0:a70ea71286b6 28 #define ACTIVATE 'A'
nucho 0:a70ea71286b6 29 #define DEACTIVATE 'D'
nucho 0:a70ea71286b6 30 #define EXECUTE 'E'
nucho 0:a70ea71286b6 31 #define ONERROR 'C'
nucho 0:a70ea71286b6 32 #define RESET 'R'
nucho 0:a70ea71286b6 33 #define GET_STATUS 'X'
nucho 0:a70ea71286b6 34
nucho 0:a70ea71286b6 35 #define ADD_INPORT 'P'
nucho 0:a70ea71286b6 36 #define ADD_OUTPORT 'Q'
nucho 0:a70ea71286b6 37
nucho 0:a70ea71286b6 38 #define INPORT_ISNEW 'N'
nucho 0:a70ea71286b6 39 #define INPORT_READ 'J'
nucho 0:a70ea71286b6 40
nucho 0:a70ea71286b6 41 #define RTNO_OK '@'
nucho 0:a70ea71286b6 42 #define RTNO_ERROR 'x'
nucho 0:a70ea71286b6 43
nucho 0:a70ea71286b6 44
nucho 0:a70ea71286b6 45 #define OUTPORT_WRITE 'W'
nucho 0:a70ea71286b6 46
nucho 0:a70ea71286b6 47 // Communication Settings
nucho 0:a70ea71286b6 48 #define PACKET_WAITING_TIME 50 // ms
nucho 0:a70ea71286b6 49 #define PACKET_WAITING_DELAY 100 //us
nucho 0:a70ea71286b6 50 #define PACKET_WAITING_COUNT (PACKET_WAITING_TIME*1000/PACKET_WAITING_DELAY)
nucho 0:a70ea71286b6 51
nucho 0:a70ea71286b6 52
nucho 0:a70ea71286b6 53 #define TYPECODE_TIMED_BOOLEAN 'b'
nucho 0:a70ea71286b6 54 #define TYPECODE_TIMED_CHAR 'c'
nucho 0:a70ea71286b6 55 #define TYPECODE_TIMED_OCTET 'o'
nucho 0:a70ea71286b6 56
nucho 0:a70ea71286b6 57
nucho 0:a70ea71286b6 58 #define TYPECODE_TIMED_LONG 'l'
nucho 0:a70ea71286b6 59 #define TYPECODE_TIMED_FLOAT 'f'
nucho 0:a70ea71286b6 60 #define TYPECODE_TIMED_DOUBLE 'd'
nucho 0:a70ea71286b6 61
nucho 0:a70ea71286b6 62 #define TYPECODE_TIMED_BOOLEAN_SEQ 'B'
nucho 0:a70ea71286b6 63 #define TYPECODE_TIMED_CHAR_SEQ 'C'
nucho 0:a70ea71286b6 64 #define TYPECODE_TIMED_OCTET_SEQ 'O'
nucho 0:a70ea71286b6 65
nucho 0:a70ea71286b6 66
nucho 0:a70ea71286b6 67 #define TYPECODE_TIMED_LONG_SEQ 'L'
nucho 0:a70ea71286b6 68 #define TYPECODE_TIMED_FLOAT_SEQ 'F'
nucho 0:a70ea71286b6 69 #define TYPECODE_TIMED_DOUBLE_SEQ 'D'
nucho 0:a70ea71286b6 70
nucho 0:a70ea71286b6 71 #define MAX_PACKET_SIZE 64
nucho 0:a70ea71286b6 72
nucho 0:a70ea71286b6 73
nucho 0:a70ea71286b6 74 #endif