diff options
Diffstat (limited to 'src/canutil/write.h')
-rw-r--r-- | src/canutil/write.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/canutil/write.h b/src/canutil/write.h index f117a06c..8fd18cdb 100644 --- a/src/canutil/write.h +++ b/src/canutil/write.h @@ -14,8 +14,8 @@ extern "C" { * value - the floating point value to encode. * bit_offset - the starting point for the encoded bits in the returned value. * bit_size - The max width of the field in the resulting bit array. If bit_size - * isn't big enough to store the fixed point version of the value, the bitfeld - * will *not* be set. TODO some error reporting would be nice. + * isn't big enough to store the fixed point version of the value, the + * bitfeld will *not* be set. TODO some error reporting would be nice. * factor - a factor used to transform from floating to fixed point before * encoding. Use 1.0 for no factor. * offset - an offset used to transform from floating to fixed point before @@ -23,20 +23,24 @@ extern "C" { * * Returns a big-endian uint64_t with the value encoded as a bitfield. */ -uint64_t bitfield_encode_float(float value, uint8_t bit_offset, uint8_t bit_size, - float factor, float offset); +uint64_t eightbyte_encode_float(float value, uint8_t bit_offset, + uint8_t bit_size, float factor, float offset); + +bool bitfield_encode_float(float value, uint8_t bit_offset, + uint8_t bit_size, float factor, float offset, uint8_t destination[]); /* Public: Encode a boolean into fixed bit width field in a bit array. * * value - the boolean value to encode - true will be 1, false will be 0. * bit_offset - the starting point for the encoded bits in the returned value. * bit_size - The max width of the field in the resulting bit array. If bit_size - * isn't big enough to store the fixed point version of the value, the bitfeld - * will *not* be set. TODO some error reporting would be nice. + * isn't big enough to store the fixed point version of the value, the + * bitfeld will *not* be set. TODO some error reporting would be nice. * * Returns a big-endian uint64_t with the value encoded as a bitfield. */ -uint64_t bitfield_encode_bool(const bool value, const uint8_t bit_offset, const uint8_t bit_size); +uint64_t eightbyte_encode_bool(const bool value, const uint8_t bit_offset, + const uint8_t bit_size); #ifdef __cplusplus } |