Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Magnetometer.h
00001 #ifndef _H_MAGNETOMETER_H 00002 #define _H_MAGNETOMETER_H 00003 00004 #include "I2CPeripheral.h" 00005 #include "Sensor.h" 00006 #include "CalibrateMagneto.h" 00007 00008 class Magnetometer : public I2CPeripheral, public Sensor 00009 { 00010 public: 00011 Magnetometer(I2C &i2c); 00012 00013 virtual bool powerOn(); 00014 virtual void powerOff(); 00015 virtual void start(); 00016 virtual void stop(); 00017 00018 virtual Vector3 read(); 00019 00020 bool performSelfTest(); 00021 00022 void getCalibration(Vector3 &mins, Vector3 &maxs); 00023 00024 private: 00025 // Calibration data 00026 int8_t dig_x1; 00027 int8_t dig_y1; 00028 int8_t dig_x2; 00029 int8_t dig_y2; 00030 uint16_t dig_z1; 00031 int16_t dig_z2; 00032 int16_t dig_z3; 00033 int16_t dig_z4; 00034 uint8_t dig_xy1; 00035 int8_t dig_xy2; 00036 uint16_t dig_xyz1; 00037 00038 // Hard iron cancellation data 00039 CalibrateMagneto calibrator; 00040 00041 void readCalibrationData(); 00042 00043 InterruptIn int1; 00044 InterruptIn int2; 00045 }; 00046 00047 #endif//_H_MAGNETOMETER_H
Generated on Wed Jul 13 2022 08:50:41 by
