sample/0x00_AccelMagno/AccelMagno.h¶
Enums
-
class
AccelMagno
¶ - #include <AccelMagno.h>
Class for controlling a duinoPRO Accelerometer/Magnetometer module.
Inherits from Module
Public Functions
-
AccelMagno
(int id)¶ Constructor for AccelMagno.
- Parameters
id
: - the location of the AccelMagno module on the duinoPRO baseboard.
-
void
begin
(void)¶ Begin using the AccelMagno module.
-
void
lowPowerMode
(bool lowpower)¶ Enable or disable low-power mode.
- Parameters
lowpower
: - true to enable low-power mode, false to disable.
-
uint8_t
readRegister
(uint8_t addr)¶ Read the value of a register in the LDM303D chip.
- Return
- The register value.
- Parameters
addr
: - Address of the register to be read.
-
void
writeRegister
(uint8_t addr, uint8_t data)¶ Write a value to a register in the LDM303D chip.
- Parameters
addr
: - Address of the register to be written.data
: - The value to be written to the register.
-
void
enableAccel
()¶ Enable accelerometer.
-
void
disableAccel
()¶ Disable accelerometer.
-
void
setAccelFullScale
(uint8_t mode)¶ Set the full-scale range of the accelerometer. The allowable ranges are from +/-2g to +/-16g. Possible values are listed in AccelFullScaleEnum.
- Parameters
mode
: - Value for full-scale range, from AccelFullScaleEnum.
-
void
enableMagno
()¶ Enable magnetometer.
-
void
disableMagno
()¶ Disable magnetometer.
-
void
setMagnoFullScale
(uint8_t mode)¶ Set the full-scale range of the magnetometer. The allowable ranges are from +/-2 Gauss to +/-12 Gauss. Possible values are listed in MagnoFullScaleEnum.
- Parameters
mode
: - Value for full-scale range, from MagnoFullScaleEnum.
-
int16_t
rawAccelX
()¶ Raw X axis accelerometer reading.
- Return
- The raw reading.
-
int16_t
rawAccelY
()¶ Raw Y axis accelerometer reading.
- Return
- The raw reading.
-
int16_t
rawAccelZ
()¶ Raw Z axis accelerometer reading.
- Return
- The raw reading.
-
float
accelX
()¶ X axis accelerometer reading, expressed as a floating point number in mg. This result is scaled correctly to allow for the accelerometer range in use.
- Return
- The scaled reading.
-
float
accelY
()¶ Y axis accelerometer reading, expressed as a floating point number in mg. This result is scaled correctly to allow for the accelerometer range in use.
- Return
- The scaled reading.
-
float
accelZ
()¶ Z axis accelerometer reading, expressed as a floating point number in mg. This result is scaled correctly to allow for the accelerometer range in use.
- Return
- The scaled reading.
-
float
magnoX
()¶ X axis magnetometer reading, expressed as a floating point number in mgauss. This result is scaled correctly to allow for the magnetometer range in use.
- Return
- The scaled reading.
-
float
magnoY
()¶ Y axis magnetometer reading, expressed as a floating point number in mgauss. This result is scaled correctly to allow for the magnetometer range in use.
- Return
- The scaled reading.
-
float
magnoZ
()¶ Z axis magnetometer reading, expressed as a floating point number in mgauss. This result is scaled correctly to allow for the magnetometer range in use.
- Return
- The scaled reading.
-
bool
intRead
(uint8_t intNum)¶ Read the specified interrupt signal of the LDM303D chip.
- Return
- The state of the interrupt signal.
- Parameters
intNum
: - Number of the interrupt signal (1 or 2) to be read.
Protected Functions
-
int16_t
read16Bit
(uint8_t highAddr, uint8_t lowAddr)¶ Read a signed 16-bit value from two registers in the Accelerometer/Magnetometer chip.
- Return
- The 16-bit value.
- Parameters
highAddr
: - Address of the register to be read containing the most significant bits.lowAddr
: - Address of the register to be read containing the least significant bits.
-