Emilio Salomone / X_NUCLEO_IKS01A2

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IKS01A2 by ST

Embed: (wiki syntax)

« Back to documentation index

LSM303AGRMagSensor Class Reference

LSM303AGRMagSensor Class Reference

Abstract class of an LSM303AGR Inertial Measurement Unit (IMU) 6 axes sensor. More...

#include <LSM303AGRMagSensor.h>

Public Member Functions

 LSM303AGRMagSensor (DevI2C &i2c)
 Constructor.
 LSM303AGRMagSensor (DevI2C &i2c, uint8_t address)
 Constructor.
virtual int init (void *init)
 Initializing the component.
virtual int read_id (uint8_t *id)
 Read ID of LSM303AGR Magnetometer.
virtual int get_m_axes (int32_t *pData)
 Read data from LSM303AGR Magnetometer.
virtual int get_m_axes_raw (int16_t *pData)
 Read raw data from LSM303AGR Magnetometer.
int enable (void)
 Enable LSM303AGR magnetometer.
int disable (void)
 Disable LSM303AGR magnetometer.
int get_m_sensitivity (float *pfData)
 Read Magnetometer Sensitivity.
int get_m_odr (float *odr)
 Read LSM303AGR Magnetometer output data rate.
int set_m_odr (float odr)
 Set ODR.
int get_m_fs (float *fullScale)
 Read LSM303AGR Magnetometer full scale.
int set_m_fs (float fullScale)
 Set full scale.
int read_reg (uint8_t reg, uint8_t *data)
 Read magnetometer data from register.
int write_reg (uint8_t reg, uint8_t data)
 Write magnetometer data to register.
uint8_t io_read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data.
uint8_t io_write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data.

Detailed Description

Abstract class of an LSM303AGR Inertial Measurement Unit (IMU) 6 axes sensor.

Definition at line 58 of file LSM303AGRMagSensor.h.


Constructor & Destructor Documentation

LSM303AGRMagSensor ( DevI2C &  i2c )

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance

Definition at line 53 of file LSM303AGRMagSensor.cpp.

LSM303AGRMagSensor ( DevI2C &  i2c,
uint8_t  address 
)

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance

Definition at line 62 of file LSM303AGRMagSensor.cpp.


Member Function Documentation

int disable ( void   )

Disable LSM303AGR magnetometer.

Return values:
0in case of success, an error code otherwise

Definition at line 123 of file LSM303AGRMagSensor.cpp.

int enable ( void   )

Enable LSM303AGR magnetometer.

Return values:
0in case of success, an error code otherwise

Definition at line 108 of file LSM303AGRMagSensor.cpp.

int get_m_axes ( int32_t *  pData ) [virtual]

Read data from LSM303AGR Magnetometer.

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

Definition at line 160 of file LSM303AGRMagSensor.cpp.

int get_m_axes_raw ( int16_t *  pData ) [virtual]

Read raw data from LSM303AGR Magnetometer.

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

Definition at line 202 of file LSM303AGRMagSensor.cpp.

int get_m_fs ( float *  fullScale )

Read LSM303AGR Magnetometer full scale.

Parameters:
fullScalethe pointer to the output data rate
Return values:
0in case of success, an error code otherwise

Definition at line 286 of file LSM303AGRMagSensor.cpp.

int get_m_odr ( float *  odr )

Read LSM303AGR Magnetometer output data rate.

Parameters:
odrthe pointer to the output data rate
Return values:
0in case of success, an error code otherwise

Definition at line 228 of file LSM303AGRMagSensor.cpp.

int get_m_sensitivity ( float *  pfData )

Read Magnetometer Sensitivity.

Parameters:
pfDatathe pointer where the magnetometer sensitivity is stored
Return values:
0in case of success, an error code otherwise

Definition at line 190 of file LSM303AGRMagSensor.cpp.

int init ( void *  init ) [virtual]

Initializing the component.

Parameters:
[in]initpointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Definition at line 72 of file LSM303AGRMagSensor.cpp.

uint8_t io_read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
)

Utility function to read data.

Parameters:
pBuffer,:pointer to data to be read.
RegisterAddr,:specifies internal address register to be read.
NumByteToRead,:number of bytes to be read.
Return values:
0if ok, an error code otherwise.

Definition at line 84 of file LSM303AGRMagSensor.h.

uint8_t io_write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
)

Utility function to write data.

Parameters:
pBuffer,:pointer to data to be written.
RegisterAddr,:specifies internal address register to be written.
NumByteToWrite,:number of bytes to write.
Return values:
0if ok, an error code otherwise.

Definition at line 96 of file LSM303AGRMagSensor.h.

int read_id ( uint8_t *  id ) [virtual]

Read ID of LSM303AGR Magnetometer.

Parameters:
p_idthe pointer where the ID of the device is stored
Return values:
0in case of success, an error code otherwise

Definition at line 139 of file LSM303AGRMagSensor.cpp.

int read_reg ( uint8_t  reg,
uint8_t *  data 
)

Read magnetometer data from register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success
1in case of failure

Definition at line 311 of file LSM303AGRMagSensor.cpp.

int set_m_fs ( float  fullScale )

Set full scale.

Parameters:
fullScalethe full scale to be set
Return values:
0in case of success, an error code otherwise

Definition at line 298 of file LSM303AGRMagSensor.cpp.

int set_m_odr ( float  odr )

Set ODR.

Parameters:
odrthe output data rate to be set
Return values:
0in case of success, an error code otherwise

Definition at line 263 of file LSM303AGRMagSensor.cpp.

int write_reg ( uint8_t  reg,
uint8_t  data 
)

Write magnetometer data to register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success
1in case of failure

Definition at line 329 of file LSM303AGRMagSensor.cpp.