mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
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:
18
src/l3gd20/l3gd20.cxx
Normal file → Executable file
18
src/l3gd20/l3gd20.cxx
Normal file → Executable 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
|
||||
@ -56,7 +56,7 @@ L3GD20::L3GD20(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;
|
||||
@ -88,18 +88,10 @@ L3GD20::~L3GD20()
|
||||
free(m_filter.buff);
|
||||
m_filter.buff = NULL;
|
||||
}
|
||||
if(m_iio)
|
||||
if (m_iio)
|
||||
mraa_iio_close(m_iio);
|
||||
}
|
||||
|
||||
#ifdef JAVACALLBACK
|
||||
void
|
||||
L3GD20::installISR(IsrCallback* cb)
|
||||
{
|
||||
installISR(generic_callback_isr, cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
L3GD20::installISR(void (*isr)(char*), void* arg)
|
||||
{
|
||||
@ -177,6 +169,8 @@ L3GD20::disableBuffer()
|
||||
bool
|
||||
L3GD20::setScale(float scale)
|
||||
{
|
||||
m_scale = scale;
|
||||
|
||||
mraa_iio_write_float(m_iio, "in_anglvel_x_scale", scale);
|
||||
mraa_iio_write_float(m_iio, "in_anglvel_y_scale", scale);
|
||||
mraa_iio_write_float(m_iio, "in_anglvel_z_scale", scale);
|
||||
@ -224,6 +218,8 @@ L3GD20::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 x, y, z axis angular velocity. Units after application of scale are radians per
|
||||
// second
|
||||
*x = (iio_x * m_scale);
|
||||
*y = (iio_y * m_scale);
|
||||
*z = (iio_z * m_scale);
|
||||
|
20
src/l3gd20/l3gd20.hpp
Executable file → Normal file
20
src/l3gd20/l3gd20.hpp
Executable file → Normal 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
|
||||
@ -100,7 +100,7 @@ class L3GD20
|
||||
|
||||
/**
|
||||
* Enable trigger buffer
|
||||
* @param trigger buffer length in string
|
||||
* @param trigger buffer length in integer
|
||||
*/
|
||||
bool enableBuffer(int length);
|
||||
|
||||
@ -111,13 +111,17 @@ class L3GD20
|
||||
|
||||
/**
|
||||
* Set scale
|
||||
* @param scale in string
|
||||
* @param scale in float
|
||||
* Available scales are 0.000153(250dps), 0.000305(500dps), and 0.001222(2000dps)
|
||||
* Default scale is 0.000153
|
||||
*/
|
||||
bool setScale(const float scale);
|
||||
|
||||
/**
|
||||
* Set sampling frequency
|
||||
* @param sampling frequency in string
|
||||
* @param sampling frequency in float
|
||||
* Available sampling frequency are 95, 190, 380, and 760
|
||||
* Default sampling frequency is 95
|
||||
*/
|
||||
bool setSamplingFrequency(const float sampling_frequency);
|
||||
|
||||
@ -202,9 +206,9 @@ class L3GD20
|
||||
bool m_mount_matrix_exist; // is mount matrix exist
|
||||
float m_mount_matrix[9]; // mount matrix
|
||||
float m_scale; // gyroscope data scale
|
||||
int m_event_count; // sample data arrive
|
||||
bool m_calibrated; // calibrate state
|
||||
gyro_cal_t m_cal_data; // calibrate data
|
||||
filter_median_t m_filter; // filter data
|
||||
int m_event_count; // sample data arrive
|
||||
bool m_calibrated; // calibrate state
|
||||
gyro_cal_t m_cal_data; // calibrate data
|
||||
filter_median_t m_filter; // filter data
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user