iio_core: Patches for IIO core kernel standard

Applying patches from Kuan Loon Lay.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2016-06-30 14:54:46 -07:00
parent 634208e3dc
commit e1df8b5bf6
9 changed files with 52 additions and 37 deletions

View File

@ -1,6 +1,6 @@
/*
* Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
* Copyright (c) 2015 Intel Corporation.
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -30,8 +30,6 @@
#define NUMBER_OF_BITS_IN_BYTE 8
#define NUMBER_OF_BITS_IN_BYTE 8
using namespace upm;
KXCJK1013::KXCJK1013(int device)
@ -51,7 +49,7 @@ KXCJK1013::KXCJK1013(int device)
if (mraa_iio_create_trigger(m_iio, trigger) != MRAA_SUCCESS)
fprintf(stderr, "Create trigger %s failed\n", trigger);
if (mraa_iio_get_mounting_matrix(m_iio, m_mount_matrix) == MRAA_SUCCESS)
if (mraa_iio_get_mount_matrix(m_iio, "in_mount_matrix", m_mount_matrix) == MRAA_SUCCESS)
m_mount_matrix_exist = true;
else
m_mount_matrix_exist = false;
@ -62,7 +60,7 @@ KXCJK1013::KXCJK1013(int device)
KXCJK1013::~KXCJK1013()
{
if(m_iio)
if (m_iio)
mraa_iio_close(m_iio);
}
@ -146,6 +144,7 @@ KXCJK1013::disableBuffer()
bool
KXCJK1013::setScale(float scale)
{
m_scale = scale;
mraa_iio_write_float(m_iio, "in_accel_scale", scale);
return true;
@ -187,6 +186,7 @@ KXCJK1013::extract3Axis(char* data, float* x, float* y, float* z)
iio_y = getChannelValue((unsigned char*) (data + channels[1].location), &channels[1]);
iio_z = getChannelValue((unsigned char*) (data + channels[2].location), &channels[2]);
// Raw data is acceleration in direction. Units after application of scale are m/s^2
*x = (iio_x * m_scale);
*y = (iio_y * m_scale);
*z = (iio_z * m_scale);