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.
Dependents: itracker-mbed-os-example-lis2mdl
LIS2MDL Class Reference
#include <LIS2MDL.h>
Public Member Functions | |
| LIS2MDL (I2C &p_i2c, uint8_t addr) | |
| Public constructor. | |
| void | init (uint8_t MODR) |
| init function to set the sensors initialisation parameters | |
| uint8_t | getChipID () |
| Function to get the CHIP ID. | |
| void | readData (int16_t *destination) |
| Read the raw sensor data destination pointer to the array that will store the results see http://www.st.com/content/ccc/resource/technical/document/datasheet/group3/29/13/d1/e0/9a/4d/4f/30/DM00395193/files/DM00395193.pdf/jcr:content/translations/en.DM00395193.pdf. | |
| uint8_t | status () |
| Function to get the status register value. | |
| void | reset () |
| Function to reset the LIS2MDL sensor. | |
| void | offsetBias (float *dest1, float *dest2) |
| Function to generate the offset bias stored in the chip as part of the calib. | |
| int16_t | readTemperature () |
| Function to read the temperature of the internal tempo sensor. | |
| void | lis2mdlSelfCheck () |
| Self check function for the sensor. | |
| void | writeByte (uint8_t address, uint8_t subAddress, uint8_t data) |
| I2C function for writing a Byte to the LIS2MDL sensor. | |
| uint8_t | readByte (uint8_t address, char subAddress) |
| I2C function for reading a Byte from the LIS2MDL sensor. | |
| void | readBytes (uint8_t address, uint8_t subAddress, uint8_t count, char *dest) |
| I2C function for reading many Bytes from the LIS2MDL sensor. | |
Detailed Description
LIS2MDL class.
Used for interfacing with the LIS2MDL sensor on board the itracker
Definition at line 54 of file LIS2MDL.h.
Constructor & Destructor Documentation
| LIS2MDL | ( | I2C & | p_i2c, |
| uint8_t | addr | ||
| ) |
Public constructor.
- Parameters:
-
p_i2c Mbed I2C class object addr Address of the I2C object
Definition at line 11 of file LIS2MDL.cpp.
Member Function Documentation
| uint8_t getChipID | ( | ) |
Function to get the CHIP ID.
- Returns:
- uin8_t returns the chip id. In this can 64 see http://www.st.com/content/ccc/resource/technical/document/datasheet/group3/29/13/d1/e0/9a/4d/4f/30/DM00395193/files/DM00395193.pdf/jcr:content/translations/en.DM00395193.pdf
Definition at line 83 of file LIS2MDL.cpp.
| void init | ( | uint8_t | MODR ) |
init function to set the sensors initialisation parameters
- Parameters:
-
MODR See the MODR legal values in the defines in LIS2MDL.h
Definition at line 69 of file LIS2MDL.cpp.
| void lis2mdlSelfCheck | ( | ) |
Self check function for the sensor.
Definition at line 116 of file LIS2MDL.cpp.
| void offsetBias | ( | float * | dest1, |
| float * | dest2 | ||
| ) |
Function to generate the offset bias stored in the chip as part of the calib.
- Parameters:
-
dest1 Magnetic Bias offset of the sensor dest2 Magnetic Scale offset of the sensor
Definition at line 27 of file LIS2MDL.cpp.
| uint8_t readByte | ( | uint8_t | address, |
| char | subAddress | ||
| ) |
I2C function for reading a Byte from the LIS2MDL sensor.
- Parameters:
-
address address of the sensor subaddress register location to which to write data
Definition at line 181 of file LIS2MDL.cpp.
| void readBytes | ( | uint8_t | address, |
| uint8_t | subAddress, | ||
| uint8_t | count, | ||
| char * | dest | ||
| ) |
I2C function for reading many Bytes from the LIS2MDL sensor.
- Parameters:
-
address address of the sensor subaddress register location to which to write data count number of bytes to read dest pointer to the array which will store the read values
Definition at line 196 of file LIS2MDL.cpp.
| void readData | ( | int16_t * | destination ) |
Read the raw sensor data destination pointer to the array that will store the results see http://www.st.com/content/ccc/resource/technical/document/datasheet/group3/29/13/d1/e0/9a/4d/4f/30/DM00395193/files/DM00395193.pdf/jcr:content/translations/en.DM00395193.pdf.
Definition at line 96 of file LIS2MDL.cpp.
| int16_t readTemperature | ( | ) |
Function to read the temperature of the internal tempo sensor.
- Returns:
- uint8_t temperature reading of the internal temp sensor
Definition at line 107 of file LIS2MDL.cpp.
| void reset | ( | ) |
Function to reset the LIS2MDL sensor.
Definition at line 17 of file LIS2MDL.cpp.
| uint8_t status | ( | ) |
Function to get the status register value.
- Returns:
- uint8_t value of the status register see http://www.st.com/content/ccc/resource/technical/document/datasheet/group3/29/13/d1/e0/9a/4d/4f/30/DM00395193/files/DM00395193.pdf/jcr:content/translations/en.DM00395193.pdf
Definition at line 89 of file LIS2MDL.cpp.
| void writeByte | ( | uint8_t | address, |
| uint8_t | subAddress, | ||
| uint8_t | data | ||
| ) |
I2C function for writing a Byte to the LIS2MDL sensor.
- Parameters:
-
address address of the sensor subaddress register location to which to write data data data to be written
Definition at line 206 of file LIS2MDL.cpp.
Generated on Tue Jul 12 2022 21:48:41 by
1.7.2