xyControl
0.1
Quadrotor Flight Controller on AVR Basis
|
Configuring and reading an L3GD20. More...
Files | |
file | gyro.h |
L3GD20 Gyroscope API Header. | |
file | gyro.c |
L3GD20 Gyroscope API Implementation. | |
Macros | |
#define | GYROREG_CTRL1 0x20 |
Gyroscope Control Register 1. More... | |
#define | GYROREG_CTRL4 0x23 |
Gyroscope Control Register 4. More... | |
#define | GYROREG_OUTXL 0x28 |
First Gyroscope Output Register. More... | |
Enumerations | |
enum | GyroRange { r250DPS, r500DPS, r2000DPS } |
Gyroscope Range options. More... | |
Functions | |
Error | gyroInit (GyroRange r) |
Initializes the Gyroscope. More... | |
Error | gyroRead (Vector3f *v) |
Get a set of gyroscope data. More... | |
Error | gyroWriteByte (uint8_t reg, uint8_t val) |
Write a Gyroscope Register. More... | |
Variables | |
GyroRange | gyroRange |
Stored range to scale returned values. More... | |
Configuring and reading an L3GD20.
#define GYROREG_CTRL1 0x20 |
#define GYROREG_CTRL4 0x23 |
#define GYROREG_OUTXL 0x28 |
enum GyroRange |
Initializes the Gyroscope.
I2C should already be initialized.
r | GyroRange to use |
Definition at line 75 of file gyro.c.
References ARGUMENT_ERROR, gyroRange, GYROREG_CTRL1, GYROREG_CTRL4, gyroWriteByte(), r2000DPS, r250DPS, r500DPS, and SUCCESS.
Referenced by orientationInit().
Get a set of gyroscope data.
gyroInit() should already be called.
v | Data Destionation |
Definition at line 99 of file gyro.c.
References ARGUMENT_ERROR, GYRO_ADDRESS, GYROFILTERFACTOR, gyroRange, GYROREG_OUTXL, r2000DPS, r250DPS, r500DPS, SUCCESS, TWI_NO_ANSWER, TWI_READ, TWI_WRITE, TWI_WRITE_ERROR, twiReadAck(), twiReadNak(), twiRepStart(), twiStart(), twiWrite(), Vector3f::x, Vector3f::y, and Vector3f::z.
Referenced by orientationTask().
Error gyroWriteByte | ( | uint8_t | reg, |
uint8_t | val | ||
) |
Write a Gyroscope Register.
I2C should aready be initialized!
reg | Register Address |
val | New Value |
Definition at line 61 of file gyro.c.
References TWI_NO_ANSWER.
Referenced by gyroInit().
GyroRange gyroRange |
Stored range to scale returned values.
Definition at line 52 of file gyro.c.
Referenced by gyroInit(), and gyroRead().