summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/input/ir_sensor.h
blob: c8f692b9d8a264a007a0856ea66e24d21e9d032e (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 _IR_SENSOR_H
#define _IR_SENSOR_H

#include "../../defines.h"
#include "../../robot.h"
#include "sensor.h"

class IR_Sensor : public Sensor
{
public:
	IR_Sensor()
	{
		this->parent = NULL;
		this->moduleId = 0;
		this->intensityCorrection = 0;
	}

	IR_Sensor(uint32 sensorId)
	{
		this->parent = NULL;
		this->moduleId = sensorId;
		this->intensityCorrection = 0;

		switch(sensorId)
		{
			case IO_SENSOR_IR_0_DEG:
				this->channel = 0;
				break;
			case IO_SENSOR_IR_30_DEG:
				this->channel = 1;
				break;
			case IO_SENSOR_IR_60_DEG:
				this->channel = 2;
				break;
			case IO_SENSOR_IR_100_DEG:
				this->channel = 3;
				this->intensityCorrection = 80;
				break;
			case IO_SENSOR_IR_180_DEG:
				this->channel = 4;
				this->intensityCorrection = 70;
				break;
			case IO_SENSOR_IR_260_DEG:
				this->channel = 5;
				this->intensityCorrection = 70;
				break;
			case IO_SENSOR_IR_300_DEG:
				this->channel = 6;
				break;
			case IO_SENSOR_IR_330_DEG:
				this->channel = 7;
				break;
			default:
				this->channel = 8;
				break;
		}
	}

protected:
	//Hardware
	uint8 channel;

	uint8 intensityCorrection;

public:
	uint16 GetIRIntensity();
};

#endif