summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/src/calibration.h
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-17 22:38:40 +0200
committerFlorent Duchon2012-04-17 22:38:40 +0200
commitb8a2122276a91deba4f9cc74e994815fb3a4bf17 (patch)
tree43fc8862be04059f083b716300eaf85bb6974bd4 /digital/beacon/src/calibration.h
parent7231b985f199651b1772ad6d3dc31174476c1c22 (diff)
digital/beacon: import calibration files
Diffstat (limited to 'digital/beacon/src/calibration.h')
-rw-r--r--digital/beacon/src/calibration.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/digital/beacon/src/calibration.h b/digital/beacon/src/calibration.h
new file mode 100644
index 00000000..3512eedf
--- /dev/null
+++ b/digital/beacon/src/calibration.h
@@ -0,0 +1,93 @@
+/* calibration.h */
+/* Beacon servomotor calibration. {{{
+ *
+ * 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 _CALIBRATION_H
+#define _CALIBRATION_H
+
+#include "servo.h"
+
+#define CALIBRATION_FAST_TASK_PERIOD 11L
+#define CALIBRATION_SLOW_TASK_PERIOD 110L
+
+#define FAST_SCANNING_OFFSET 10
+#define SCANNING_STEP 1
+
+typedef enum
+{
+ CLEAR,
+ SET
+} TLaser_flag_type;
+
+typedef enum
+{
+ FAST_SCANNING,
+ SLOW_SCANNING
+} TScanning_mode;
+
+typedef enum
+{
+ CALIBRATION_INIT,
+ CALIBRATION_FAST_SCANNING,
+ CALIBRATION_SLOW_SCANNING,
+ SCANNING_STATE_CALIBRATED
+} TCalibration_state;
+
+typedef struct
+{
+ TCalibration_state state;
+ TLaser_flag_type laser_flag;
+} calibration_s;
+
+/* This function iniatializes the calibration structure*/
+void calibration_init_structure(void);
+
+/* This function starts the calibration task */
+void calibration_start_task(void);
+
+/* This function stops the calibration task */
+void calibration_stop_task(void);
+
+/* This function starts or stops the calibration task depending on the current state */
+void calibration_start_stop_task(void);
+
+/* This function restarts the calibration task changing its frequency */
+void calibration_change_task_frequency(uint32_t frequency);
+
+/* Calibration task is used to calibrated the servo motors in order to run the laser parallel to the table */
+void calibration_task(void);
+
+/* This function drives the defined servo motor in order to scan verticaly */
+void calibration_scanning(TServo_ID servo_id);
+
+/* This function sets the laser flag according the given value SET or CLEAR */
+void calibration_set_laser_flag(TLaser_flag_type value);
+
+/* This function returns the laser flag */
+TLaser_flag_type calibration_get_laser_flag(void);
+
+/* This function returns the calibration state */
+TCalibration_state calibration_get_state(void);
+
+#endif