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