Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAG3110 MMA8451Q SLCD- TSI USBDevice mbed
MAG3110 Class Reference
MAG3110 Class to read X/Y/Z data from the magentometer. More...
#include <MAG3110.h>
Public Member Functions | |
MAG3110 (PinName sda, PinName scl) | |
Main constructor. | |
MAG3110 (PinName sda, PinName scl, Serial *pc) | |
Debug version of constructor. | |
void | begin () |
Setup the Magnetometer. | |
int | readReg (char regAddr) |
Read a register, return its value as int. | |
int | readVal (char regAddr) |
Read a value from a pair of registers, return as int. | |
float | getHeading () |
Calculate the heading. | |
void | getValues (int *xVal, int *yVal, int *zVal) |
Perform a read on the X, Y and Z values. | |
void | setCalibration (int minX, int maxX, int minY, int maxY) |
Set the calibration parameters if required. |
Detailed Description
MAG3110 Class to read X/Y/Z data from the magentometer.
Definition at line 80 of file MAG3110.h.
Constructor & Destructor Documentation
MAG3110 | ( | PinName | sda, |
PinName | scl | ||
) |
Main constructor.
- Parameters:
-
sda SDA pin sdl SCL pin addr addr of the I2C peripheral
Definition at line 8 of file MAG3110.cpp.
MAG3110 | ( | PinName | sda, |
PinName | scl, | ||
Serial * | pc | ||
) |
Debug version of constructor.
- Parameters:
-
sda SDA pin sdl SCL pin addr Address of the I2C peripheral pc Serial object to output debug messages
Definition at line 14 of file MAG3110.cpp.
Member Function Documentation
void begin | ( | ) |
Setup the Magnetometer.
Definition at line 20 of file MAG3110.cpp.
float getHeading | ( | ) |
void getValues | ( | int * | xVal, |
int * | yVal, | ||
int * | zVal | ||
) |
Perform a read on the X, Y and Z values.
- Parameters:
-
xVal Pointer to X value yVal Pointer to Y value zVal Pointer to Z value
Definition at line 74 of file MAG3110.cpp.
int readReg | ( | char | regAddr ) |
Read a register, return its value as int.
- Parameters:
-
regAddr The address to read
- Returns:
- value in register
Definition at line 38 of file MAG3110.cpp.
int readVal | ( | char | regAddr ) |
Read a value from a pair of registers, return as int.
- Parameters:
-
regAddr The address to read
- Returns:
- Value from 2 consecutive registers
Definition at line 53 of file MAG3110.cpp.
void setCalibration | ( | int | minX, |
int | maxX, | ||
int | minY, | ||
int | maxY | ||
) |
Set the calibration parameters if required.
- Parameters:
-
minX Minimum value for X range maxX Maximum value for X range minY Minimum value for Y range maxY maximum value for Y range
Definition at line 82 of file MAG3110.cpp.
Generated on Wed Jul 13 2022 21:19:18 by
