General Compass Driver.
More...
#include <General_compass.h>
|
| virtual bool | update ()=0 |
| | Fetches and updates new data from the compass.
|
| |
| int16_t | get_raw_x () |
| | Gets the magnetic field strength in X-axis in raw value.
|
| |
| int16_t | get_raw_y () |
| | Gets the magnetic field strength in Y-axis in raw value.
|
| |
| int16_t | get_raw_z () |
| | Gets the magnetic field strength in Z-axis in raw value.
|
| |
| Mag_field_raw_t | get_raw_mag () |
| | Gets a package of magnetic field strengths in 3 axes in raw value.
|
| |
| double | get_uT_x () |
| | Gets the magnetic field strength in X-axis in µT (microTesla).
|
| |
| double | get_uT_y () |
| | Gets the magnetic field strength in Y-axis in µT (microTesla).
|
| |
| double | get_uT_z () |
| | Gets the magnetic field strength in Z-axis in µT (microTesla).
|
| |
| Mag_field_uT_t | get_uT_mag () |
| | Gets a package of magnetic field strengths in 3 axes in µT (microTesla).
|
| |
| bool | compass_cal () |
| | Calibrates the compass, and find the ranges of each axis respectively for compass usage.
|
| |
| Compass_cal_vals_t | get_prev_caled_vals () |
| | Gets the previously calibrated values of the compass.
|
| |
|
void | save_caled_vals () |
| | Saves the calibrated values into local EEPROM.
|
| |
| bool | reset_heading () |
| | Takes the current heading of compass as zero.
|
| |
| int16_t | get_re_zero_heading () |
| | Gets the real-world heading referenced as zero-degrees.
|
| |
|
void | save_re_zero_heading () |
| | Saves the real-world heading referenced as zero-degrees into local EEPROM.
|
| |
| virtual uint16_t | get_heading () |
| | Gets the heading of compass in degrees.
|
| |
General Compass Driver.
Handles high-level calibration, retrieve heading and reset heading.
- Author
- YH Choi @ JM9
◆ compass_cal()
| bool General_compass::compass_cal |
( |
| ) |
|
Calibrates the compass, and find the ranges of each axis respectively for compass usage.
This function calibrates in a blocking manner. When this function is returned, calibration is guaranteed to be either completed or failed. ATTENTION: WHEN MAGNETOMETER CALIBRATION IS IN PROGRESS, SWING THE CHIP IN ALL DIRECTIONS OF X, Y AND Z.
- Returns
true if compass is successfully calibrated, false otherwise
◆ get_eeprom_caled_vals()
Loads calibration values from EEPROM.
- Returns
- The previously calibrated values of the compass stored in EEPROM.
◆ get_heading()
| uint16_t General_compass::get_heading |
( |
| ) |
|
|
virtual |
Gets the heading of compass in degrees.
- Returns
- the heading of compass in degrees [ 0 : 359 ]
Implements Heading_sensor.
◆ get_prev_caled_vals()
Gets the previously calibrated values of the compass.
- Returns
- the previously calibrated values of the compass
◆ get_raw_mag()
Gets a package of magnetic field strengths in 3 axes in raw value.
- Returns
- a package of raw values measured by the magnetometer in 3 axes
◆ get_raw_x()
| int16_t General_compass::get_raw_x |
( |
| ) |
|
Gets the magnetic field strength in X-axis in raw value.
- Returns
- the raw value of magnetic field strength measured by the magnetometer in the X-axis
◆ get_raw_y()
| int16_t General_compass::get_raw_y |
( |
| ) |
|
Gets the magnetic field strength in Y-axis in raw value.
- Returns
- the raw value of magnetic field strength measured by the magnetometer in the Y-axis
◆ get_raw_z()
| int16_t General_compass::get_raw_z |
( |
| ) |
|
Gets the magnetic field strength in Z-axis in raw value.
- Returns
- the raw value of magnetic field strength measured by the magnetometer in the Z-axis
◆ get_re_zero_heading()
| int16_t General_compass::get_re_zero_heading |
( |
| ) |
|
Gets the real-world heading referenced as zero-degrees.
- Returns
- the real-world heading that is referenced as zero-degrees in our program
◆ get_uT_mag()
Gets a package of magnetic field strengths in 3 axes in µT (microTesla).
- Returns
- a package of magnetic field strength measured by the magnetometer in 3 axes
◆ get_uT_x()
| double General_compass::get_uT_x |
( |
| ) |
|
Gets the magnetic field strength in X-axis in µT (microTesla).
- Returns
- the magnetic field strength measured by the magnetometer in the X-axis
◆ get_uT_y()
| double General_compass::get_uT_y |
( |
| ) |
|
Gets the magnetic field strength in Y-axis in µT (microTesla).
- Returns
- the magnetic field strength measured by the magnetometer in the Y-axis
◆ get_uT_z()
| double General_compass::get_uT_z |
( |
| ) |
|
Gets the magnetic field strength in Z-axis in µT (microTesla).
- Returns
- the magnetic field strength measured by the magnetometer in the Z-axis
◆ reset_heading()
| bool General_compass::reset_heading |
( |
| ) |
|
|
virtual |
Takes the current heading of compass as zero.
- Returns
true if compass heading is resetted, false otherwise.
Implements Heading_sensor.
◆ set_cal_vals()
Sets the calibration values.
- Parameters
-
| vals | the calibration values |
◆ set_raw_data()
Sets the latest raw values of magnetic field strength in 3 axes.
- Parameters
-
| data | the latest raw values of magnetic field strength in 3 axes |
◆ update()
| virtual bool General_compass::update |
( |
| ) |
|
|
pure virtual |
Fetches and updates new data from the compass.
- Returns
true if new data is fetched and updated, false if new data is not ready
Implemented in Hmc5883l, and Qmc5883l.
The documentation for this class was generated from the following files: