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.
Pololu5Mag Class Reference
Class Pololu5Mag is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name. More...
#include <pololu5mag.h>
| Static Public Member Functions | |
| static Pololu5Mag * | Instance (DevI2C *ext_i2c=NULL, DevSPI *ext_spi=NULL) | 
| Get singleton instance. | |
| static Pololu5Mag * | Instance (PinName sda, PinName scl, PinName mosi, PinName miso, PinName sclk) | 
| Get singleton instance. | |
| Protected Member Functions | |
| Pololu5Mag (DevI2C *ext_i2c, DevSPI *ext_spi) | |
| Constructor. | |
| bool | Init (void) | 
| Initialize the singleton's sensors to default settings. | |
| bool | Init_LIS3MDL (void) | 
| Initialize the singleton's magnetometers. | |
Detailed Description
Class Pololu5Mag is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name.
The expansion board is featuring basically five IPs:
\
- a LIS3MDL 3-Axis Magnetometer
 
- and a AltIMU-10 v5 imu
 
It is intentionally implemented as a singleton because only one Pololu5Mag at a time might be deployed in a HW component stack.
 In order to get the singleton instance you have to call class method `Instance()`, e.g.: 
// Inertial & Environmental expansion board singleton instance static Pololu5Mag *<TODO>_expansion_board = Pololu5Mag::Instance();
Definition at line 67 of file pololu5mag.h.
Constructor & Destructor Documentation
| Pololu5Mag | ( | DevI2C * | ext_i2c, | 
| DevSPI * | ext_spi | ||
| ) |  [protected] | 
Constructor.
Definition at line 50 of file pololu5mag.cpp.
Member Function Documentation
| bool Init | ( | void | ) |  [protected] | 
Initialize the singleton's sensors to default settings.
- Return values:
- 
  true if initialization successful, false otherwise 
Definition at line 82 of file pololu5mag.h.
| bool Init_LIS3MDL | ( | void | ) |  [protected] | 
Initialize the singleton's magnetometers.
- Return values:
- 
  true if initialization successful, false otherwise 
Definition at line 157 of file pololu5mag.cpp.
| Pololu5Mag * Instance | ( | PinName | sda, | 
| PinName | scl, | ||
| PinName | mosi, | ||
| PinName | miso, | ||
| PinName | sclk | ||
| ) |  [static] | 
Get singleton instance.
- Returns:
- a pointer to the initialized singleton instance of class Pololu5Mag. A return value of NULL indicates an out of memory situation.
- Parameters:
- 
  [in] sda I2C data line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevI2C will be created based on parameters 'sda' and 'scl'. The used DevI2C object gets saved in instance variable dev_i2c. [in] scl I2C clock line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevI2C will be created based on parameters 'sda' and 'scl'. The used DevI2C object gets saved in instance variable dev_i2c. [in] mosi SPI MOSI line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevSPI will be created based on parameters 'mosi', 'miso' and 'sclk'. The used DevSPI object gets saved in instance variable dev_spi. [in] miso SPI MISO line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevSPI will be created based on parameters 'mosi', 'miso' and 'sclk'. The used DevSPI object gets saved in instance variable dev_spi. [in] sclk SPI clock line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevSPI will be created based on parameters 'mosi', 'miso' and 'sclk'. The used DevSPI object gets saved in instance variable dev_spi. 
Definition at line 132 of file pololu5mag.cpp.
| Pololu5Mag * Instance | ( | DevI2C * | ext_i2c = NULL, | 
| DevSPI * | ext_spi = NULL | ||
| ) |  [static] | 
Get singleton instance.
- Returns:
- a pointer to the initialized singleton instance of class Pololu5Mag. A return value of NULL indicates an out of memory situation.
- Parameters:
- 
  [in] ext_i2c (optional) pointer to an instance of DevI2C to be used for communication on the expansion board. Defaults to NULL. Taken into account only on the very first call of one of the 'Instance' functions. If not provided a new DevI2C will be created with standard configuration parameters. The used DevI2C object gets saved in instance variable ext_i2c. [in] ext_spi (optional) pointer to an instance of DevSPI to be used for communication on the expansion board. Defaults to NULL. Taken into account only on the very first call of one of the 'Instance' functions. If not provided a new DevSPI will be created with standard configuration parameters. The used DevSPI object gets saved in instance variable dev_spi. 
Definition at line 85 of file pololu5mag.cpp.
Generated on Tue Jul 12 2022 17:30:24 by
 1.7.2
 1.7.2