L3G gyroscope driver using SPI communication for the Parallax Propeller.
More...
#include <l3g.h>
|
static const uint8_t | WHO_AM_I = 0x0F |
|
static const uint8_t | CTRL_REG1 = 0x20 |
|
static const uint8_t | CTRL_REG2 = 0x21 |
|
static const uint8_t | CTRL_REG3 = 0x22 |
|
static const uint8_t | CTRL_REG4 = 0x23 |
|
static const uint8_t | CTRL_REG5 = 0x24 |
|
static const uint8_t | REFERENCE = 0x25 |
|
static const uint8_t | OUT_TEMP = 0x26 |
|
static const uint8_t | STATUS_REG = 0x27 |
|
static const uint8_t | OUT_X_L = 0x28 |
|
static const uint8_t | OUT_X_H = 0x29 |
|
static const uint8_t | OUT_Y_L = 0x2A |
|
static const uint8_t | OUT_Y_H = 0x2B |
|
static const uint8_t | OUT_Z_L = 0x2C |
|
static const uint8_t | OUT_Z_H = 0x2D |
|
static const uint8_t | FIFO_CTRL_REG = 0x2E |
|
static const uint8_t | FIFO_SRC_REG = 0x2F |
|
static const uint8_t | INT1_CFG = 0x30 |
|
static const uint8_t | INT1_SRC = 0x31 |
|
static const uint8_t | INT1_THS_XH = 0x32 |
|
static const uint8_t | INT1_THS_XL = 0x33 |
|
static const uint8_t | INT1_THS_YH = 0x34 |
|
static const uint8_t | INT1_THS_YL = 0x35 |
|
static const uint8_t | INT1_THS_ZH = 0x36 |
|
static const uint8_t | INT1_THS_ZL = 0x37 |
|
static const uint8_t | INT1_DURATION = 0x38 |
|
L3G gyroscope driver using SPI communication for the Parallax Propeller.
- Examples:
- L3G_Demo.cpp.
Definition at line 38 of file l3g.h.
Axes of the L3G device
Enumerator |
---|
X |
X axis
|
Y |
Y axis
|
Z |
Z axis
|
Definition at line 43 of file l3g.h.
Sensitivity measured in degrees per second
Enumerator |
---|
DPS_250 |
250 degrees per second
|
DPS_500 |
500 degrees per second
|
DPS_2000 |
2000 degrees per second
|
Definition at line 52 of file l3g.h.
Construction requires an instance of the SPI module.
- Parameters
-
[in] | *spi | Constructed SPI module |
[in] | cs | Chip select pin mask |
Definition at line 96 of file l3g.h.
void PropWare::L3G::always_set_spi_mode |
( |
const bool |
alwaysSetMode | ) |
|
Choose whether to always set the SPI mode and bitmode before reading or writing to the L3G module; Useful when multiple devices are connected to the SPI bus.
- Parameters
-
[in] | alwaysSetMode | For any non-zero value, the SPI modes will always be set before a read or write routine |
Definition at line 126 of file l3g.h.
float PropWare::L3G::convert_to_dps |
( |
const int16_t |
rawValue | ) |
const |
Convert the raw, integer value from the gyro into units of degrees-per-second.
- Precondition
- Input value must have been read in when the DPS setting was set to the same value as it is during this function execution. If the input value was read with a different DPS setting, use
PropWare::L3G::convert_to_dps(const int16_t rawValue, const PropWare::L3G::DPSMode dpsMode)
to specify the correct DPS setting
- Parameters
-
[in] | rawValue | Value from the gyroscope |
- Returns
- Returns the rotational value in degrees-per-second
Definition at line 243 of file l3g.h.
Convert the raw, integer value from the gyro into units of degrees-per-second.
- Parameters
-
[in] | rawValue | Value from the gyroscope |
[in] | dpsMode | The DPS setting used at the time of reading rawValue |
- Returns
- Returns the rotational value in degrees-per-second
Definition at line 255 of file l3g.h.
Retrieve the current DPS setting.
- Returns
- Returns what the L3G module is using for DPS mode
Definition at line 226 of file l3g.h.
Read a specific axis's data.
- Parameters
-
[in] | axis | Selects the axis to be read |
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 137 of file l3g.h.
void PropWare::L3G::read_all |
( |
int16_t * |
val | ) |
const |
Read data from all three axes.
- Parameters
-
[out] | *val | Starting address for data to be placed; 6 contiguous bytes of space are required for the read routine |
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 176 of file l3g.h.
int16_t PropWare::L3G::read_x |
( |
| ) |
const |
Read data from the X axis.
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 146 of file l3g.h.
int16_t PropWare::L3G::read_y |
( |
| ) |
const |
Read data from the Y axis.
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 155 of file l3g.h.
int16_t PropWare::L3G::read_z |
( |
| ) |
const |
Read data from the Z axis.
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 164 of file l3g.h.
Modify the scale of L3G in units of degrees per second.
- Parameters
-
[in] | dpsMode | Desired full-scale mode |
- Returns
- Returns 0 upon success, error code otherwise
Definition at line 209 of file l3g.h.
The documentation for this class was generated from the following file: