summaryrefslogtreecommitdiff
path: root/n/es-2006/src/sniff_rvb.h
diff options
context:
space:
mode:
Diffstat (limited to 'n/es-2006/src/sniff_rvb.h')
-rw-r--r--n/es-2006/src/sniff_rvb.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/n/es-2006/src/sniff_rvb.h b/n/es-2006/src/sniff_rvb.h
new file mode 100644
index 0000000..348a071
--- /dev/null
+++ b/n/es-2006/src/sniff_rvb.h
@@ -0,0 +1,69 @@
+#ifndef sniff_rvb_h
+#define sniff_rvb_h
+// sniff_rvb.h
+// es - Input/Output general purpose board. {{{
+//
+// Copyright (C) 2006 Dufour Jérémy
+//
+// Robot APB Team/Efrei 2004.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
+//
+// 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.
+//
+// }}}
+
+#include "io.h"
+#include "common.h"
+
+/** Analysis sensors and determine the colors. */
+
+#define RVB_SNIFF_MAX_INDEX 4
+#define RVB_SNIFF_GREEN 0
+#define RVB_SNIFF_BLUE 1
+#define RVB_SNIFF_RED 2
+#define RVB_SNIFF_OTHER 3
+
+/** Mode for color detection
+ * ONLY_GREEN is faster but tells only if it's green or not
+ **/
+#define RVB_SNIFF_ONLY_GREEN 0
+#define RVB_SNIFF_ALL_COLORS 1
+
+
+/** Set the current color seen by some sensors as the reference color.
+ * It must be called at the begining of the match for setting the green value.
+ */
+void sniff_rvb_set_ref_color (uint8_t sensor, uint8_t color);
+
+/** Set the threshold of the differents colors.
+ * There are used for the algorithm that distinguish colors.
+ */
+void sniff_rvb_set_threshold (uint8_t color, int16_t red_ts, int16_t
+ blue_ts, int16_t clear_ts, int16_t green_ts);
+
+/** Analysis a color :
+ * - sensor : the sensor number to analysis ;
+ * - mode : for futur use.
+ * return the color number.
+ */
+uint8_t sniff_rvb_analysis_color (uint8_t sensor, uint8_t mode);
+
+/** Configure the sensor analysis system.
+ * - ref_ratio : ratio for the reference color.
+ */
+void sniff_rvb_config (uint8_t ref_ratio);
+
+#endif // sniff_rvb_h