kxcjk1013: code cleanup and update sensor description
Code cleanup and proper close iio device in destructor. KXCJK-1013 is tri-axis accelerometer from Kionix. This sensor can measure acceleration in metre per second squared or in G-forces. The library provided is libupm-kxcjk1013.so.0.4.0. The example provided is kxcjk1013-example where it will print x,y,z axis when trigger buffer data is ready. Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com> Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
21
src/kxcjk1013/kxcjk1013.hpp
Normal file → Executable file
21
src/kxcjk1013/kxcjk1013.hpp
Normal file → Executable file
@@ -59,10 +59,12 @@ class KXCJK1013
|
||||
* @param iio device number
|
||||
*/
|
||||
KXCJK1013(int device);
|
||||
|
||||
/**
|
||||
* KXCJK1013 destructor
|
||||
*/
|
||||
~KXCJK1013();
|
||||
|
||||
/**
|
||||
* Installs an interrupt service routine (ISR) to be called when
|
||||
* an interrupt occurs
|
||||
@@ -73,16 +75,17 @@ class KXCJK1013
|
||||
* argument to the ISR.
|
||||
*/
|
||||
void installISR(void (*isr)(char*), void* arg);
|
||||
|
||||
/**
|
||||
* Extract the channel value based on channel type
|
||||
* @param input Channel data
|
||||
* @param chan MRAA iio-layer channel info
|
||||
* @param input Channel data
|
||||
* @param chan MRAA iio-layer channel info
|
||||
*/
|
||||
int64_t getChannelValue(unsigned char* input, mraa_iio_channel* chan);
|
||||
|
||||
/**
|
||||
* Enable trigger buffer
|
||||
* @param trigger buffer length in string
|
||||
* @param trigger buffer length in string
|
||||
*/
|
||||
bool enableBuffer(int length);
|
||||
|
||||
@@ -93,13 +96,13 @@ class KXCJK1013
|
||||
|
||||
/**
|
||||
* Set scale
|
||||
* @param scale in string
|
||||
* @param scale in string
|
||||
*/
|
||||
bool setScale(const float scale);
|
||||
|
||||
/**
|
||||
* Set sampling frequency
|
||||
* @param sampling frequency in string
|
||||
* @param sampling frequency in string
|
||||
*/
|
||||
bool setSamplingFrequency(const float sampling_frequency);
|
||||
|
||||
@@ -110,10 +113,10 @@ class KXCJK1013
|
||||
|
||||
/**
|
||||
* Process enabled channel buffer and return x, y, z axis
|
||||
* @param data Enabled channel data, 6 bytes, each axis 2 bytes
|
||||
* @param x X-Axis
|
||||
* @param y Y-Axis
|
||||
* @param z Z-Axis
|
||||
* @param data Enabled channel data, 6 bytes, each axis 2 bytes
|
||||
* @param x X-Axis
|
||||
* @param y Y-Axis
|
||||
* @param z Z-Axis
|
||||
*/
|
||||
void extract3Axis(char* data, float* x, float* y, float* z);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user