rrrrr
Fork of Communication_Robot by
protocol.h
- Committer:
- Tiz
- Date:
- 2015-12-08
- Revision:
- 4:7ebd932a9bef
- Parent:
- 3:2f334f0cee75
File content as of revision 4:7ebd932a9bef:
#ifndef ANDANTE_PROTOCOL_H #define ANDANTE_PROTOCOL_H #include "mbed.h" #define ANDANTE_BUFFER_SIZE 0x8F #define ANDANTE_PROTOCOL_COMMAND_RESPONSE_TIMEOUT_MS 20 #define ANDANTE_PROTOCOL_HEADER_0 0xFF #define ANDANTE_PROTOCOL_HEADER_1 0xFF // Errors #define ANDANTE_ERRBIT_NONE 0x00 #define ANDANTE_ERRBIT_VOLTAGE 0x01 #define ANDANTE_ERRBIT_ANGLE 0x02 #define ANDANTE_ERRBIT_OVERHEAT 0x04 #define ANDANTE_ERRBIT_RANGE 0x08 #define ANDANTE_ERRBIT_CHECKSUM 0x10 #define ANDANTE_ERRBIT_OVERLOAD 0x20 #define ANDANTE_ERRBIT_INSTRUCTION 0x40 // Extra errors #define ANDANTE_ERRBIT_WRITE_TIMEOUT 0xFD #define ANDANTE_ERRBIT_READ_TIMEOUT 0xFE #define ANDANTE_ERRBIT_MASTER_CHECKSUM 0xFF //Instruction Control #define SET_GOAL_POSITION 0x01 #define GET_GOAL_POSITION 0x02 //Instruction Set #define PING 0x01 #define READ_DATA 0x02 #define WRITE_DATA 0x03 //Instruction Sensor struct ANDANTE_PROTOCOL_PACKET { uint8_t robotId; uint8_t length; uint8_t instructionErrorId; uint8_t parameter[ANDANTE_BUFFER_SIZE]; uint8_t checkSum; }; enum ANDANTE_PROTOCOL_ENCODER_DECODER_STATE { WAIT_ON_HEADER_0, WAIT_ON_HEADER_1, WAIT_ON_ROBOT_ID, WAIT_ON_LENGTH, WAIT_ON_INSTRUCTION_ERROR_ID, WAIT_ON_PARAMETER, WAIT_ON_CHECK_SUM }; #endif // ANDANTE_PROTOCOL_H