ECRobot C++ API for LEGO MINDSTORMS NXT
1.0.10
|
00001 // 00002 // CompassSensor.h 00003 // 00004 // Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer 00005 // 00006 00007 #ifndef COMPASSSENSOR_H_ 00008 #define COMPASSSENSOR_H_ 00009 00010 #include "I2c.h" 00011 00012 namespace ecrobot 00013 { 00052 class CompassSensor 00053 { 00054 public: 00064 explicit CompassSensor(ePortS port); 00065 00071 S16 getHeading(void) const; 00072 00084 inline void get(U8 data[5]) const { mI2c.receive(0x41, data, 5); } 00085 00091 void beginCalibration(void); 00092 00099 bool endCalibration(void); 00100 00101 private: 00102 I2c mI2c; // composite 00103 }; 00104 } 00105 00106 #endif