Honeywell HMC6352 digital compass library.
Dependents: HMC6352_HelloWorld TrackerFinal AntennaTracker TrackingAntenna ... more
HMC6352 Class Reference
Honeywell HMC6352 digital compass. More...
#include <HMC6352.h>
Public Member Functions | |
HMC6352 (PinName sda, PinName scl) | |
Constructor. | |
int | sample (void) |
Sample the device and return the result. | |
void | setSleepMode (int enterOrExit) |
Enter into or exit from sleep mode. | |
void | setReset (void) |
Update bridge offsets. | |
void | setCalibrationMode (int enterOrExit) |
Enter into or exit from calibration mode. | |
void | saveOpMode (void) |
Save the current operation mode byte to EEPROM. | |
int | getSlaveAddress (void) |
Read the memory location on the device which contains the slave address. | |
int | getOffset (int axis) |
Read the current offset for X or Y axis magnetometer. | |
void | setOffset (int axis, int offset) |
Set the offset for X or Y axis magnetometer. | |
int | getTimeDelay (void) |
Get the current time delay. | |
void | setTimeDelay (int delay) |
Set the time delay of the device. | |
int | getSumNumber (void) |
Get the number of measurements being summed each sample. | |
void | setSumNumber (int sum) |
Set the number of measurements being summed each sample. | |
int | getSoftwareVersion (void) |
Get the software version on the device. | |
int | getOpMode (void) |
Get the current operation mode. | |
void | setOpMode (int mode, int periodicSetReset, int measurementRate=0) |
Set the operation mode. | |
int | getOutputMode (void) |
Get the current output mode of the device. | |
void | setOutputMode (int mode) |
Set the output mode of the device. |
Detailed Description
Honeywell HMC6352 digital compass.
Definition at line 100 of file HMC6352.h.
Constructor & Destructor Documentation
HMC6352 | ( | PinName | sda, |
PinName | scl | ||
) |
Constructor.
Includes.
- Parameters:
-
sda mbed pin to use for SDA line of I2C interface. scl mbed pin to use for SCL line of I2C interface.
LICENSE
Copyright (c) 2010 ARM Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
DESCRIPTION
Honeywell HMC6352 digital compass.
Datasheet:
http://www.ssec.honeywell.com/magnetic/datasheets/HMC6352.pdf
Definition at line 40 of file HMC6352.cpp.
Member Function Documentation
int getOffset | ( | int | axis ) |
Read the current offset for X or Y axis magnetometer.
- Parameters:
-
axis 0x00 -> X-axis 0x01 -> Y-axis
- Returns:
- The current offset for the axis as a 16-bit number.
Definition at line 126 of file HMC6352.cpp.
int getOpMode | ( | void | ) |
Get the current operation mode.
- Returns:
- 0x00 -> Standby mode 0x01 -> Query mode 0x02 -> Continuous mode
Definition at line 197 of file HMC6352.cpp.
int getOutputMode | ( | void | ) |
Get the current output mode of the device.
- Returns:
- The current output mode.
Definition at line 230 of file HMC6352.cpp.
int getSlaveAddress | ( | void | ) |
Read the memory location on the device which contains the slave address.
- Returns:
- The slave address of the device.
Definition at line 120 of file HMC6352.cpp.
int getSoftwareVersion | ( | void | ) |
Get the software version on the device.
- Returns:
- The software version number.
Definition at line 191 of file HMC6352.cpp.
int getSumNumber | ( | void | ) |
Get the number of measurements being summed each sample.
- Returns:
- The number of summed measurement.
Definition at line 179 of file HMC6352.cpp.
int getTimeDelay | ( | void | ) |
Get the current time delay.
- Returns:
- The time delay in milliseconds.
Definition at line 167 of file HMC6352.cpp.
int sample | ( | void | ) |
Sample the device and return the result.
- Returns:
- In heading output mode, the current heading as a number between 0-3599, representing 0-359.9 degrees. In raw magnetometer X output mode, the raw output of the X-axis magnetometer. In raw magnetometer Y mode, the raw output of the Y-axis magnetometer. In magnetometer X mode, the corrected output of the X-axis magnetometer. In magnetometer Y mode, the corrected output of the Y-axis magnetometer.
Definition at line 50 of file HMC6352.cpp.
void saveOpMode | ( | void | ) |
Save the current operation mode byte to EEPROM.
Definition at line 109 of file HMC6352.cpp.
void setCalibrationMode | ( | int | enterOrExit ) |
Enter into or exit from calibration mode.
- Parameters:
-
enterOrExit 0x45 -> Exit 0x43 -> Enter
Definition at line 91 of file HMC6352.cpp.
void setOffset | ( | int | axis, |
int | offset | ||
) |
Set the offset for X or Y axis magnetometer.
- Parameters:
-
axis 0x00 -> X-axis 0x01 -> Y-axis offset The offset to set for the axis (set to a 16-bit number).
Definition at line 146 of file HMC6352.cpp.
void setOpMode | ( | int | mode, |
int | periodicSetReset, | ||
int | measurementRate = 0 |
||
) |
Set the operation mode.
- Parameters:
-
mode 0x00 -> Standby mode 0x01 -> Query mode 0x02 -> Continuous mode periodicSetReset 0x00 -> No periodic set/reset 0x01 -> Periodic set/reset Measurement rate in Hz for continuous rate. Possible rates: {1, 5, 10, 20}Hz.
Definition at line 207 of file HMC6352.cpp.
void setOutputMode | ( | int | mode ) |
Set the output mode of the device.
- Parameters:
-
mode 0x00 -> Heading mode 0x01 -> Raw magnetometer X mode 0x02 -> Raw magnetometer Y mode 0x03 -> Magnetometer X mode 0x04 -> Magnetometer Y mode
Definition at line 236 of file HMC6352.cpp.
void setReset | ( | void | ) |
void setSleepMode | ( | int | enterOrExit ) |
Enter into or exit from sleep mode.
- Parameters:
-
enterOrExit 0x57 -> Exit sleep mode 0x53 -> Enter
Definition at line 69 of file HMC6352.cpp.
void setSumNumber | ( | int | sum ) |
Set the number of measurements being summed each sample.
- Parameters:
-
sum The number of measurements to be summed (between 0-16);
Definition at line 185 of file HMC6352.cpp.
void setTimeDelay | ( | int | delay ) |
Set the time delay of the device.
- Parameters:
-
delay The time delay to set in milliseconds (between 0-255);
Definition at line 173 of file HMC6352.cpp.
Generated on Tue Jul 12 2022 16:18:18 by 1.7.2