Unified sensor driver for the magnetometer.
More...
#include <Adafruit_LIS2MDL.h>
Unified sensor driver for the magnetometer.
◆ Adafruit_LIS2MDL()
Adafruit_LIS2MDL::Adafruit_LIS2MDL |
( |
int32_t |
sensorID = -1 | ) |
|
Instantiates a new Adafruit_LIS2MDL class.
- Parameters
-
sensorID | an option ID to differentiate the sensor from others |
◆ begin()
bool Adafruit_LIS2MDL::begin |
( |
uint8_t |
i2c_address = _ADDRESS_MAG , |
|
|
TwoWire * |
wire = &Wire |
|
) |
| |
Sets up the hardware and initializes I2C.
- Parameters
-
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [1/2]
boolean Adafruit_LIS2MDL::begin_SPI |
( |
uint8_t |
cs_pin, |
|
|
SPIClass * |
theSPI = &SPI |
|
) |
| |
Sets up the hardware and initializes hardware SPI.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
theSPI | The SPI object to be used for SPI connections. |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [2/2]
bool Adafruit_LIS2MDL::begin_SPI |
( |
int8_t |
cs_pin, |
|
|
int8_t |
sck_pin, |
|
|
int8_t |
miso_pin, |
|
|
int8_t |
mosi_pin |
|
) |
| |
Sets up the hardware and initializes software SPI.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
sck_pin | The arduino pin # connected to SPI clock |
miso_pin | The arduino pin # connected to SPI MISO |
mosi_pin | The arduino pin # connected to SPI MOSI |
- Returns
- True if initialization was successful, otherwise false.
◆ getDataRate()
Gets the magnetometer's update rate.
- Returns
- The current data rate as a
lis2mdl_rate_t
◆ setDataRate()
Sets the magnetometer's update rate.
- Parameters
-
rate | The new lis2mdl_rate_t to set |
◆ getEvent()
bool Adafruit_LIS2MDL::getEvent |
( |
sensors_event_t * |
event | ) |
|
Gets the most recent sensor event.
- Parameters
-
event | The sensors_event_t to fill with event data |
- Returns
- true, always
◆ enableInterrupts()
void Adafruit_LIS2MDL::enableInterrupts |
( |
bool |
enable | ) |
|
Enable interrupts.
- Parameters
-
enable | Set to True to enable interrupts, set to False to disable |
◆ interruptsActiveHigh()
void Adafruit_LIS2MDL::interruptsActiveHigh |
( |
bool |
active_high | ) |
|
Sets the polarity of the interrupt pin.
- Parameters
-
active_high | Set to true to make the int pin active high, false to set as active low |
The documentation for this class was generated from the following files: