-
Notifications
You must be signed in to change notification settings - Fork 0
/
HiTechnicCompass.h
45 lines (37 loc) · 1.34 KB
/
HiTechnicCompass.h
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
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#ifndef __HiTechnicCompass_h__
#define __HiTechnicCompass_h__
#include "SensorBase.h"
class I2C;
/**
* HiTechnic NXT Compass.
*
* This class alows access to a HiTechnic NXT Compass on an I2C bus.
* These sensors to not allow changing addresses so you cannot have more
* than one on a single bus.
*
* Details on the sensor can be found here:
* http://www.hitechnic.com/index.html?lang=en-us&target=d17.html
*
* @todo Implement a calibration method for the sensor.
*/
class HiTechnicCompass : public SensorBase
{
public:
explicit HiTechnicCompass(UINT32 slot);
virtual ~HiTechnicCompass();
float GetAngle();
private:
static const UINT8 kAddress = 0x02;
static const UINT8 kManufacturerBaseRegister = 0x08;
static const UINT8 kManufacturerSize = 0x08;
static const UINT8 kSensorTypeBaseRegister = 0x10;
static const UINT8 kSensorTypeSize = 0x08;
static const UINT8 kHeadingRegister = 0x44;
I2C* m_i2c;
};
#endif