Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Communication_Robot by
protocol.h@3:2f334f0cee75, 2015-03-02 (annotated)
- Committer:
- soulx
- Date:
- Mon Mar 02 05:52:56 2015 +0000
- Revision:
- 3:2f334f0cee75
- Parent:
- 2:56c1de1612dd
- Child:
- 5:1d92ab54b7b2
add paramter addres of instruction control
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| soulx | 0:0c88691e3904 | 1 | #ifndef ANDANTE_PROTOCOL_H |
| soulx | 0:0c88691e3904 | 2 | #define ANDANTE_PROTOCOL_H |
| soulx | 0:0c88691e3904 | 3 | |
| soulx | 0:0c88691e3904 | 4 | #include "mbed.h" |
| soulx | 0:0c88691e3904 | 5 | |
| soulx | 0:0c88691e3904 | 6 | #define ANDANTE_BUFFER_SIZE 0x8F |
| soulx | 0:0c88691e3904 | 7 | |
| soulx | 0:0c88691e3904 | 8 | #define ANDANTE_PROTOCOL_COMMAND_RESPONSE_TIMEOUT_MS 20 |
| soulx | 0:0c88691e3904 | 9 | |
| soulx | 2:56c1de1612dd | 10 | #define ANDANTE_PROTOCOL_HEADER_0 0xFF |
| soulx | 2:56c1de1612dd | 11 | #define ANDANTE_PROTOCOL_HEADER_1 0xFF |
| soulx | 0:0c88691e3904 | 12 | |
| soulx | 0:0c88691e3904 | 13 | // Errors |
| soulx | 0:0c88691e3904 | 14 | #define ANDANTE_ERRBIT_NONE 0x00 |
| soulx | 0:0c88691e3904 | 15 | #define ANDANTE_ERRBIT_VOLTAGE 0x01 |
| soulx | 0:0c88691e3904 | 16 | #define ANDANTE_ERRBIT_ANGLE 0x02 |
| soulx | 0:0c88691e3904 | 17 | #define ANDANTE_ERRBIT_OVERHEAT 0x04 |
| soulx | 0:0c88691e3904 | 18 | #define ANDANTE_ERRBIT_RANGE 0x08 |
| soulx | 0:0c88691e3904 | 19 | #define ANDANTE_ERRBIT_CHECKSUM 0x10 |
| soulx | 0:0c88691e3904 | 20 | #define ANDANTE_ERRBIT_OVERLOAD 0x20 |
| soulx | 0:0c88691e3904 | 21 | #define ANDANTE_ERRBIT_INSTRUCTION 0x40 |
| soulx | 0:0c88691e3904 | 22 | |
| soulx | 0:0c88691e3904 | 23 | // Extra errors |
| soulx | 0:0c88691e3904 | 24 | #define ANDANTE_ERRBIT_WRITE_TIMEOUT 0xFD |
| soulx | 0:0c88691e3904 | 25 | #define ANDANTE_ERRBIT_READ_TIMEOUT 0xFE |
| soulx | 0:0c88691e3904 | 26 | #define ANDANTE_ERRBIT_MASTER_CHECKSUM 0xFF |
| soulx | 0:0c88691e3904 | 27 | |
| soulx | 0:0c88691e3904 | 28 | |
| soulx | 3:2f334f0cee75 | 29 | //Instruction Control |
| soulx | 3:2f334f0cee75 | 30 | #define ANDANTE_SPEED_CONTROL 0x01 |
| soulx | 3:2f334f0cee75 | 31 | #define ANDANTE_FRONT_ANGLE 0x02 |
| soulx | 3:2f334f0cee75 | 32 | #define ANDANTE_REAR_ANGLE 0x04 |
| soulx | 3:2f334f0cee75 | 33 | |
| soulx | 3:2f334f0cee75 | 34 | //Instruction Sensor |
| soulx | 3:2f334f0cee75 | 35 | |
| soulx | 3:2f334f0cee75 | 36 | |
| soulx | 0:0c88691e3904 | 37 | struct ANDANTE_PROTOCOL_PACKET |
| soulx | 0:0c88691e3904 | 38 | { |
| soulx | 0:0c88691e3904 | 39 | uint8_t robotId; |
| soulx | 0:0c88691e3904 | 40 | uint8_t length; |
| soulx | 0:0c88691e3904 | 41 | uint8_t instructionErrorId; |
| soulx | 0:0c88691e3904 | 42 | uint8_t parameter[ANDANTE_BUFFER_SIZE]; |
| soulx | 0:0c88691e3904 | 43 | uint8_t checkSum; |
| soulx | 0:0c88691e3904 | 44 | }; |
| soulx | 0:0c88691e3904 | 45 | |
| soulx | 0:0c88691e3904 | 46 | enum ANDANTE_PROTOCOL_ENCODER_DECODER_STATE |
| soulx | 0:0c88691e3904 | 47 | { |
| soulx | 0:0c88691e3904 | 48 | WAIT_ON_HEADER_0, |
| soulx | 0:0c88691e3904 | 49 | WAIT_ON_HEADER_1, |
| soulx | 0:0c88691e3904 | 50 | WAIT_ON_ROBOT_ID, |
| soulx | 0:0c88691e3904 | 51 | WAIT_ON_LENGTH, |
| soulx | 0:0c88691e3904 | 52 | WAIT_ON_INSTRUCTION_ERROR_ID, |
| soulx | 0:0c88691e3904 | 53 | WAIT_ON_PARAMETER, |
| soulx | 0:0c88691e3904 | 54 | WAIT_ON_CHECK_SUM |
| soulx | 0:0c88691e3904 | 55 | }; |
| soulx | 0:0c88691e3904 | 56 | |
| soulx | 0:0c88691e3904 | 57 | #endif // ANDANTE_PROTOCOL_H |
