summaryrefslogtreecommitdiff
path: root/n/es-2006/src/sharp.h
diff options
context:
space:
mode:
Diffstat (limited to 'n/es-2006/src/sharp.h')
-rw-r--r--n/es-2006/src/sharp.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/n/es-2006/src/sharp.h b/n/es-2006/src/sharp.h
index 03827d7..e5f1a58 100644
--- a/n/es-2006/src/sharp.h
+++ b/n/es-2006/src/sharp.h
@@ -28,9 +28,20 @@
#include "common.h"
+/** Sharps positions
+ * ADC1 -> Rear ball
+ * ADC2 -> Front
+ * ADC3 -> Front
+ */
+
/** Number of sharps. */
#define SHARP_NUMBER 3
+/** Something in front of the sharp */
+#define SHARP_OBSTACLE 1
+/** Nothing in front of the sharp */
+#define SHARP_CLEAR 0
+
/** Array of sharp values. */
extern uint16_t sharp_values[SHARP_NUMBER];
@@ -43,12 +54,17 @@ void sharp_init (void);
void sharp_update_values (uint8_t sharp_num);
/** Analyse a sharp value.
- * - sharp_num : the sharp number you want to update.
- * - return : 0 if nothing in front, 1 otherwise.
+ * - sharp_num : the sharp number you want to analyse.
+ * - return : SHARP_CLEAR if nothing in front, SHARP_OBSTACLE otherwise.
*/
-uint8_t sharp_analyse_values (uint8_t sharp_num);
+int8_t sharp_analyse_values (uint8_t sharp_num);
/** Configure sharp threshold.
+ * - sharp_num : the sharp number you want to configure threshold.
+ * - high : high threshold.
+ * - low : low threshold.
+ * Note, high > low !
*/
+void sharp_config_threshold (uint8_t sharp_num, uint16_t high, uint16_t low);
#endif // sharp_h