Engduino v2.1
|
This is the driver code for Magnetometer on the Engduino In v2.1 this magnetometer is a freescale FXMS3110. More...
Files | |
file | EngduinoMagnetometer.cpp |
Engduino magnetometer driver. | |
file | EngduinoMagnetometer.h |
Engduino Magnetometer driver. | |
Functions | |
EngduinoMagnetometerClass::EngduinoMagnetometerClass () | |
Constructor. | |
void | EngduinoMagnetometerClass::begin () |
begin function - must be called before using other functions | |
void | EngduinoMagnetometerClass::end () |
end function - switch off the magnetometer | |
void | EngduinoMagnetometerClass::xyz (float buf[3]) |
Read the xyz values from the magnetometer. | |
int8_t | EngduinoMagnetometerClass::temperature () |
Read the temperature value from the magnetometer. |
This is the driver code for Magnetometer on the Engduino In v2.1 this magnetometer is a freescale FXMS3110.
void EngduinoMagnetometerClass::begin | ( | ) |
begin function - must be called before using other functions
This function enables the magnetometer. The magnetometer is an I2C device so we initialise the I2C communications, make contact with the magnetometer, and check that it's what we think it is.
We set the sampling rate to 10Hz, but where the values are from a heavily oversampled set of values
Definition at line 42 of file EngduinoMagnetometer.cpp.
void EngduinoMagnetometerClass::end | ( | ) |
end function - switch off the magnetometer
Send the magnetometer to sleep
Definition at line 92 of file EngduinoMagnetometer.cpp.
EngduinoMagnetometerClass::EngduinoMagnetometerClass | ( | ) |
Constructor.
C++ constructor for this class. Empty.
Definition at line 27 of file EngduinoMagnetometer.cpp.
int8_t EngduinoMagnetometerClass::temperature | ( | ) |
Read the temperature value from the magnetometer.
Get the temperature as measured by the magnetometer - the temperature of the die. The register contains the die temperature in degrees C expressed as an 8-bit 2's complement number. The sensitivity of the temperature sensor is factory trimmed to 1°C/LSB. The temperature sensor offset is not factory trimmed and must be calibrated by the user software if higher absolute accuracy is required. Note: The register allows for temperature measurements from -128°C to 127°C but the output range is limited to -40°C to 125°C. The temperature data is updated on every measurement cycle.
Definition at line 150 of file EngduinoMagnetometer.cpp.
void EngduinoMagnetometerClass::xyz | ( | float | buf[3] | ) |
Read the xyz values from the magnetometer.
buf | A buffer of floats to put the magnetometer values into |
Get the instantaneous magnetometer values for the xyz axes. Convert the 16 bit digital value to a float value.
Definition at line 107 of file EngduinoMagnetometer.cpp.