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.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A2 by
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:
-
i2c object of an helper class which handles the I2C peripheral address the address of the component's instance
Definition at line 53 of file LSM303AGRMagSensor.cpp.
| LSM303AGRMagSensor | ( | DevI2C & | i2c, |
| uint8_t | address | ||
| ) |
Constructor.
- Parameters:
-
i2c object of an helper class which handles the I2C peripheral address the 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:
-
0 in case of success, an error code otherwise
Definition at line 123 of file LSM303AGRMagSensor.cpp.
| int enable | ( | void | ) |
Enable LSM303AGR magnetometer.
- Return values:
-
0 in 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:
-
pData the pointer where the magnetometer data are stored
- Return values:
-
0 in 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:
-
pData the pointer where the magnetomer raw data are stored
- Return values:
-
0 in 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:
-
fullScale the pointer to the output data rate
- Return values:
-
0 in 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:
-
odr the pointer to the output data rate
- Return values:
-
0 in 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:
-
pfData the pointer where the magnetometer sensitivity is stored
- Return values:
-
0 in 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] init pointer to device specific initalization structure.
- Return values:
-
0 in 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:
-
0 if 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:
-
0 if 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_id the pointer where the ID of the device is stored
- Return values:
-
0 in 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:
-
reg register address data register data
- Return values:
-
0 in case of success 1 in case of failure
Definition at line 311 of file LSM303AGRMagSensor.cpp.
| int set_m_fs | ( | float | fullScale ) |
Set full scale.
- Parameters:
-
fullScale the full scale to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 298 of file LSM303AGRMagSensor.cpp.
| int set_m_odr | ( | float | odr ) |
Set ODR.
- Parameters:
-
odr the output data rate to be set
- Return values:
-
0 in 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:
-
reg register address data register data
- Return values:
-
0 in case of success 1 in case of failure
Definition at line 329 of file LSM303AGRMagSensor.cpp.
Generated on Wed Jul 13 2022 13:21:41 by
1.7.2
