ST Expansion SW Team / X_NUCLEO_IKS01A2_SPI3W

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON_SPI3W

Dependents:   sensor-node-ble

Fork of X_NUCLEO_IKS01A2 by Licio Mapelli

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, uint8_t address=LSM303AGR_MAG_I2C_ADDRESS, PinName intmag_pin=NC)
 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 59 of file LSM303AGRMagSensor.h.


Constructor & Destructor Documentation

LSM303AGRMagSensor ( DevI2C *  i2c,
uint8_t  address = LSM303AGR_MAG_I2C_ADDRESS,
PinName  intmag_pin = NC 
)

Constructor.

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

Definition at line 72 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 135 of file LSM303AGRMagSensor.cpp.

int enable ( void   )

Enable LSM303AGR magnetometer.

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

Definition at line 120 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 172 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 214 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 298 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 240 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 202 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 84 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 86 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 101 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 151 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 323 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 310 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 275 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 341 of file LSM303AGRMagSensor.cpp.