This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
rc2007-rescue/Srf10.h

47 lines
732 B
C
Raw Permalink Normal View History

2007-04-17 22:10:05 +00:00
#ifndef _ROBOCUP_SRF10_H_
#define _ROBOCUP_SRF10_H_
2007-04-15 22:01:04 +00:00
#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;
2007-04-15 22:01:04 +00:00
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;}
2007-04-15 22:01:04 +00:00
};
2007-04-17 22:10:05 +00:00
#endif