Shih-Ho Hsieh / Mbed 2 deprecated Motor_XYZ_UI_SPI_I2C_5mag

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

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 Pololu5MagInstance (DevI2C *ext_i2c=NULL, DevSPI *ext_spi=NULL)
 Get singleton instance.
static Pololu5MagInstance (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:
\

  1. a LIS3MDL 3-Axis Magnetometer
  2. 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:
trueif initialization successful,
falseotherwise

Definition at line 82 of file pololu5mag.h.

bool Init_LIS3MDL ( void   ) [protected]

Initialize the singleton's magnetometers.

Return values:
trueif initialization successful,
falseotherwise

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]sdaI2C 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]sclI2C 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]mosiSPI 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]misoSPI 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]sclkSPI 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.