upm
0.7.1
Sensor/Actuator repository for libmraa (v1.0.0)
|
L3GD20 Tri-axis Digital Gyroscope API. More...
The L3GD20 The L3GD20 is a low-power three-axis angular rate sensor.
Data Structures | |
struct | filter_median_t |
struct | gyro_cal_t |
Public Member Functions | |
L3GD20 (int device) | |
~L3GD20 () | |
void | installISR (void(*isr)(char *), void *arg) |
int64_t | getChannelValue (unsigned char *input, mraa_iio_channel *chan) |
bool | enableBuffer (int length) |
bool | disableBuffer () |
bool | setScale (const float scale) |
bool | setSamplingFrequency (const float sampling_frequency) |
bool | enable3AxisChannel () |
bool | extract3Axis (char *data, float *x, float *y, float *z) |
void | initCalibrate () |
bool | getCalibratedStatus () |
void | getCalibratedData (float *bias_x, float *bias_y, float *bias_z) |
void | loadCalibratedData (float bias_x, float bias_y, float bias_z) |
bool | gyroCollect (float x, float y, float z) |
void | gyroDenoiseMedian (float *x, float *y, float *z) |
float | median (float *queue, unsigned int size) |
unsigned int | partition (float *list, unsigned int left, unsigned int right, unsigned int pivot_index) |
void | clampGyroReadingsToZero (float *x, float *y, float *z) |
L3GD20 | ( | int | device | ) |
L3GD20 Tri-axis Digital Gyroscope
iio | device number |
void installISR | ( | void(*)(char *) | isr, |
void * | arg | ||
) |
Installs an interrupt service routine (ISR) to be called when an interrupt occurs
interrupt | channel |
fptr | Pointer to a function to be called on interrupt |
arg | Pointer to an object to be supplied as an argument to the ISR. |
int64_t getChannelValue | ( | unsigned char * | input, |
mraa_iio_channel * | chan | ||
) |
Extract the channel value based on channel type
input | Channel data |
chan | MRAA iio-layer channel info |
bool enableBuffer | ( | int | length | ) |
Enable trigger buffer
trigger | buffer length in string |
bool disableBuffer | ( | ) |
Disable trigger buffer
bool setScale | ( | const float | scale | ) |
Set scale
scale | in string |
bool setSamplingFrequency | ( | const float | sampling_frequency | ) |
Set sampling frequency
sampling | frequency in string |
bool enable3AxisChannel | ( | ) |
Enable 3 axis scan element
bool extract3Axis | ( | char * | data, |
float * | x, | ||
float * | y, | ||
float * | z | ||
) |
Process enabled channel buffer and return x, y, z axis
data | Enabled channel data, 6 bytes, each axis 2 bytes |
x | X-Axis |
y | Y-Axis |
z | Z-Axis |
void initCalibrate | ( | ) |
Reset calibration data and start collect calibration data again
bool getCalibratedStatus | ( | ) |
Get calibrated status, return true if calibrate successfully
void getCalibratedData | ( | float * | bias_x, |
float * | bias_y, | ||
float * | bias_z | ||
) |
Get calibrated data
void loadCalibratedData | ( | float | bias_x, |
float | bias_y, | ||
float | bias_z | ||
) |
Load calibrated data
bool gyroCollect | ( | float | x, |
float | y, | ||
float | z | ||
) |
Calibrate gyro
x | X-Axis |
y | Y-Axis |
z | Z-Axis |
void gyroDenoiseMedian | ( | float * | x, |
float * | y, | ||
float * | z | ||
) |
Denoise gyro
x | X-Axis |
y | Y-Axis |
z | Z-Axis |
float median | ( | float * | queue, |
unsigned int | size | ||
) |
median algorithm
queue | |
size |
unsigned int partition | ( | float * | list, |
unsigned int | left, | ||
unsigned int | right, | ||
unsigned int | pivot_index | ||
) |
partition algorithm
list | |
left | |
right | |
pivot_index |
void clampGyroReadingsToZero | ( | float * | x, |
float * | y, | ||
float * | z | ||
) |
Clamp Gyro Readings to Zero
x | X-Axis |
y | Y-Axis |
z | Z-Axis |