3 uint64_t encodeFloat(float value, float offset, float factor, uint8_t bitPosition,
5 float rawValue = (value - offset) / factor;
7 // round up to avoid losing precision when we cast to an int
11 setBitField(&result, rawValue, bitPosition, bitSize);
15 uint64_t encodeBoolean(bool value, float offset, float factor,
16 uint8_t bitPosition, uint8_t bitSize) {
17 return encodeFloat(value, offset, factor, bitPosition, bitSize);