summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/src/codewheel.c
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-22 22:37:43 +0200
committerFlorent Duchon2012-05-04 00:06:27 +0200
commitada3d26e47f5a568cb1dd6196d622a33623138d2 (patch)
tree14e39f038eb6ed424ff01da40d8cf187b7829b60 /digital/beacon/src/codewheel.c
parent5b1422b28f7691ac8f2ff3f8b59479d95741426c (diff)
digital/beacon: add codewheel representation states
Diffstat (limited to 'digital/beacon/src/codewheel.c')
-rw-r--r--digital/beacon/src/codewheel.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c
index 32b45b37..84ca69f6 100644
--- a/digital/beacon/src/codewheel.c
+++ b/digital/beacon/src/codewheel.c
@@ -28,10 +28,14 @@
#include "debug_avr.h"
#include "codewheel.h"
+codewheel_s codewheel;
/* This function initializes the codewheel optical sensors and associated interrupt */
void codewheel_init(void)
{
+ /* Set codewheel state*/
+ codewheel_set_state(CODEWHEEL_INIT);
+
/* Select external clock on rising edge for timer 3 */
TCCR3B |= (1<<CS30)|(1<<CS31)|(1<<CS32);
@@ -46,6 +50,17 @@ void codewheel_init(void)
sei();
}
+/* This function returns the codewheel state */
+TCodewheel_state codewheel_get_state(void)
+{
+ return codewheel.state;
+}
+
+/* This function modify the codewheel state */
+void codewheel_set_state(TCodewheel_state state)
+{
+ codewheel.state = state;
+}
/* This function returns the wheel position */
uint16_t codewheel_get_value(void)