mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
kxtj3: A few last-minute changes to the kxtj3 src
* Removed trailing whitespace * Fixed a few spelling errors * Switched to upm_delay_us for C source Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
186bbfab76
commit
3e84b74bdf
@ -26,24 +26,24 @@ public class KXTJ3_Example {
|
|||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
||||||
upm_kxtj3.KXTJ3 kxtj3 = new upm_kxtj3.KXTJ3();
|
upm_kxtj3.KXTJ3 kxtj3 = new upm_kxtj3.KXTJ3(0);
|
||||||
|
|
||||||
kxtj3.SensorInit(upm_kxtj3.KXTJ3_ODR_T.KXTJ3_ODR_25,
|
kxtj3.SensorInit(upm_kxtj3.KXTJ3_ODR_T.KXTJ3_ODR_25,
|
||||||
upm_kxtj3.KXTJ3_RESOLUTION_T.HIGH_RES,
|
upm_kxtj3.KXTJ3_RESOLUTION_T.HIGH_RES,
|
||||||
upm_kxtj3.KXTJ3_G_RANGE_T.KXTJ3_RANGE_16G_14);
|
upm_kxtj3.KXTJ3_G_RANGE_T.KXTJ3_RANGE_16G_14);
|
||||||
|
|
||||||
float waitTime = kxtj3.GetAccelerationSamplePeriod() * 1000;
|
float waitTime = kxtj3.GetAccelerationSamplePeriod() * 1000;
|
||||||
int sampleCounter = 10;
|
int sampleCounter = 10;
|
||||||
System.out.println("Setting settings:\nODR: 25 Hz\nResolution: " +
|
System.out.println("Setting settings:\nODR: 25 Hz\nResolution: " +
|
||||||
"High\nAcceleration range: 16g with 14bits");
|
"High\nAcceleration range: 16g with 14bits");
|
||||||
System.out.println("Acceleration");
|
System.out.println("Acceleration");
|
||||||
upm_kxtj3.floatVector xyz;
|
upm_kxtj3.floatVector xyz;
|
||||||
while (sampleCounter-- > 0) {
|
while (sampleCounter-- > 0) {
|
||||||
xyz = kxtj3.GetAccelerationVector();
|
xyz = kxtj3.GetAccelerationVector();
|
||||||
System.out.println("x = " + xyz.get(0) + " y = " + xyz.get(1) +
|
System.out.println("x = " + xyz.get(0) + " y = " + xyz.get(1) +
|
||||||
" z = " + xyz.get(2));
|
" z = " + xyz.get(2));
|
||||||
|
|
||||||
Thread.sleep((long) waitTime);
|
Thread.sleep((long) waitTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ var waitTime = kxtj3_sensor.GetAccelerationSamplePeriod();
|
|||||||
var counter = 10;
|
var counter = 10;
|
||||||
console.log("Setting settings:\nODR: 25 Hz\nResolution: \
|
console.log("Setting settings:\nODR: 25 Hz\nResolution: \
|
||||||
High\nAcceleration range: 16g with 14bits");
|
High\nAcceleration range: 16g with 14bits");
|
||||||
console.log("Accerleration: ");
|
console.log("Acceleration: ");
|
||||||
var interval = setInterval(function() {
|
var interval = setInterval(function() {
|
||||||
data = kxtj3_sensor.GetAccelerationVector();
|
data = kxtj3_sensor.GetAccelerationVector();
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -52,7 +52,7 @@ def main():
|
|||||||
[x, y, z] = kxtj3_sensor.GetAccelerationVector()
|
[x, y, z] = kxtj3_sensor.GetAccelerationVector()
|
||||||
|
|
||||||
print ("x: %0.02f, y: %0.02f, z: %0.02f" % (x, y, z))
|
print ("x: %0.02f, y: %0.02f, z: %0.02f" % (x, y, z))
|
||||||
|
|
||||||
time.sleep(waitTime)
|
time.sleep(waitTime)
|
||||||
sampleCounter -= 1
|
sampleCounter -= 1
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@ upm_mixed_module_init (NAME kxtj3
|
|||||||
CPP_HDR kxtj3.hpp
|
CPP_HDR kxtj3.hpp
|
||||||
CPP_SRC kxtj3.cxx
|
CPP_SRC kxtj3.cxx
|
||||||
CPP_WRAPS_C
|
CPP_WRAPS_C
|
||||||
REQUIRES mraa)
|
REQUIRES mraa utilities-c)
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "kxtj3.h"
|
#include "kxtj3.h"
|
||||||
|
#include "upm_utilities.h"
|
||||||
|
|
||||||
#define SW_RESET_MAX_LOOP_COUNT 10
|
#define SW_RESET_MAX_LOOP_COUNT 10
|
||||||
#define SW_RESET_READ_WAIT_MICRO_S 50000
|
#define SW_RESET_READ_WAIT_MICRO_S 50000
|
||||||
@ -80,7 +81,7 @@ const struct odr_map_t odr_map_in_Hz[] = {
|
|||||||
{KXTJ3_ODR_800, 800.0f},
|
{KXTJ3_ODR_800, 800.0f},
|
||||||
{KXTJ3_ODR_1600, 1600.0f}};
|
{KXTJ3_ODR_1600, 1600.0f}};
|
||||||
/**
|
/**
|
||||||
* @brief ODR register values maping with ODR in Hz for
|
* @brief ODR register values maping with ODR in Hz for
|
||||||
* wake-up function
|
* wake-up function
|
||||||
*/
|
*/
|
||||||
const struct odr_map_t odr_map_in_Hz_wakeup[] = {
|
const struct odr_map_t odr_map_in_Hz_wakeup[] = {
|
||||||
@ -136,7 +137,7 @@ static float kxtj3_odr_val_to_sec(KXTJ3_ODR_T odr);
|
|||||||
static float kxtj3_odr_val_to_sec_wakeup(KXTJ3_ODR_WAKEUP_T odr);
|
static float kxtj3_odr_val_to_sec_wakeup(KXTJ3_ODR_WAKEUP_T odr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Sets the sensor default values for ODR, resolution (with its scale),
|
@brief Sets the sensor default values for ODR, resolution (with its scale),
|
||||||
G range (both normal and wake-up modes)
|
G range (both normal and wake-up modes)
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@ -201,7 +202,7 @@ static upm_result_t kxtj3_set_bit_off(const kxtj3_context dev, uint8_t reg, uint
|
|||||||
@param reg The register address to write to
|
@param reg The register address to write to
|
||||||
@param val byte data to write
|
@param val byte data to write
|
||||||
@param bit_mask The bits or register mask
|
@param bit_mask The bits or register mask
|
||||||
@return A UPM resutl
|
@return A UPM result
|
||||||
*/
|
*/
|
||||||
static upm_result_t kxtj3_set_bits_with_mask(const kxtj3_context dev, uint8_t reg, uint8_t val, uint8_t bit_mask);
|
static upm_result_t kxtj3_set_bits_with_mask(const kxtj3_context dev, uint8_t reg, uint8_t val, uint8_t bit_mask);
|
||||||
|
|
||||||
@ -231,11 +232,11 @@ This is used by the self-test functionality.
|
|||||||
static struct Coordinates kxtj3_get_sample_averaged_data(kxtj3_context dev);
|
static struct Coordinates kxtj3_get_sample_averaged_data(kxtj3_context dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Check whether the self-test acceleration data difference is whithin the permitted threshold (0.5g)
|
@brief Check whether the self-test acceleration data difference is within the permitted threshold (0.5g)
|
||||||
|
|
||||||
@param before The Coordinates struct before the self-test
|
@param before The Coordinates struct before the self-test
|
||||||
@param during The Coordinates struct of the self-test
|
@param during The Coordinates struct of the self-test
|
||||||
@return true if difference is below thresold, false otherwise
|
@return true if difference is below threshold, false otherwise
|
||||||
*/
|
*/
|
||||||
static bool kxtj3_check_self_test_difference(struct Coordinates before, struct Coordinates during);
|
static bool kxtj3_check_self_test_difference(struct Coordinates before, struct Coordinates during);
|
||||||
|
|
||||||
@ -243,14 +244,14 @@ static bool kxtj3_check_self_test_difference(struct Coordinates before, struct C
|
|||||||
@brief Checks the digital communication register (DCST_RESP) register value with an expected value
|
@brief Checks the digital communication register (DCST_RESP) register value with an expected value
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@param expected_val The expted byte value of the register
|
@param expected_val The expected byte value of the register
|
||||||
@return true if values match, false otherwise.
|
@return true if values match, false otherwise.
|
||||||
*/
|
*/
|
||||||
static bool kxtj3_check_digital_communication_reg_value(kxtj3_context dev, uint8_t expected_val);
|
static bool kxtj3_check_digital_communication_reg_value(kxtj3_context dev, uint8_t expected_val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Gets the count value from a given time (in seconds) for the wake-up function.
|
@brief Gets the count value from a given time (in seconds) for the wake-up function.
|
||||||
Used by the wake-up motion counter and non-activity counter before anothe wake-up functions.
|
Used by the wake-up motion counter and non-activity counter before another wake-up functions.
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@param time_sec Time in seconds to be converted
|
@param time_sec Time in seconds to be converted
|
||||||
@ -642,7 +643,7 @@ static struct Coordinates kxtj3_get_sample_averaged_data(kxtj3_context dev)
|
|||||||
coordinates_averaged_sample.x += fabs((x / EARTH_GRAVITY));
|
coordinates_averaged_sample.x += fabs((x / EARTH_GRAVITY));
|
||||||
coordinates_averaged_sample.y += fabs((y / EARTH_GRAVITY));
|
coordinates_averaged_sample.y += fabs((y / EARTH_GRAVITY));
|
||||||
coordinates_averaged_sample.z += fabs((z / EARTH_GRAVITY));
|
coordinates_averaged_sample.z += fabs((z / EARTH_GRAVITY));
|
||||||
usleep(wait_time);
|
upm_delay_us(wait_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinates_averaged_sample.x /= SELF_TEST_SAMPLE_COUNT;
|
coordinates_averaged_sample.x /= SELF_TEST_SAMPLE_COUNT;
|
||||||
@ -720,7 +721,7 @@ upm_result_t kxtj3_sensor_software_reset(const kxtj3_context dev)
|
|||||||
uint8_t srst_counter = 0;
|
uint8_t srst_counter = 0;
|
||||||
while ((ctrl_reg2_data & KXTJ3_CTRL_REG2_SRST) != 0x00 && srst_counter < SW_RESET_MAX_LOOP_COUNT)
|
while ((ctrl_reg2_data & KXTJ3_CTRL_REG2_SRST) != 0x00 && srst_counter < SW_RESET_MAX_LOOP_COUNT)
|
||||||
{
|
{
|
||||||
usleep(SW_RESET_READ_WAIT_MICRO_S);
|
upm_delay_us(SW_RESET_READ_WAIT_MICRO_S);
|
||||||
kxtj3_read_register(dev, KXTJ3_CTRL_REG2, &ctrl_reg2_data);
|
kxtj3_read_register(dev, KXTJ3_CTRL_REG2, &ctrl_reg2_data);
|
||||||
srst_counter++;
|
srst_counter++;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ extern "C"
|
|||||||
* @brief C API for the kxtj3 driver
|
* @brief C API for the kxtj3 driver
|
||||||
* @defgroup kxtj3 libupm-kxtj3
|
* @defgroup kxtj3 libupm-kxtj3
|
||||||
* @ingroup Kionix i2c accelerometer
|
* @ingroup Kionix i2c accelerometer
|
||||||
*
|
*
|
||||||
* @include kxtj3.c
|
* @include kxtj3.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ extern "C"
|
|||||||
kxtj3_context kxtj3_init(int bus, uint8_t addr);
|
kxtj3_context kxtj3_init(int bus, uint8_t addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Intilializes the sensor with the given resolution and acceleration range
|
@brief Initializes the sensor with the given resolution and acceleration range
|
||||||
|
|
||||||
This gets called during the kxtj3_init(), so it will not need to be called unless the sensor is reset
|
This gets called during the kxtj3_init(), so it will not need to be called unless the sensor is reset
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ Sensor needs to be in standby mode when setting the ODR
|
|||||||
upm_result_t kxtj3_set_odr_wakeup_function(const kxtj3_context dev, KXTJ3_ODR_WAKEUP_T odr);
|
upm_result_t kxtj3_set_odr_wakeup_function(const kxtj3_context dev, KXTJ3_ODR_WAKEUP_T odr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Performs a self-test for digital communication of the sensor. The test sets DCST bit in
|
@brief Performs a self-test for digital communication of the sensor. The test sets DCST bit in
|
||||||
CTRL_REG2, then checks the DCST_RESP register for a 0xAA, after the register is read, its
|
CTRL_REG2, then checks the DCST_RESP register for a 0xAA, after the register is read, its
|
||||||
value is 0x55 and DCST bit is cleared.
|
value is 0x55 and DCST bit is cleared.
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ See the datasheet for more details
|
|||||||
upm_result_t kxtj3_get_acceleration_data(const kxtj3_context dev, float *x, float *y, float *z);
|
upm_result_t kxtj3_get_acceleration_data(const kxtj3_context dev, float *x, float *y, float *z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Gets the duration of one sample period (in seconds) for getting the acceleration data depending on
|
@brief Gets the duration of one sample period (in seconds) for getting the acceleration data depending on
|
||||||
the sampling rate of the sensor
|
the sampling rate of the sensor
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@ -379,7 +379,7 @@ the sampling rate of the sensor
|
|||||||
float kxtj3_get_acceleration_sampling_period(kxtj3_context dev);
|
float kxtj3_get_acceleration_sampling_period(kxtj3_context dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the duration of one sample period (in seconds) for the wakeup function depending on
|
Gets the duration of one sample period (in seconds) for the wakeup function depending on
|
||||||
the sampling rate of the sensor wakeup function
|
the sampling rate of the sensor wakeup function
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@ -443,7 +443,7 @@ Sensor needs to be in standby mode when enabling the interrupt
|
|||||||
See datasheet for more details
|
See datasheet for more details
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
@param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
||||||
@param response_type Select the response type of the interrupt. One of the KXTJ3_INTERRUPT_RESPONSE_T values.
|
@param response_type Select the response type of the interrupt. One of the KXTJ3_INTERRUPT_RESPONSE_T values.
|
||||||
@return UPM result
|
@return UPM result
|
||||||
*/
|
*/
|
||||||
@ -467,7 +467,7 @@ Polarity ACTIVE_HIGH or ACTIVE_LOW
|
|||||||
Sensor must be in standby mode before performing this action
|
Sensor must be in standby mode before performing this action
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
@param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
||||||
@return UPM result
|
@return UPM result
|
||||||
*/
|
*/
|
||||||
upm_result_t kxtj3_set_interrupt_polarity(const kxtj3_context dev, KXTJ3_INTERRUPT_POLARITY_T polarity);
|
upm_result_t kxtj3_set_interrupt_polarity(const kxtj3_context dev, KXTJ3_INTERRUPT_POLARITY_T polarity);
|
||||||
@ -491,12 +491,12 @@ See datasheet for more details
|
|||||||
upm_result_t kxtj3_set_interrupt_response(const kxtj3_context dev, KXTJ3_INTERRUPT_RESPONSE_T response_type);
|
upm_result_t kxtj3_set_interrupt_response(const kxtj3_context dev, KXTJ3_INTERRUPT_RESPONSE_T response_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Gets the status of the interrupts. (Has an interrupt occured).
|
@brief Gets the status of the interrupts. (Has an interrupt occurred).
|
||||||
|
|
||||||
See datasheet for more details
|
See datasheet for more details
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@return Return true if an interrupt event has occured (DRDY or WUFS is 1), returns false if no interrupts have occured
|
@return Return true if an interrupt event has occurred (DRDY or WUFS is 1), returns false if no interrupts have occurred
|
||||||
*/
|
*/
|
||||||
bool kxtj3_get_interrupt_status(const kxtj3_context dev);
|
bool kxtj3_get_interrupt_status(const kxtj3_context dev);
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ See datasheet for more details
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Uninstalls a previously installed interrupt handler for interrupt pin
|
@brief Uninstalls a previously installed interrupt handler for interrupt pin
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@return UPM result
|
@return UPM result
|
||||||
*/
|
*/
|
||||||
@ -585,9 +585,9 @@ See datasheet for more details
|
|||||||
kxtj3_wakeup_axes kxtj3_get_wakeup_axis_and_direction(kxtj3_context dev);
|
kxtj3_wakeup_axes kxtj3_get_wakeup_axis_and_direction(kxtj3_context dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Enables the Unlached mode motion interrupt (ULMODE). This mode is always by default enabled.
|
@brief Enables the Unlatched mode motion interrupt (ULMODE). This mode is always by default enabled.
|
||||||
|
|
||||||
When this bit is set, the wakeup interrupt has to be cleared manually
|
When this bit is set, the wakeup interrupt has to be cleared manually
|
||||||
(cannot use interrupt response with pulse)
|
(cannot use interrupt response with pulse)
|
||||||
|
|
||||||
Sensor must be in standby mode before performing this action
|
Sensor must be in standby mode before performing this action
|
||||||
@ -598,16 +598,16 @@ Sensor must be in standby mode before performing this action
|
|||||||
upm_result_t kxtj3_enable_wakeup_latch(kxtj3_context dev);
|
upm_result_t kxtj3_enable_wakeup_latch(kxtj3_context dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Disables the Unlached mode motion interrupt (ULMODE). This mode is always by default enabled
|
@brief Disables the Unlatched mode motion interrupt (ULMODE). This mode is always by default enabled
|
||||||
(cannot use interrupt response with pulse).
|
(cannot use interrupt response with pulse).
|
||||||
|
|
||||||
The wakeup threshold is advised to not be very low to avoid interrupt being triggered in
|
The wakeup threshold is advised to not be very low to avoid interrupt being triggered in
|
||||||
an almost continuous manner
|
an almost continuous manner
|
||||||
|
|
||||||
Sensor must be in standby mode before performing this action
|
Sensor must be in standby mode before performing this action
|
||||||
|
|
||||||
When this bit is cleared, and the interrupt response type is set to Pulse, then upon a wakeup event
|
When this bit is cleared, and the interrupt response type is set to Pulse, then upon a wakeup event
|
||||||
the wakeup interrupt signal will pulse and return low, but only once. Then, the interrupt
|
the wakeup interrupt signal will pulse and return low, but only once. Then, the interrupt
|
||||||
output will not reset until data is read or interrupt cleared.
|
output will not reset until data is read or interrupt cleared.
|
||||||
|
|
||||||
@param dev The sensor context
|
@param dev The sensor context
|
||||||
@ -703,7 +703,7 @@ See datasheet for more details
|
|||||||
@brief Sets the threshold counter for acceleration difference before sending a wakeup interrupt
|
@brief Sets the threshold counter for acceleration difference before sending a wakeup interrupt
|
||||||
|
|
||||||
The count is limited to values from 1 to 4096, that it is 16g threshold with (3.9mg/count)
|
The count is limited to values from 1 to 4096, that it is 16g threshold with (3.9mg/count)
|
||||||
It is advised to not set the threshold to a very low value which may cause bad behaviour
|
It is advised to not set the threshold to a very low value which may cause bad behaviour
|
||||||
in the wakeup interrupt
|
in the wakeup interrupt
|
||||||
|
|
||||||
Sensor must be in standby mode before performing this action
|
Sensor must be in standby mode before performing this action
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
* @brief C API for the kxtj3 driver
|
* @brief C API for the kxtj3 driver
|
||||||
* @defgroup kxtj3 libupm-kxtj3
|
* @defgroup kxtj3 libupm-kxtj3
|
||||||
* @ingroup Kionix i2c accelerometer
|
* @ingroup Kionix i2c accelerometer
|
||||||
*
|
*
|
||||||
* @include kxtj3.cxx
|
* @include kxtj3.cxx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
void SetOdrForWakeup(KXTJ3_ODR_WAKEUP_T odr);
|
void SetOdrForWakeup(KXTJ3_ODR_WAKEUP_T odr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs a self-test for digital communication of the sensor. The test sets DCST bit in
|
* @brief Performs a self-test for digital communication of the sensor. The test sets DCST bit in
|
||||||
* CTRL_REG2, then checks the DCST_RESP register for a 0xAA, after the register is read, its
|
* CTRL_REG2, then checks the DCST_RESP register for a 0xAA, after the register is read, its
|
||||||
* value is 0x55 and DCST bit is cleared.
|
* value is 0x55 and DCST bit is cleared.
|
||||||
*
|
*
|
||||||
@ -198,7 +198,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets raw acceleration data from the sensor.
|
* Gets raw acceleration data from the sensor.
|
||||||
*
|
*
|
||||||
* @return Acceleration vector [x, y, z]
|
* @return Acceleration vector [x, y, z]
|
||||||
* @throws std::runtime_error on failure.
|
* @throws std::runtime_error on failure.
|
||||||
*/
|
*/
|
||||||
@ -206,14 +206,14 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets acceleration data in (m/s^2) from the sensor.
|
* Gets acceleration data in (m/s^2) from the sensor.
|
||||||
*
|
*
|
||||||
* @return Acceleration vector [x, y, z]
|
* @return Acceleration vector [x, y, z]
|
||||||
* @throws std::runtime_error on failure.
|
* @throws std::runtime_error on failure.
|
||||||
*/
|
*/
|
||||||
std::vector<float> GetAccelerationVector();
|
std::vector<float> GetAccelerationVector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the duration of one sample period (in seconds) for getting the acceleration data depending on
|
* @brief Gets the duration of one sample period (in seconds) for getting the acceleration data depending on
|
||||||
* the sampling rate of the sensor
|
* the sampling rate of the sensor
|
||||||
*
|
*
|
||||||
* @return Floating point value of the sampling period
|
* @return Floating point value of the sampling period
|
||||||
@ -222,7 +222,7 @@ public:
|
|||||||
float GetAccelerationSamplePeriod();
|
float GetAccelerationSamplePeriod();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the duration of one sample period (in seconds) for the wakeup function depending on
|
* @brief Gets the duration of one sample period (in seconds) for the wakeup function depending on
|
||||||
* the sampling rate of the sensor wakeup function
|
* the sampling rate of the sensor wakeup function
|
||||||
*
|
*
|
||||||
* @return Floating point value of the sampling period
|
* @return Floating point value of the sampling period
|
||||||
@ -278,7 +278,7 @@ public:
|
|||||||
*
|
*
|
||||||
* See datasheet for more details
|
* See datasheet for more details
|
||||||
*
|
*
|
||||||
* @param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
* @param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
||||||
* @param response_type Select the response type of the interrupt. One of the KXTJ3_INTERRUPT_RESPONSE_T values.
|
* @param response_type Select the response type of the interrupt. One of the KXTJ3_INTERRUPT_RESPONSE_T values.
|
||||||
* @throws std::runtime_error on failure
|
* @throws std::runtime_error on failure
|
||||||
*/
|
*/
|
||||||
@ -300,7 +300,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Sensor must be in standby mode before performing this action
|
* Sensor must be in standby mode before performing this action
|
||||||
*
|
*
|
||||||
* @param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
* @param polarity Select the polarity of the interrupt. One of the KXTJ3_INTERRUPT_POLARITY_T values.
|
||||||
* @throws std::runtime_error on failure
|
* @throws std::runtime_error on failure
|
||||||
*/
|
*/
|
||||||
void SetInterruptPolarity(KXTJ3_INTERRUPT_POLARITY_T polarity);
|
void SetInterruptPolarity(KXTJ3_INTERRUPT_POLARITY_T polarity);
|
||||||
@ -323,12 +323,12 @@ public:
|
|||||||
void SetInerruptResponse(KXTJ3_INTERRUPT_RESPONSE_T response_type);
|
void SetInerruptResponse(KXTJ3_INTERRUPT_RESPONSE_T response_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the status of the interrupts. (Has an interrupt occured)
|
* @brief Gets the status of the interrupts. (Has an interrupt occurred)
|
||||||
*
|
*
|
||||||
* See datasheet for more details
|
* See datasheet for more details
|
||||||
*
|
*
|
||||||
* @return Return true if an interrupt event has occured (DRDY or WUFS is 1),
|
* @return Return true if an interrupt event has occurred (DRDY or WUFS is 1),
|
||||||
* returns false if no interrupts have occured
|
* returns false if no interrupts have occurred
|
||||||
*/
|
*/
|
||||||
bool GetInterruptStatus();
|
bool GetInterruptStatus();
|
||||||
|
|
||||||
@ -404,15 +404,15 @@ public:
|
|||||||
*
|
*
|
||||||
* See datasheet for more details
|
* See datasheet for more details
|
||||||
*
|
*
|
||||||
* @return A kxtj3_wakeup_axes struct with values of true/false
|
* @return A kxtj3_wakeup_axes struct with values of true/false
|
||||||
* for a wakeup for each axis and its direction
|
* for a wakeup for each axis and its direction
|
||||||
*/
|
*/
|
||||||
kxtj3_wakeup_axes GetWakeUpAxisDirection();
|
kxtj3_wakeup_axes GetWakeUpAxisDirection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables the Unlached mode motion interrupt (ULMODE). This mode is always by default enabled.
|
* @brief Enables the Unlatched mode motion interrupt (ULMODE). This mode is always by default enabled.
|
||||||
*
|
*
|
||||||
* When this bit is set, the wakeup interrupt has to be cleared manually
|
* When this bit is set, the wakeup interrupt has to be cleared manually
|
||||||
* (cannot use interrupt response with pulse)
|
* (cannot use interrupt response with pulse)
|
||||||
*
|
*
|
||||||
* Sensor must be in standby mode before performing this action
|
* Sensor must be in standby mode before performing this action
|
||||||
@ -422,16 +422,16 @@ public:
|
|||||||
void EnableWakeUpLatch();
|
void EnableWakeUpLatch();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disables the Unlached mode motion interrupt (ULMODE). This mode is always by default enabled.
|
* @brief Disables the Unlatched mode motion interrupt (ULMODE). This mode is always by default enabled.
|
||||||
* (cannot use interrupt response with pulse)
|
* (cannot use interrupt response with pulse)
|
||||||
*
|
*
|
||||||
* The wakeup threshold is advised to not be very low to avoid interrupt being triggered in
|
* The wakeup threshold is advised to not be very low to avoid interrupt being triggered in
|
||||||
* an almost continuous manner
|
* an almost continuous manner
|
||||||
*
|
*
|
||||||
* Sensor must be in standby mode before performing this action
|
* Sensor must be in standby mode before performing this action
|
||||||
*
|
*
|
||||||
* When this bit is cleared, and the interrupt response type is set to Pulse, then upon a wakeup event
|
* When this bit is cleared, and the interrupt response type is set to Pulse, then upon a wakeup event
|
||||||
* the wakeup interrupt signal will pulse and return low, but only once. Then, the interrupt
|
* the wakeup interrupt signal will pulse and return low, but only once. Then, the interrupt
|
||||||
* output will not reset until data is read or interrupt cleared.
|
* output will not reset until data is read or interrupt cleared.
|
||||||
|
|
||||||
* @throws std::runtime_error on failure
|
* @throws std::runtime_error on failure
|
||||||
@ -520,7 +520,7 @@ public:
|
|||||||
* @brief Sets the threshold counter for acceleration difference before sending a wakeup interrupt
|
* @brief Sets the threshold counter for acceleration difference before sending a wakeup interrupt
|
||||||
*
|
*
|
||||||
* The count is limited to values from 1 to 4096, that it is 16g threshold with (3.9mg/count)
|
* The count is limited to values from 1 to 4096, that it is 16g threshold with (3.9mg/count)
|
||||||
* It is advised to not set the threshold to a very low value which may cause bad behaviour
|
* It is advised to not set the threshold to a very low value which may cause bad behaviour
|
||||||
* in the wakeup interrupt
|
* in the wakeup interrupt
|
||||||
*
|
*
|
||||||
* Sensor must be in standby mode before performing this action
|
* Sensor must be in standby mode before performing this action
|
||||||
|
Loading…
x
Reference in New Issue
Block a user