#include <otQMC5883.h>
Public Types | |
| enum | OP_MODE { OPM_STANDBY = 0x00, OPM_CONTINUOUS = 0x01, OPM_DATARATE_10HZ = ((0x00) << 2), OPM_DATARATE_50HZ = ((0x01) << 2), OPM_DATARATE_100HZ = ((0x2) << 2), OPM_DATARATE_200HZ = ((0x3) << 2), OPM_SCALE_2G = ((0x00) << 4), OPM_SCALE_8G = ((0x01) << 4), OPM_OVER_SMP_512 = ((0x00) << 4), OPM_OVER_SMP_256 = ((0x01) << 4), OPM_OVER_SMP_128 = ((0x02) << 4), OPM_OVER_SMP_64 = ((0x03) << 4) } |
Public Member Functions | |
| otQMC5883 () | |
| void | init (int filterDepth=16, int filterAverage=2, U8 timerId=TIMER0) |
| void | setMode (U8 mode, U8 odr, U8 rng, U8 osr) |
| void | read () |
| void | calibrate (U32 timeCheck=10, bool dbg=false) |
| void | setMagneticDeclination (int degrees, U8 minutes) |
| void | reset () |
| void | setCalibration (int x_min, int x_max, int y_min, int y_max, int z_min, int z_max) |
| float | getCalibrationScale (U8 index) |
| void | setCalibrationScales (float x_scale=1.0f, float y_scale=1.0f, float z_scale=1.0f) |
| void | setCalibrationOffsets (float x_offset=0.0f, float y_offset=0.0f, float z_offset=0.0f) |
| float | getCalibrationOffset (U8 index) |
| int | getX () |
| double | gaussX () |
| int | getY () |
| double | gaussY () |
| int | getZ () |
| double | gaussZ () |
| int | getAzimuth () |
| void | getDirection (char *myArray, int azimuth) |
| U8 | getBearing (int azimuth) |
| void | clearCalibration () |
| int | temperature () |
|
|
|
Create the class |
|
||||||||||||
|
Automatic calibration. This will provide calibration settings for your QMC5883L chip.
|
|
|
Remove any calibration data |
|
|
Read the X axis as Gauss
|
|
|
Read the Y axis as Gauss
|
|
|
Read the Z axis as Gauss
|
|
|
Calculate the azimuth (in degrees) Correct the value with magnetic declination if defined.
|
|
|
Divide the 360 degree circle into 16 equal parts and then return the a value of 0-15 based on where the azimuth is currently pointing.
|
|
|
Set the calibrations offset of each axys
|
|
|
Get calibration scale of each axys
|
|
||||||||||||
|
This will take the location of the azimuth as calculated in getBearing() and then produce an array of chars as a text representation of the direction.
|
|
|
Read the X axis
|
|
|
Read the Y axis
|
|
|
Read the Z axis
|
|
||||||||||||||||
|
Must be the first command after creating the otQMC5883 object.
|
|
|
Read the XYZ axis and save the values in an array. |
|
|
Reset device |
|
||||||||||||||||||||||||||||
|
Set calibration values for more accurate readings See: TheNitek [https://github.com/TheNitek]
|
|
||||||||||||||||
|
Set the calibrations offset of each axys
|
|
||||||||||||||||
|
Set the calibrations scale of each axys
|
|
||||||||||||
|
Define the magnetic declination for accurate degrees. see: https://www.magnetic-declination.com/ Example: Pisa in Italy as +3degree and 7' use: setMagneticDeclination(3, 7);
|
|
||||||||||||||||||||
|
Set the chip mode. /see OP_MODE
|
|
|
Return temperature sensor output is in 2’s complement.
|