summaryrefslogtreecommitdiff
path: root/n/es-2006/src/sniff_rvb.h
blob: 348a0715c67a981c0c94164ee9c8bfedc11648a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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