QMC5883L Compass Driver for XRCU. More...
#include <Qmc5883l.h>
Public Member Functions | |
| Qmc5883l (const uint32_t init_port) | |
| Creates a new Qmc5883l object. | |
| bool | begin (const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Configures the settings of the I2C bus and the QMC5883L magnetometer. | |
| bool | begin (const Compass_cal_vals_t compass_cal_values, const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Configures the settings of the I2C bus and the QMC5883L magnetometer. | |
| bool | reset () |
| Software-resets the QMC5883L. | |
| bool | update () |
| Fetches and updates new data from the compass. | |
| int16_t | get_raw_temp () |
| Gets the raw temperature reading. | |
| uint8_t | id () |
| Reads the identification register. | |
| bool | is_mag_present () |
| Checks for the presence of the HMC5883L magnetometer on the I2C bus. | |
Public Member Functions inherited from General_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. | |
Additional Inherited Members | |
Protected Member Functions inherited from General_compass | |
| void | set_raw_data (Mag_field_raw_t data) |
| Sets the latest raw values of magnetic field strength in 3 axes. | |
| void | set_cal_vals (Compass_cal_vals_t vals) |
| Sets the calibration values. | |
| Compass_cal_vals_t | get_eeprom_caled_vals () |
| Loads calibration values from EEPROM. | |
| void | use_eeprom_re_zero_heading () |
| Uses the re-zero heading from EEPROM. | |
| General_compass () | |
| Creates a General_compass object. | |
Protected Member Functions inherited from Heading_sensor | |
| Heading_sensor () | |
| Creates a Heading_sensor object. | |
Protected Member Functions inherited from Supported_sensor | |
| Supported_sensor () | |
| Creates an object of a supported sensor. | |
Protected Member Functions inherited from Supported_module | |
| Supported_module () | |
| Creates an object of a supported module. | |
QMC5883L Compass Driver for XRCU.
| Qmc5883l::Qmc5883l | ( | const uint32_t | init_port | ) |
Creates a new Qmc5883l object.
| init_port | the I2C port connected to this QMC5883L magnetometer. |
| bool Qmc5883l::begin | ( | const Compass_cal_vals_t | compass_cal_values, |
| const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS ) |
Configures the settings of the I2C bus and the QMC5883L magnetometer.
YOU MUST CALL THIS FUNCTION IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY.
| compass_cal_values | the calibrated values of the QMC5883L magnetometer |
| init_i2c_address | the 7-bit I2C address of the QMC5883L magnetometer |
true if activation succeed, false if activation failed | bool Qmc5883l::begin | ( | const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS | ) |
Configures the settings of the I2C bus and the QMC5883L magnetometer.
YOU MUST CALL THIS FUNCTION IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY.
| init_i2c_address | the 7-bit I2C address of the QMC5883L magnetometer |
true if activation succeed, false if activation failed | int16_t Qmc5883l::get_raw_temp | ( | ) |
Gets the raw temperature reading.
The gain is factory-calibrated, but not the offset, so only the relative temperature is accurate.
| uint8_t Qmc5883l::id | ( | ) |
Reads the identification register.
"H4C" | bool Qmc5883l::is_mag_present | ( | ) |
Checks for the presence of the HMC5883L magnetometer on the I2C bus.
true if the HMC5883L magnetometer is found on the I2C bus, false otherwise | bool Qmc5883l::reset | ( | ) |
Software-resets the QMC5883L.
true if software-reset signal is sent successfully, false if the signal failed to send
|
virtual |
Fetches and updates new data from the compass.
true if new data is fetched and updated, false if new data is not ready Implements General_compass.