upm  0.7.1
Sensor/Actuator repository for libmraa (v1.0.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Public Member Functions
L3GD20 Class Reference

L3GD20 Tri-axis Digital Gyroscope API. More...

Detailed Description

The L3GD20 The L3GD20 is a low-power three-axis angular rate sensor.

// Instantiate a L3GD20 Gyroscope Sensor on iio device 3
gyroscope = new upm::L3GD20(3);
gyroscope->setScale(0.001222);
gyroscope->setSamplingFrequency(95.0);
gyroscope->enable3AxisChannel();
gyroscope->installISR(data_callback, NULL);
gyroscope->enableBuffer(16);
while (shouldRun) {
sleep(1);
}
gyroscope->disableBuffer();

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)
 

Constructor & Destructor Documentation

L3GD20 ( int  device)

L3GD20 Tri-axis Digital Gyroscope

Parameters
iiodevice number

Here is the call graph for this function:

~L3GD20 ( )

L3GD20 destructor

Member Function Documentation

void installISR ( void(*)(char *)  isr,
void *  arg 
)

Installs an interrupt service routine (ISR) to be called when an interrupt occurs

Parameters
interruptchannel
fptrPointer to a function to be called on interrupt
argPointer 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

Parameters
inputChannel data
chanMRAA iio-layer channel info

Here is the caller graph for this function:

bool enableBuffer ( int  length)

Enable trigger buffer

Parameters
triggerbuffer length in string
bool disableBuffer ( )

Disable trigger buffer

bool setScale ( const float  scale)

Set scale

Parameters
scalein string
bool setSamplingFrequency ( const float  sampling_frequency)

Set sampling frequency

Parameters
samplingfrequency 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

Parameters
dataEnabled channel data, 6 bytes, each axis 2 bytes
xX-Axis
yY-Axis
zZ-Axis

Here is the call graph for this function:

void initCalibrate ( )

Reset calibration data and start collect calibration data again

Here is the caller graph for this function:

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

Parameters
xX-Axis
yY-Axis
zZ-Axis

Here is the caller graph for this function:

void gyroDenoiseMedian ( float *  x,
float *  y,
float *  z 
)

Denoise gyro

Parameters
xX-Axis
yY-Axis
zZ-Axis

Here is the call graph for this function:

Here is the caller graph for this function:

float median ( float *  queue,
unsigned int  size 
)

median algorithm

Parameters
queue
size

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int partition ( float *  list,
unsigned int  left,
unsigned int  right,
unsigned int  pivot_index 
)

partition algorithm

Parameters
list
left
right
pivot_index

Here is the caller graph for this function:

void clampGyroReadingsToZero ( float *  x,
float *  y,
float *  z 
)

Clamp Gyro Readings to Zero

Parameters
xX-Axis
yY-Axis
zZ-Axis

Here is the caller graph for this function:


The documentation for this class was generated from the following files: