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.
Fork of XYZ_sensor_Platform by
MagRing Class Reference
Class mag_ring is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name. More...
#include <mag_ring.h>
Static Public Member Functions | |
| static MagRing * | Instance (DevSPI *ext_spi=NULL) |
| Get singleton instance. | |
| static MagRing * | Instance (PinName mosi, PinName miso, PinName sclk) |
| Get singleton instance. | |
Protected Member Functions | |
| MagRing (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 mag_ring is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name.
The expansion board is featuring basically four IPs:
- a HTS221 Relative Humidity and Temperature Sensor
- a LIS3MDL 3-Axis Magnetometer
- a LPS25H MEMS Pressure Sensor (and Temperature Sensor)
- and a LSM6DS33 3D Acceleromenter and 3D Gyroscope
The expansion board features also a DIL 24-pin socket which makes it possible to add further MEMS adapters and other sensors (e.g. UV index).
It is intentionally implemented as a singleton because only one mag_ring 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 mag_ring *<TODO>_expansion_board = mag_ring::Instance();
Definition at line 77 of file mag_ring.h.
Constructor & Destructor Documentation
Constructor.
Definition at line 50 of file mag_ring.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 92 of file mag_ring.h.
| bool Init_LIS3MDL | ( | void | ) | [protected] |
Initialize the singleton's magnetometers.
- Return values:
-
true if initialization successful, false otherwise
Definition at line 143 of file mag_ring.cpp.
| MagRing * Instance | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk | ||
| ) | [static] |
Get singleton instance.
- Returns:
- a pointer to the initialized singleton instance of class MagRing. A return value of NULL indicates an out of memory situation.
- Parameters:
-
[in] sda SPI data 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 'sda' and 'scl'. The used DevSPI object gets saved in instance variable dev_spi. [in] scl 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 'sda' and 'scl'. The used DevSPI object gets saved in instance variable dev_spi. [in] ff_irq_pin (optional) PinName of the pin associated to asynchronous (i.e. interrupt based) free fall detection in case a LSM6DS33 3D Acceleromenter and 3D Gyroscope is mounted on top of the DIL 24-pin socket. Defaults to NC. Taken into account only on the very first call of one of the 'Instance' functions. A value of 'NC' will avoid instantiation of the LSM6DS33 even if present.
Definition at line 119 of file mag_ring.cpp.
Get singleton instance.
- Returns:
- a pointer to the initialized singleton instance of class MagRing. A return value of NULL indicates an out of memory situation.
- Parameters:
-
[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. [in] ff_irq_pin (optional) PinName of the pin associated to asynchronous (i.e. interrupt based) free fall detection in case a LSM6DS33 3D Acceleromenter and 3D Gyroscope is mounted on top of the DIL 24-pin socket. Defaults to F746ZG_PIN_FF. Taken into account only on the very first call of one of the 'Instance' functions. A value of 'NC' will avoid instantiation of the LSM6DS33 even if present.
Definition at line 81 of file mag_ring.cpp.
Generated on Sat Jul 16 2022 03:43:28 by
1.7.2
