summaryrefslogtreecommitdiff
path: root/digital/beacon
diff options
context:
space:
mode:
authorFlorent Duchon2012-05-16 17:23:30 +0200
committerFlorent Duchon2012-05-16 17:43:10 +0200
commit9ec12521300f1d09404d1a1ae2f6d5632b15bce8 (patch)
tree0d3e7fdbf4aa1f4ea7aef5a1f71785601fc4d85f /digital/beacon
parentdddeed6ce0ba60ffee5d11a0c4babadda5e2f552 (diff)
digital/beacon: add raw2radians codewheel conversion
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/codewheel.c7
1 files changed, 7 insertions, 0 deletions
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 <types.h>
#include <avr/interrupt.h>
+#include <math.h>
#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)
{