summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-22 22:47:32 +0200
committerFlorent Duchon2012-05-04 00:06:27 +0200
commitb918019c6bd7d07ffc22e5a0bf91b699a7bace1a (patch)
tree5c1ff92cb265e3bcd5082dd15c0202f1b58ba794 /digital
parent92f79991955f6448ae8099ae61aa90caf64cdd05 (diff)
digital/beacon: add get/set angle functions for laser structure
Diffstat (limited to 'digital')
-rw-r--r--digital/beacon/src/laser.c17
-rw-r--r--digital/beacon/src/laser.h6
2 files changed, 23 insertions, 0 deletions
diff --git a/digital/beacon/src/laser.c b/digital/beacon/src/laser.c
index 0dc01e58..ffbdbcbb 100644
--- a/digital/beacon/src/laser.c
+++ b/digital/beacon/src/laser.c
@@ -33,6 +33,9 @@ laser_s laser;
/* This function initializes the laser pin input and associated interrupt */
void laser_init(void)
{
+ /* Init laser structiure */
+ laser_set_angle(0);
+
/* Configure Input compare interrupts for Laser Interrupt*/
TCCR3B |= (1<<ICNC3)|(1<<ICES3);
TIMSK3 |= (1<<ICIE3);
@@ -86,6 +89,20 @@ void laser_engage_angle_confirmation(uint16_t value)
}
+/* This function returns the angle value */
+uint16_t laser_get_angle(void)
+{
+ return laser.angle;
+}
+
+
+/* This function sets the angle value */
+void laser_set_angle(uint16_t angle)
+{
+ laser.angle = angle;
+}
+
+
/* Zigbee sending IRQ vector */
ISR(TIMER3_COMPB_vect)
{
diff --git a/digital/beacon/src/laser.h b/digital/beacon/src/laser.h
index cb9a4bf2..d9d24b1e 100644
--- a/digital/beacon/src/laser.h
+++ b/digital/beacon/src/laser.h
@@ -57,4 +57,10 @@ void laser_inhibit_angle_confirmation(void);
/* This function configures the AVR OC3B interrupt that will send the angle LASER_SENDING_OFFSET after the latest rising edge */
void laser_engage_angle_confirmation(uint16_t value);
+/* This function returns the angle value */
+uint16_t laser_get_angle(void);
+
+/* This function sets the angle value */
+void laser_set_angle(uint16_t angle);
+
#endif