From 500668d68145e0afb7a08e5757bf22a6dd7d74bb Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Wed, 5 Mar 2014 15:39:52 -0500 Subject: Make float_to_fixed_point a public function. --- src/canutil/write.c | 2 +- src/canutil/write.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/canutil/write.c b/src/canutil/write.c index 3b3ae25d..7f3a3e04 100644 --- a/src/canutil/write.c +++ b/src/canutil/write.c @@ -2,7 +2,7 @@ #include #include -static uint64_t float_to_fixed_point(const float value, const float factor, +uint64_t float_to_fixed_point(const float value, const float factor, const float offset) { float raw = (value - offset) / factor; if(raw > 0) { diff --git a/src/canutil/write.h b/src/canutil/write.h index 28b7e052..c2bef20e 100644 --- a/src/canutil/write.h +++ b/src/canutil/write.h @@ -26,6 +26,9 @@ extern "C" { uint64_t eightbyte_encode_float(float value, uint8_t bit_offset, uint8_t bit_size, float factor, float offset); +uint64_t float_to_fixed_point(const float value, const float factor, + const float offset); + bool bitfield_encode_float(const float value, const uint8_t bit_offset, const uint8_t bit_size, const float factor, const float offset, uint8_t destination[], const uint8_t destination_length); -- cgit 1.2.3-korg