upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
KXCJK1013 Class Reference

KXCJK1013 Tri-axis Digital Accelerometer API. More...

Detailed Description

The KXCJK is a tri-axis +/-2g, +/-4g or +/-8g silicon micromachined accelerometer.

// Instantiate a KXCJK1013 Accelerometer Sensor on iio device 0
accelerometer = new upm::KXCJK1013(0);
accelerometer->setScale(0.019163);
accelerometer->setSamplingFrequency(25.0);
accelerometer->enable3AxisChannel();
accelerometer->installISR(data_callback, NULL);
accelerometer->enableBuffer(16);
while (shouldRun) {
sleep(1);
}
accelerometer->disableBuffer();

Public Member Functions

 KXCJK1013 (int device)
 
 ~KXCJK1013 ()
 
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 ()
 
void extract3Axis (char *data, float *x, float *y, float *z)
 

Constructor & Destructor Documentation

KXCJK1013 ( int  device)

KXCJK1013 Tri-axis Digital Accelerometer

Parameters
iiodevice number
~KXCJK1013 ( )

KXCJK1013 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

void 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:


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