diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-07-11 09:49:43 +1000 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-12 16:27:19 +0200 |
commit | 20cd5026d817a4f17b96906d1c93fc3cbaa498dd (patch) | |
tree | 678fc20b9c2ed170d85f8028faa31df4f3ad96d5 | |
parent | 6cffa948fe6edc1e58b7d55acf119e8793461510 (diff) | |
download | px4-firmware-20cd5026d817a4f17b96906d1c93fc3cbaa498dd.tar.gz px4-firmware-20cd5026d817a4f17b96906d1c93fc3cbaa498dd.tar.bz2 px4-firmware-20cd5026d817a4f17b96906d1c93fc3cbaa498dd.zip |
device: use bitfields to keep DeviceStructure small
this keeps it small enough to fit in a float, which makes it possible
to see the full value in a MAVLink tlog
Conflicts:
mavlink/include/mavlink/v1.0
-rw-r--r-- | src/drivers/device/device.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/drivers/device/device.h b/src/drivers/device/device.h index c98386eb0..7df234cab 100644 --- a/src/drivers/device/device.h +++ b/src/drivers/device/device.h @@ -134,11 +134,14 @@ public: }; /* - broken out + broken out device elements. The bitfields are used to keep + the overall value small enough to fit in a float accurately, + which makes it possible to transport over the MAVLink + parameter protocol without loss of information. */ struct DeviceStructure { - enum DeviceBusType bus_type; - uint8_t bus; // which instance of the bus type + enum DeviceBusType bus_type:3; + uint8_t bus:5; // which instance of the bus type uint8_t address; // address on the bus (eg. I2C address) uint8_t devtype; // device class specific device type }; |