summaryrefslogtreecommitdiffstats
path: root/src/canutil
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-03-05 15:39:52 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-03-05 15:39:52 -0500
commit500668d68145e0afb7a08e5757bf22a6dd7d74bb (patch)
treed0fc8c190aad3514594ae1b2f0a0be254dfb9f50 /src/canutil
parent7f1d5473842361f97fef886bc4e98949ecf853b6 (diff)
Make float_to_fixed_point a public function.
Diffstat (limited to 'src/canutil')
-rw-r--r--src/canutil/write.c2
-rw-r--r--src/canutil/write.h3
2 files changed, 4 insertions, 1 deletions
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 <bitfield/bitfield.h>
#include <bitfield/8byte.h>
-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);