|
Adafruit LSM303DLH Magnetometer Library
|
Unified sensor driver for the magnetometer. More...
#include <Adafruit_LSM303DLH_Mag.h>
Public Member Functions | |
| Adafruit_LSM303DLH_Mag_Unified (int32_t sensorID=-1) | |
| Instantiates a new Adafruit_LSM303DLH_Mag_Unified class. More... | |
| bool | begin (uint8_t i2c_addr=_ADDRESS_MAG, TwoWire *wire=&Wire) |
| Sets up the hardware and initializes I2C. More... | |
| void | enableAutoRange (bool enable) |
| Enables or disables auto-ranging. More... | |
| void | setMagGain (lsm303MagGain gain) |
| Sets the magnetometer's gain. More... | |
| void | setMagRate (lsm303MagRate rate) |
| Sets the magnetometer's update rate. More... | |
| bool | getEvent (sensors_event_t *) |
| Gets the most recent sensor event. More... | |
| void | getSensor (sensor_t *) |
| Gets the sensor_t data. | |
Public Attributes | |
| lsm303MagData | raw |
| Last read magnetometer data will be available here. | |
| lsm303MagGain | magGain |
| The current magnetometer gain. | |
| bool | autoRangeEnabled |
| True if auto ranging is enabled. | |
Unified sensor driver for the magnetometer.
| Adafruit_LSM303DLH_Mag_Unified::Adafruit_LSM303DLH_Mag_Unified | ( | int32_t | sensorID = -1 | ) |
Instantiates a new Adafruit_LSM303DLH_Mag_Unified class.
| sensorID | an optional identifier for the sensor instance |
| bool Adafruit_LSM303DLH_Mag_Unified::begin | ( | uint8_t | i2c_address = _ADDRESS_MAG, |
| TwoWire * | wire = &Wire |
||
| ) |
Sets up the hardware and initializes I2C.
| i2c_address | The I2C address to be used. |
| wire | The Wire object to be used for I2C connections. |
| void Adafruit_LSM303DLH_Mag_Unified::enableAutoRange | ( | bool | enabled | ) |
Enables or disables auto-ranging.
| enabled | True to enable auto-ranging, false to disable |
| void Adafruit_LSM303DLH_Mag_Unified::setMagGain | ( | lsm303MagGain | gain | ) |
Sets the magnetometer's gain.
| gain | a lsm303MagGain specifying the new gain |
| void Adafruit_LSM303DLH_Mag_Unified::setMagRate | ( | lsm303MagRate | rate | ) |
Sets the magnetometer's update rate.
| rate | A lsm303MagRate specifying the new rate |
| bool Adafruit_LSM303DLH_Mag_Unified::getEvent | ( | sensors_event_t * | event | ) |
Gets the most recent sensor event.
| event | A sensors_event_t to store the event data |
1.8.13