modm API documentation
|
#include <modm/driver/inertial/lis3mdl.hpp>
Public Typedefs | |
typedef modm::Configuration< Control1_t, DataRate, Bit6|Bit5|Bit4|Bit3|Bit2|Bit1 > | DataRate_t |
typedef modm::Configuration< Control1_t, HighSpeedModes, Bit2|Bit1, 4 > | HighSpeedModes_t |
typedef modm::Configuration< Control2_t, Scale, Bit6|Bit5 > | Scale_t |
typedef modm::Configuration< Control3_t, OperationMode, Bit1|Bit0 > | OperationMode_t |
typedef modm::Configuration< Control4_t, HighSpeedModes, Bit2|Bit1, 2 > | HighSpeedModesZ_t |
Public Member Functions | |
MODM_FLAGS8 (Control1) | |
MODM_FLAGS8 (Control2) | |
MODM_FLAGS8 (Control3) | |
MODM_FLAGS8 (Control4) | |
MODM_FLAGS8 (Control5) | |
MODM_FLAGS8 (Status) | |
Lis3mdl (uint8_t address=0x1C) | |
Construct a driver object for the LIS3MDL chip. More... | |
modm::ResumableResult< bool > | configure (DataRate rate, Scale scale) |
Configures the sensor This method will setup the data rate and the scale with which the sensor will sample the data. More... | |
modm::ResumableResult< bool > | setMode (OperationMode mode) |
Sets the mode of the sensor. More... | |
Scale | getScale () |
Get the currently configured scale for the magnetometer. More... | |
modm::ResumableResult< bool > | readMagnetometerRaw (Vector3i &data) |
Reads out the raw magnetometer into a given vector object. More... | |
modm::ResumableResult< bool > | readMagnetometer (Vector3f &data) |
Reads out the scaled magnetometer data in gauss. More... | |
void | attachConfigurationHandler (I2c::ConfigurationHandler handler) |
modm::ResumableResult< bool > | ping () |
modm::ResumableResult< bool > | read (uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
void | setAddress (uint8_t address) |
modm::ResumableResult< bool > | write (const uint8_t *buffer, std::size_t size) |
Starts a write transaction and waits until finished. | |
modm::ResumableResult< bool > | writeRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
Starts a write-read transaction and waits until finished. | |
Protected Member Functions | |
int8_t | getResumableDepth () const |
bool | isResumableRunning () const |
bool | isTransactionRunning () |
modm::ResumableResult< bool > | read (uint8_t reg, uint8_t &value) |
read a 8bit value | |
modm::ResumableResult< bool > | read (uint8_t reg, uint8_t *buffer, uint8_t length) |
read multiple 8bit values from a start register | |
modm::ResumableResult< bool > | runTransaction () |
Starts our own transaction and waits until finished. | |
bool | startRead (uint8_t *buffer, std::size_t size) |
Configures the transaction with a read operation and starts it. | |
bool | startTransaction () |
Starts the transaction with our own transaction object. | |
bool | startTransaction (modm::I2cTransaction *transaction) |
Starts the transaction with a separate transaction object. | |
bool | startWrite (const uint8_t *buffer, std::size_t size) |
Configures the transaction with a write operation and starts it. | |
bool | startWriteRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize) |
Configures the transaction with a write/read operation and starts it. | |
void | stopResumable () |
bool | wasTransactionSuccessful () |
modm::ResumableResult< bool > | write (uint8_t reg, uint8_t value) |
write a 8bit value | |
Protected Attributes | |
I2cWriteReadTransaction | transaction |
Static Protected Attributes | |
static constexpr float | convTable [4] |
|
strong |
|
strong |
Control Register 2.
Enum Values | Documentation |
---|---|
FS1 | Full-Scale configuration bit 1. |
FS0 | Full-Scale configuration bit 0. |
REBOOT | Reboot memory content. |
SOFT_RST | Soft reset. |
|
strong |
|
strong |
Control Register 4.
Enum Values | Documentation |
---|---|
OMZ_1 | Operation Mode for z axis bit 1. |
OMZ_0 | Operation Mode for z axis bit 1. |
BLE | Bit order of the data output (0 = little endian, 1 = big endian) |
|
strong |
Control Register 5.
Enum Values | Documentation |
---|---|
FAST_READ | Fast read enable. |
BDU | Blocking read. |
|
strong |
Output Data Rates for the Magnetometer sensor.
|
strong |
|
strong |
Enum Values | Documentation |
---|---|
WHO_AM_I | Contains 0x3D. |
CTRL1 | Control register 1: rw. |
CTRL2 | Control register 2: rw. |
CTRL3 | Control register 3: rw. |
CTRL4 | Control register 4: rw. |
CTRL5 | Control register 5: rw. |
STATUS | |
OUT_X_L | Angular rates output x-axis register low. |
OUT_X_H | Angular rates output x-axis register high. |
OUT_Y_L | Angular rates output y-axis register low. |
OUT_Y_H | Angular rates output y-axis register high. |
OUT_Z_L | Angular rates output z-axis register low. |
OUT_Z_H | Angular rates output z-axis register high. |
OUT_TEMP_L | Temperature output register low. |
OUT_TEMP_H | Temperature output register high. |
INT_CFG | Interrupt Configuration Register. |
INT_SRC | Interrupt Source Register. |
INT_THS_L | Interrupt Threshold Value Low. |
INT_THS_H | Interrupt Threshold Value High. |
|
strong |
|
strong |
|
inheritedinline |
Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.
modm::ResumableResult<bool> modm::lis3mdl< I2cMaster >::configure | ( | DataRate | rate, |
Scale | scale | ||
) |
Configures the sensor This method will setup the data rate and the scale with which the sensor will sample the data.
rate | The sample rate for the sensor |
scale | The full scale of the output data |
Get the currently configured scale for the magnetometer.
|
inheritedinlineprotected |
true
when transaction is busy. modm::lis3mdl< I2cMaster >::Lis3mdl | ( | uint8_t | address = 0x1C | ) |
|
inheritedinline |
true | device responds to address |
false | no device with address found |
modm::ResumableResult<bool> modm::lis3mdl< I2cMaster >::readMagnetometer | ( | Vector3f & | data | ) |
Reads out the scaled magnetometer data in gauss.
data | A reference to a Vector3f object the data will be written to |
modm::ResumableResult<bool> modm::lis3mdl< I2cMaster >::readMagnetometerRaw | ( | Vector3i & | data | ) |
Reads out the raw magnetometer into a given vector object.
data | A reference to a Vector3i object the data will be written to |
|
inheritedinline |
Sets a new address of the slave device.
address | the slave address not yet shifted left (address < 128). |
modm::ResumableResult<bool> modm::lis3mdl< I2cMaster >::setMode | ( | OperationMode | mode | ) |
Sets the mode of the sensor.
mode | The mode on which the magnetometer operates |
|
inheritedinlineprotected |
true
when transaction did not return an error.
|
staticprotectedconstexpr |