summaryrefslogtreecommitdiff
path: root/digital/beacon/src/codewheel.c
diff options
context:
space:
mode:
Diffstat (limited to 'digital/beacon/src/codewheel.c')
-rw-r--r--digital/beacon/src/codewheel.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c
index fb8914c2..283439d6 100644
--- a/digital/beacon/src/codewheel.c
+++ b/digital/beacon/src/codewheel.c
@@ -23,10 +23,13 @@
*
* }}} */
-#include <types.h>
#include <avr/interrupt.h>
+#include <types.h>
+#include <math.h>
#include "debug_avr.h"
#include "codewheel.h"
+#include "laser.h"
+#include "network.h"
codewheel_s codewheel;
@@ -92,6 +95,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)
{
@@ -99,7 +108,11 @@ ISR(TIMER3_COMPA_vect)
{
OCR3A = codewheel_get_rebase_offset();
codewheel_set_state(CODEWHEEL_REBASED);
+ uprintf("Rebased\r\n");
}
else
- OCR3A = CODEWHEEL_CPR;
+ {
+ OCR3A = CODEWHEEL_CPR;
+ }
+ laser_reset_angle_id();
}