summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/src/laser.h
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-21 16:42:16 +0200
committerFlorent Duchon2012-04-21 18:05:03 +0200
commit90527d1cf27582b1e7bb8588afbed8989453f606 (patch)
tree85a51ed6b31de8698bf7ff0b6b9d504e1c4d5626 /digital/beacon/src/laser.h
parent7c8f2999d8a61fa4f7666484a9ead9541121d4c0 (diff)
digital/beacon: split sensors.* into codewheel.* & laser.* and modify dedicated calls
Diffstat (limited to 'digital/beacon/src/laser.h')
-rw-r--r--digital/beacon/src/laser.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/digital/beacon/src/laser.h b/digital/beacon/src/laser.h
new file mode 100644
index 00000000..661c32b8
--- /dev/null
+++ b/digital/beacon/src/laser.h
@@ -0,0 +1,55 @@
+/* laser.h */
+/* laser sensor management. {{{
+ *
+ * Copyright (C) 2012 Florent Duchon
+ *
+ * APBTeam:
+ * Web: http://apbteam.org/
+ * Email: team AT apbteam DOT org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * }}} */
+
+#ifndef _LASER_H
+#define _LASER_H
+
+#define RISING_EDGE TCCR3B & (1<<ICES3)
+#define SENDING_ENGAGED TIMSK3&(1<<OCIE3B)
+#define LASER_SENDING_OFFSET 10
+
+typedef enum
+{
+ LASER_FIRST_RISING_EDGE,
+ LASER_RISING_EDGE,
+ LASER_FALLING_EDGE
+} TLaser_edge_type;
+
+/* This function initializes the laser pin input and associated interrupt */
+void laser_init(void);
+
+/* This function returns the edge type trigged by the AVR IC module*/
+TLaser_edge_type laser_get_edge_type(void);
+
+/* This function inverts the trigged edge of the AVR IC module */
+void laser_invert_IRQ_edge_trigger(void);
+
+/* This function deactivates the angle sending */
+void laser_inhibit_angle_sending(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_sending(uint16_t value);
+
+#endif