From 9ec12521300f1d09404d1a1ae2f6d5632b15bce8 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 16 May 2012 17:23:30 +0200 Subject: digital/beacon: add raw2radians codewheel conversion --- digital/beacon/src/codewheel.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'digital/beacon') diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c index fb8914c2..e53fef63 100644 --- a/digital/beacon/src/codewheel.c +++ b/digital/beacon/src/codewheel.c @@ -25,6 +25,7 @@ #include #include +#include #include "debug_avr.h" #include "codewheel.h" @@ -92,6 +93,12 @@ float codewheel_convert_angle_raw2degrees(uint16_t raw_value) return (float)raw_value*(float)360/(float)CODEWHEEL_CPR; } +/* This function converts the angle value from row format to radians */ +float codewheel_convert_angle_raw2radians(uint16_t raw_value) +{ + return (float)raw_value*(float)(2*M_PI)/(float)CODEWHEEL_CPR; +} + /* Codewheel complete turn IRQ vector for CodeWheel*/ ISR(TIMER3_COMPA_vect) { -- cgit v1.2.3