upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the MAG3110 Three-Axis Digital Magnetometer. More...
Description in web-link above: The MAG3110 is a small, low-power digital 3D magnetic sensor with a wide dynamic range to allow operation in PCBs with high extraneous magnetic fields. It measures the components of the local magnetic field, the sum of the geomagnetic field and the magnetic field created by components on the circuit board. It can be used in conjunction with a 3-axis accelerometer so that orientation-independent accurate compass heading information may be achieved It is capable of measuring local magnetic fields up to 10 Gauss with output data rates up to 80 Hz.
Public Member Functions | |
MAG3110 (int bus, uint8_t dros=MAG3110_DROS_DEFAULT, int devAddr=MAG3110_I2C_ADDRESS) | |
int | checkID (void) |
int | setUserOffset (int16_t x, int16_t y, int16_t z) |
int | setActive (void) |
int | setStandby (void) |
int | isReady (void) |
int | sampleData (void) |
int16_t | getX (int bSampleData=0) |
int16_t | getY (int bSampleData=0) |
int16_t | getZ (int bSampleData=0) |
uint8_t | getStatus (void) |
int8_t | getDieTemperature (void) |
int | getData (mag3110_data_t *data, int bSampleData=0) |
MAG3110 | ( | int | bus, |
uint8_t | dros = MAG3110_DROS_DEFAULT , |
||
int | devAddr = MAG3110_I2C_ADDRESS |
||
) |
Instantiates an MAG3110 object
bus | Number of the used bus |
dros | Data rate and over sampling selection |
devAddr | Address of the used I2C device |
int checkID | ( | void | ) |
Check device_id of sensor
int setUserOffset | ( | int16_t | x, |
int16_t | y, | ||
int16_t | z | ||
) |
Set user offset correction Offset correction register will be erased after accelerometer reset
x | Offset correction value for x-axis |
y | Offset correction value for y-axis |
z | Offset correction value for z-axis |
int setActive | ( | void | ) |
Set active mode, this enables periodic measurements
int setStandby | ( | void | ) |
Set standby mode, this disables periodic measurements
int isReady | ( | void | ) |
Check for new set of measurement data.
int sampleData | ( | void | ) |
Read magnetometer's data and saves them to variables
Info: To get the actual values for the magnetic field someone has to divide the returned values from the magnetometer by 10
int16_t getX | ( | int | bSampleData = 0 | ) |
Get x-axis magnetic field strength
bSampleData | Flag to read sensor |
int16_t getY | ( | int | bSampleData = 0 | ) |
Get y-axis magnetic field strength
bSampleData | Flag to read sensor |
int16_t getZ | ( | int | bSampleData = 0 | ) |
Get z-axis magnetic field strength
bSampleData | Flag to read sensor |
uint8_t getStatus | ( | void | ) |
Get value of status register
int8_t getDieTemperature | ( | void | ) |
Get die temperature
int getData | ( | mag3110_data_t * | data, |
int | bSampleData = 0 |
||
) |
Get sensor values
data | Sensor values |
bSampleData | Flag to read sensor |