summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon
diff options
context:
space:
mode:
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/codewheel.c25
-rw-r--r--digital/beacon/src/codewheel.h12
2 files changed, 36 insertions, 1 deletions
diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c
index 283439d6..45e97c71 100644
--- a/digital/beacon/src/codewheel.c
+++ b/digital/beacon/src/codewheel.c
@@ -113,6 +113,31 @@ ISR(TIMER3_COMPA_vect)
else
{
OCR3A = CODEWHEEL_CPR;
+ codewheel.time = 0;
}
laser_reset_angle_id();
}
+
+/* Task for turn time measurment */
+void codewheel_timer_task(void)
+{
+ codewheel.time+=10;
+}
+
+/* This function start the codewheel timer task */
+void start_codewheel_timer_task(void)
+{
+ codewheel.time = 0;
+ codewheelTimer.interval = CODEWHEEL_TIMER_TASK_PERIOD;
+ codewheelTimer.mode = TIMER_REPEAT_MODE;
+ codewheelTimer.callback = codewheel_timer_task;
+ HAL_StartAppTimer(&codewheelTimer);
+}
+
+/* This function stop the codewheel timer task */
+void stop_codewheel_timer_task(void)
+{
+ HAL_StopAppTimer(&codewheelTimer);
+}
+
+
diff --git a/digital/beacon/src/codewheel.h b/digital/beacon/src/codewheel.h
index 5846c2e5..b2a4abff 100644
--- a/digital/beacon/src/codewheel.h
+++ b/digital/beacon/src/codewheel.h
@@ -27,7 +27,7 @@
#define _CODEWHEEL_H
#define CODEWHEEL_CPR 499
-
+#define CODEWHEEL_TIMER_TASK_PERIOD 10L
typedef enum
{
CODEWHEEL_INIT,
@@ -39,6 +39,7 @@ typedef struct
{
TCodewheel_state state;
uint16_t rebase_offset;
+ uint16_t time;
} codewheel_s;
/* This function initializes the codewheel optical sensors and associated interrupt */
@@ -68,4 +69,13 @@ float codewheel_convert_angle_raw2degrees(uint16_t raw_value);
/* This function converts the angle value from row format to radians */
float codewheel_convert_angle_raw2radians(uint16_t raw_value);
+/* Task for turn time measurment */
+void codewheel_timer_task(void);
+
+/* This function start the codewheel timer task */
+void start_codewheel_timer_task(void);
+
+/* This function stop the codewheel timer task */
+void stop_codewheel_timer_task(void);
+
#endif