summaryrefslogtreecommitdiffstats
path: root/Srf10.h
blob: 1b69018e166f4acd9a29035f2b2a65230d35e18b (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
#ifndef _ROBOCUP_SRF10_H_
#define _ROBOCUP_SRF10_H_

#include <stdint.h>


enum Srf10Units {
	Inches = 0x50, Centimeters = 0x51, Microseconds = 0x52
};

class Srf10
{
private:
	uint8_t id;
	
	uint8_t gain;
	uint8_t range;
	
	int firmware;
	
	long distance;
	bool has_distance;
	
	Srf10Units unit;
	
	int readFirmware();
public:
	Srf10(uint8_t id);
	
	uint8_t getGain() {return gain;}
	bool setGain(uint8_t gain);
	
	uint8_t getRange() {return range;}
	bool setRange(uint8_t range);
	
	Srf10Units getUnit() {return unit;}
	void setUnit(Srf10Units unit) {this->unit = unit;}
	
	int getFirmware() {return firmware;}
	
	long updateDistance();
	long getDistance() {return distance;}
	bool hasDistance() {return has_distance;}
};

#endif