5.2.3 Message Format
The ADP protocol uses a common message format for both directions of communication and all message types.
Field | Size | Values | Description |
---|---|---|---|
Token | 1 byte | 0xFF | Start token for ADP data |
Message ID | 1 byte | 0x00-0xFE | Identifies the type of message being sent |
Data length | 2 bytes | 0x0000-0xFFFF | Length of data packet (bytes) |
Data | N bytes | ... | Data content of the message |
Token
The value 0xFF followed by a value other than 0xFF (0xFF is not a valid Message ID), is used to indicate the start of the message. This means that 0xFF must be sent between each message.
If the value 0xFF is to be transmitted as part of data or data length, a new 0xFF should be inserted after it. When receiving messages, two 0xFF should be decoded as a single 0xFF. The extra 0xFF bytes are not contributing to the Data length field. For example, a color field with the value 0xFFFFFF will have to be transmitted as 0xFFFFFFFFFFFF, but only contributes to the data length by three bytes.
The value 0xFF is not allowed to be used as a message ID. When polling for data over SPI, the 0xFF token must be used as a dummy character to not trigger a command unintentionally.
Endianness
All message data is ordered using little endian.