Naresh Krish / LIS2MDL

Dependents:   itracker-mbed-os-example-lis2mdl

Embed: (wiki syntax)

« Back to documentation index

LIS2MDL Class Reference

LIS2MDL Class Reference

LIS2MDL class. More...

#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_i2cMbed I2C class object
addrAddress of the I2C object

Definition at line 11 of file LIS2MDL.cpp.


Member Function Documentation

uint8_t getChipID (  )
void init ( uint8_t  MODR )

init function to set the sensors initialisation parameters

Parameters:
MODRSee 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:
dest1Magnetic Bias offset of the sensor
dest2Magnetic 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:
addressaddress of the sensor
subaddressregister 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:
addressaddress of the sensor
subaddressregister location to which to write data
countnumber of bytes to read
destpointer to the array which will store the read values

Definition at line 196 of file LIS2MDL.cpp.

void readData ( int16_t *  destination )
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:
addressaddress of the sensor
subaddressregister location to which to write data
datadata to be written

Definition at line 206 of file LIS2MDL.cpp.