summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-17 22:36:12 +0200
committerFlorent Duchon2012-04-17 22:36:12 +0200
commit7231b985f199651b1772ad6d3dc31174476c1c22 (patch)
tree7e27f200c6c178e98b9eba4047a30d4b90faf71a /digital
parentf5b85a06258fc17310d91ba0925c34608b6315d7 (diff)
digital/beacon: add laser support
Diffstat (limited to 'digital')
-rw-r--r--digital/beacon/src/main_avr.c1
-rw-r--r--digital/beacon/src/sensors.c14
-rw-r--r--digital/beacon/src/sensors.h8
3 files changed, 17 insertions, 6 deletions
diff --git a/digital/beacon/src/main_avr.c b/digital/beacon/src/main_avr.c
index f259d22b..9da8356d 100644
--- a/digital/beacon/src/main_avr.c
+++ b/digital/beacon/src/main_avr.c
@@ -77,6 +77,7 @@ void APL_TaskHandler(void)
servo_timer1_init();
sensors_laser_init();
sensors_codewheel_init();
+ sensors_laser_init();
network_init();
uprintf("DEVICE_TYPE_END_DEVICE init OK\n\r");
break;
diff --git a/digital/beacon/src/sensors.c b/digital/beacon/src/sensors.c
index be7f6ea0..d1418440 100644
--- a/digital/beacon/src/sensors.c
+++ b/digital/beacon/src/sensors.c
@@ -33,8 +33,11 @@
/* This function initializes the laser pin input and associated interrupt */
void sensors_laser_init(void)
-{
- HAL_RegisterIrq(IRQ_7,IRQ_RISING_EDGE,sensors_laser_irq_vector);
+{
+ /* Configure Input compare interrupts for Laser Interrupt*/
+ TCCR3B |= (1<<ICNC3)|(1<<ICES3);
+ TIMSK3 |= (1<<ICIE3);
+ sei();
}
@@ -55,6 +58,7 @@ void sensors_codewheel_init(void)
sei();
}
+
/* This function returns the wheel position */
uint16_t sensors_codewheel_get_value(void)
{
@@ -72,3 +76,9 @@ ISR(TIMER3_COMPA_vect)
{
//Top tour ++
}
+
+/* IRQ vector for Laser Interrupt */
+ISR(TIMER3_CAPT_vect)
+{
+ // LASER
+}
diff --git a/digital/beacon/src/sensors.h b/digital/beacon/src/sensors.h
index 0f868d65..f2aa3c3b 100644
--- a/digital/beacon/src/sensors.h
+++ b/digital/beacon/src/sensors.h
@@ -26,7 +26,7 @@
#ifndef _SENSORS_H
#define _SENSORS_H
-#define CODEWHEEL_CPR 500
+#define CODEWHEEL_CPR 499
/* This function initializes the laser pin input and associated interrupt */
void sensors_laser_init(void);
@@ -35,9 +35,9 @@ void sensors_laser_init(void);
void sensors_codewheel_init(void);
/* This function returns the wheel position */
-int sensors_codewheel_get_value(void);
+uint16_t sensors_codewheel_get_value(void);
-/* IRQ vector for Laser Interrupt */
-void sensors_laser_irq_vector(void);
+/* This function resets the wheel position */
+void sensors_codewheel_reset(void);
#endif \ No newline at end of file