Datatypes
The DTYPE code in B0 messages identifies each signal's data type. The same codes determine how many bytes to read per signal in data frames.
Type Table
| User Type | AVR | 32-bit Platform |
|---|---|---|
bool | DTYPE 0 (1 byte) | DTYPE 0 (1 byte) |
byte | DTYPE 1 (1 byte) | DTYPE 1 (1 byte) |
short | DTYPE 2 (2 bytes) | DTYPE 2 (2 bytes) |
unsigned short | DTYPE 3 (2 bytes) | DTYPE 3 (2 bytes) |
int | DTYPE 4 (2 bytes) | DTYPE 6 (4 bytes) |
unsigned int | DTYPE 5 (2 bytes) | DTYPE 7 (4 bytes) |
long | DTYPE 6 (4 bytes) | DTYPE 6 (4 bytes) |
unsigned long | DTYPE 7 (4 bytes) | DTYPE 7 (4 bytes) |
float | DTYPE 8 (4 bytes) | DTYPE 8 (4 bytes) |
double | DTYPE 8 (4 bytes) | DTYPE 9 (8 bytes) |
blaecktcpy uses the same mapping as 32-bit platforms.
The protocol automatically handles platform differences in data type sizes:
AVR (Arduino Uno, Nano, Mega, etc.):
intandunsigned intare 2 bytesdoublehas no precision advantage overfloat(both 4 bytes)
32-bit Platforms (ESP32, ESP8266, Arduino Due, etc.):
intandunsigned intare 4 bytes and get automatically mapped tolong/unsigned longprotocol typesdoubleprovides true 8-byte double precision