Dependencies: FatFileSystem mbed
HMC5883L Class Reference
Honeywell HMC5883L digital compass. More...
#include <HMC5883L.h>
Public Member Functions | |
HMC5883L (PinName sda, PinName scl) | |
Constructor. | |
void | setSleepMode () |
Enter into sleep mode. | |
void | setDefault () |
Set Device in Default Mode. | |
void | getAddress (char *address) |
Read the memory location on the device which contains the address. | |
void | setOpMode (int mode, int ConfigA, int ConfigB) |
Set the operation mode. | |
void | write (int address, int data) |
Write to on the device. | |
void | readData (int *getMag) |
Get the output of all three axes. | |
int | getMx () |
Get the output of X axis. | |
int | getMy () |
Get the output of Y axis. | |
int | getMz () |
Get the output of Z axis. | |
int | getStatus (void) |
Get the current operation mode. |
Detailed Description
Honeywell HMC5883L digital compass.
Definition at line 117 of file HMC5883L.h.
Constructor & Destructor Documentation
HMC5883L | ( | 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 HMC5883Ldigital compass.
Datasheet:
http://www.ssec.honeywell.com/magnetic/datasheets/HMC5883L.pdf
Definition at line 40 of file HMC5883L.cpp.
Member Function Documentation
void getAddress | ( | char * | address ) |
Read the memory location on the device which contains the address.
- Parameters:
-
Pointer to a buffer to hold the address value Expected H, 4 and 3.
Definition at line 78 of file HMC5883L.cpp.
int getMx | ( | ) |
Get the output of X axis.
- Returns:
- x-axis magnetic value
Definition at line 136 of file HMC5883L.cpp.
int getMy | ( | ) |
Get the output of Y axis.
- Returns:
- y-axis magnetic value
Definition at line 149 of file HMC5883L.cpp.
int getMz | ( | ) |
Get the output of Z axis.
- Returns:
- z-axis magnetic value
Definition at line 163 of file HMC5883L.cpp.
int getStatus | ( | void | ) |
Get the current operation mode.
- Returns:
- Status register values
void readData | ( | int * | getMag ) |
Get the output of all three axes.
- Parameters:
-
Pointer to a buffer to hold the magnetics value for the x-axis, y-axis and z-axis [in that order].
Definition at line 111 of file HMC5883L.cpp.
void setDefault | ( | void | ) |
Set Device in Default Mode.
HMC5883L_CONTINUOUS, HMC5883L_10HZ_NORMAL HMC5883L_1_0GA
Definition at line 69 of file HMC5883L.cpp.
void setOpMode | ( | int | mode, |
int | ConfigA, | ||
int | ConfigB | ||
) |
Set the operation mode.
- Parameters:
-
mode 0x00 -> Continuous 0x01 -> Single 0x02 -> Idle ConfigA values ConfigB values
Definition at line 98 of file HMC5883L.cpp.
void setSleepMode | ( | ) |
Enter into sleep mode.
Definition at line 64 of file HMC5883L.cpp.
void write | ( | int | address, |
int | data | ||
) |
Write to on the device.
- Parameters:
-
address Address to write to. data Data to write.
Definition at line 50 of file HMC5883L.cpp.
Generated on Mon Jul 18 2022 10:05:39 by 1.7.2