Matthias Grob
/
FlyBed2
My fully self designed first stable working Quadrocopter Software.
Embed:
(wiki syntax)
Show/hide line numbers
HMC5883.h
00001 // based on http://mbed.org/users/BlazeX/code/HMC5883/ 00002 00003 #ifndef HMC5883_H 00004 #define HMC5883_H 00005 00006 #include "mbed.h" 00007 #include "I2C_Sensor.h" 00008 00009 #define HMC5883_I2C_ADDRESS 0x3C 00010 00011 #define HMC5883_CONF_REG_A 0x00 00012 #define HMC5883_CONF_REG_B 0x01 00013 #define HMC5883_MODE_REG 0x02 00014 #define HMC5883_DATA_OUT_X_MSB 0x03 00015 00016 class HMC5883 : public I2C_Sensor 00017 { 00018 public: 00019 HMC5883(PinName sda, PinName scl); 00020 00021 void read(); // read all axis from register to array data 00022 void calibrate(int s); 00023 float get_angle(); 00024 00025 float offset[3]; // calibration offset 00026 00027 private: 00028 void readraw(); // function to get raw data 00029 }; 00030 00031 #endif
Generated on Thu Jul 14 2022 18:09:09 by 1.7.2