e-Compass Driver implements the functions to calculate the compass heading based on the accelerometer and magnetometer data.
All functions are taken from and explained in the NXP application note AN4248 "Implementing a Tilt-Compansated eCompass using Accelerometer and Magnetometer Sensors"
Version 1.0
This driver version does not include these features:
Functions | |
int16_t | ecompass_calculate_heading (int16_t iBpx, int16_t iBpy, int16_t iBpz, int16_t iGpx, int16_t iGpy, int16_t iGpz) |
void | ecompass_calibrate_hard_iron (int16_t xAxisOffset, int16_t yAxisOffset, int16_t zAxisOffset) |
int16_t ecompass_calculate_heading | ( | int16_t | iBpx, |
int16_t | iBpy, | ||
int16_t | iBpz, | ||
int16_t | iGpx, | ||
int16_t | iGpy, | ||
int16_t | iGpz | ||
) |
Calculates the current compass heading (in degrees) based on the current accelerometer and magnetometer data.
[in] | iBpx | Magnetometer X-axis reading. |
[in] | iBpy | Magnetometer Y-Axis reading. |
[in] | iBpz | Magnetometer Z-Axis reading. |
[in] | iGpx | Accelerometer X-axis reading. |
[in] | iGpy | Accelerometer Y-axis reading. |
[in] | iGpz | Accelerometer Z-axis reading. |
void ecompass_calibrate_hard_iron | ( | int16_t | xAxisOffset, |
int16_t | yAxisOffset, | ||
int16_t | zAxisOffset | ||
) |
Calibrates the magnetometer by determining the current hard iron offset.
[in] | xAxisOffset | Magnetometer X-axis reading. |
[in] | yAxisOffset | Magnetometer Y-Axis reading. |
[in] | zAxisOffset | Magnetometer Z-Axis reading. |