Workshop example

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Embed: (wiki syntax)

« Back to documentation index

LIS3MDL Class Reference

Class representing a LIS3MDL sensor component. More...

#include <lis3mdl_class.h>

Public Member Functions

 LIS3MDL (DevI2C *i2c, uint8_t address=LIS3MDL_M_MEMS_ADDRESS_HIGH, PinName int_pin=NC)
 Constructor.
virtual ~LIS3MDL ()
 Destructor.

Protected Member Functions

MAGNETO_StatusTypeDef LIS3MDL_Init (MAGNETO_InitTypeDef *LIS3MDL_Init)
 Set LIS3MDL Initialization.
MAGNETO_StatusTypeDef LIS3MDL_Read_M_ID (uint8_t *m_id)
 Read ID of LIS3MDL Magnetic sensor.
MAGNETO_StatusTypeDef LIS3MDL_M_GetAxes (int32_t *pData)
 Read data from LIS3MDL Magnetic sensor and calculate Magnetic in mgauss.
MAGNETO_StatusTypeDef LIS3MDL_M_GetAxesRaw (int16_t *pData)
 Read raw data from LIS3MDL Magnetic sensor output register.
void LIS3MDL_IO_ITConfig (void)
 Configures LIS3MDL interrupt lines for NUCLEO boards.
MAGNETO_StatusTypeDef LIS3MDL_IO_Init (void)
 Configures LIS3MDL I2C interface.
MAGNETO_StatusTypeDef LIS3MDL_IO_Read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data from LIS3MDL.
MAGNETO_StatusTypeDef LIS3MDL_IO_Write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data to LIS3MDL.

Detailed Description

Class representing a LIS3MDL sensor component.

Definition at line 52 of file lis3mdl_class.h.


Constructor & Destructor Documentation

LIS3MDL ( DevI2C *  i2c,
uint8_t  address = LIS3MDL_M_MEMS_ADDRESS_HIGH,
PinName  int_pin = NC 
)

Constructor.

Parameters:
[in]i2cdevice I2C to be used for communication

Definition at line 67 of file lis3mdl_class.cpp.

virtual ~LIS3MDL (  ) [virtual]

Destructor.

Definition at line 66 of file lis3mdl_class.h.


Member Function Documentation

MAGNETO_StatusTypeDef LIS3MDL_Init ( MAGNETO_InitTypeDef LIS3MDL_Init ) [protected]

Set LIS3MDL Initialization.

Parameters:
LIS3MDL_Initthe configuration setting for the LIS3MDL
Return values:
MAGNETO_OKin case of success, an error code otherwise

Definition at line 89 of file lis3mdl_class.cpp.

MAGNETO_StatusTypeDef LIS3MDL_IO_Init ( void   ) [protected]

Configures LIS3MDL I2C interface.

Returns:
MAGNETO_OK in case of success, an error code otherwise

Definition at line 105 of file lis3mdl_class.h.

void LIS3MDL_IO_ITConfig ( void   ) [protected]

Configures LIS3MDL interrupt lines for NUCLEO boards.

Definition at line 96 of file lis3mdl_class.h.

MAGNETO_StatusTypeDef LIS3MDL_IO_Read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
) [protected]

Utility function to read data from LIS3MDL.

Parameters:
[out]pBufferpointer to the byte-array to read data in to
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToReadnumber of bytes to be read.
Return values:
MAGNETO_OKif ok,
MAGNETO_ERRORif an I2C error has occured

Definition at line 118 of file lis3mdl_class.h.

MAGNETO_StatusTypeDef LIS3MDL_IO_Write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
) [protected]

Utility function to write data to LIS3MDL.

Parameters:
[in]pBufferpointer to the byte-array data to send
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToWritenumber of bytes to write.
Return values:
MAGNETO_OKif ok,
MAGNETO_ERRORif an I2C error has occured

Definition at line 158 of file lis3mdl_class.h.

MAGNETO_StatusTypeDef LIS3MDL_M_GetAxes ( int32_t *  pData ) [protected]

Read data from LIS3MDL Magnetic sensor and calculate Magnetic in mgauss.

Parameters:
pDatathe pointer where the magnetometer data are stored
Return values:
MAGNETO_OKin case of success, an error code otherwise

Definition at line 225 of file lis3mdl_class.cpp.

MAGNETO_StatusTypeDef LIS3MDL_M_GetAxesRaw ( int16_t *  pData ) [protected]

Read raw data from LIS3MDL Magnetic sensor output register.

Parameters:
pDatathe pointer where the magnetometer raw data are stored
Return values:
MAGNETO_OKin case of success, an error code otherwise

Definition at line 188 of file lis3mdl_class.cpp.

MAGNETO_StatusTypeDef LIS3MDL_Read_M_ID ( uint8_t *  m_id ) [protected]

Read ID of LIS3MDL Magnetic sensor.

Parameters:
m_idthe pointer where the ID of the device is stored
Return values:
MAGNETO_OKin case of success, an error code otherwise

Definition at line 172 of file lis3mdl_class.cpp.