summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon
diff options
context:
space:
mode:
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/codewheel.c6
-rw-r--r--digital/beacon/src/codewheel.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c
index 092f6b57..fb8914c2 100644
--- a/digital/beacon/src/codewheel.c
+++ b/digital/beacon/src/codewheel.c
@@ -86,6 +86,12 @@ void codewheel_set_rebase_offset(uint16_t offset)
codewheel.rebase_offset = offset;
}
+/* This function converts the angle value from row format to degrees */
+float codewheel_convert_angle_raw2degrees(uint16_t raw_value)
+{
+ return (float)raw_value*(float)360/(float)CODEWHEEL_CPR;
+}
+
/* Codewheel complete turn IRQ vector for CodeWheel*/
ISR(TIMER3_COMPA_vect)
{
diff --git a/digital/beacon/src/codewheel.h b/digital/beacon/src/codewheel.h
index 7abe3f0e..f0ec26f5 100644
--- a/digital/beacon/src/codewheel.h
+++ b/digital/beacon/src/codewheel.h
@@ -62,4 +62,7 @@ uint16_t codewheel_get_rebase_offset(void);
/* This function saves the counter value used when a codewheel reset is requested */
void codewheel_set_rebase_offset(uint16_t offset);
+/* This function converts the angle value from row format to degrees */
+float codewheel_convert_angle_raw2degrees(uint16_t raw_value);
+
#endif