I messed up the merge, so pushing it over to another repo so I don't lose it. Will tidy up and remove later
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: FreeD.h
- Revision:
- 25:7002be632308
- Parent:
- 20:ce1d8fbff68f
- Child:
- 80:0b7f1b85b626
--- a/FreeD.h Wed Jul 07 09:13:52 2021 +0000 +++ b/FreeD.h Wed Jul 07 16:27:24 2021 +0000 @@ -7,18 +7,26 @@ struct D1MsgFormat_s { uint8_t header; //0xD1, annoying it cant be set as default value here! uint8_t id; //camera ID, use 255 minus Rover ID - uint32_t yaw : 24; - uint32_t pitch : 24; - uint32_t roll : 24; - uint32_t x : 24; - uint32_t y : 24; - uint32_t z : 24; - uint32_t zoom : 24; - uint32_t focus : 24; + uint8_t yaw[3]; + uint8_t pitch[3]; + uint8_t roll[3]; + uint8_t x[3]; + uint8_t y[3]; + uint8_t z[3]; + uint8_t zoom[3]; + uint8_t focus[3]; uint16_t spare; uint8_t checksum; } __attribute__((packed)) ; + +inline void set24bitValue(uint8_t *target, int32_t value) +{ + *target = (uint8_t) ((value>>16) & 0xff); + *(target+1) = (uint8_t) ((value>>8) & 0xff); + *(target+2) = (uint8_t) (value & 0xff); +} + inline int GetFdCRC(void *data) { uint8_t *dataPtr = (uint8_t *)data; //uint8_t *crcPtr = (uint8_t *)checksum;