Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
Infuse IMU API . More...
Data Structures | |
struct | imu_config |
IMU configuration struct. More... | |
struct | imu_config_output |
Configured IMU value. More... | |
struct | imu_sample |
struct | imu_sensor_meta |
Metadata for each sub-sensor in a FIFO buffer. More... | |
struct | imu_sample_array |
FIFO read structure. More... | |
struct | infuse_imu_api |
struct | imu_linear_downsample_scaled_state |
State for imu_linear_downsample_scaled. More... | |
Macros | |
#define | IMU_SAMPLE_ARRAY_TYPE_DEFINE(type_name, max_samples) |
Create type that holds a given number of IMU samples. | |
#define | IMU_SAMPLE_ARRAY_CREATE(name, max_samples) |
Create static buffer of IMU samples suitable for use with imu_data_read. | |
Functions | |
static int | imu_configure (const struct device *dev, const struct imu_config *config, struct imu_config_output *output) |
Configure IMU for operation. | |
static int | imu_data_wait (const struct device *dev, k_timeout_t timeout) |
Wait for FIFO interrupt from IMU. | |
static int | imu_data_read (const struct device *dev, struct imu_sample_array *samples, uint16_t max_samples) |
Read samples from IMU. | |
static int | imu_self_test (const struct device *dev) |
Run self-test functionality on the IMU. | |
static int16_t | imu_accelerometer_1g (uint8_t full_scale) |
Convert a full scale range to an expected value for 1G. | |
static uint32_t | imu_sample_period (const struct imu_sensor_meta *meta) |
Get the local ticks between samples in a buffer. | |
static uint16_t | imu_sample_rate (const struct imu_sensor_meta *meta) |
Get the approximate sample rate of a buffer. | |
static k_ticks_t | imu_sample_timestamp (const struct imu_sensor_meta *meta, uint8_t sample) |
Get the local tick counter of a given sample in a buffer. | |
int | imu_linear_downsample_scaled (struct imu_linear_downsample_scaled_state *state, const struct imu_sample *input, uint16_t num_input) |
Downsample IMU samples to a new frequency using linear interpolation. | |
Infuse IMU API .
#define IMU_SAMPLE_ARRAY_CREATE | ( | name, | |
max_samples ) |
#include <infuse/drivers/imu.h>
Create static buffer of IMU samples suitable for use with imu_data_read.
#define IMU_SAMPLE_ARRAY_TYPE_DEFINE | ( | type_name, | |
max_samples ) |
#include <infuse/drivers/imu.h>
Create type that holds a given number of IMU samples.
|
inlinestatic |
#include <infuse/drivers/imu.h>
Convert a full scale range to an expected value for 1G.
full_scale | Full scale range in G's (e.g 4 for +- 4G) |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Configure IMU for operation.
dev | IMU to configure |
config | Desired sensor configuration, or NULL to disable |
output | Configured sensor timings |
0 | on success |
-EINVAL | on invalid parameters |
-errno | on error |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Read samples from IMU.
dev | IMU to read from |
samples | Sample buffer to read into |
max_samples | Maximum number of samples to populate |
0 | on success |
1 | on success, but FIFO frames have been lost |
-ENOMEM | more than max_samples samples buffered |
-errno | on error |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Wait for FIFO interrupt from IMU.
dev | IMU to wait on |
timeout | Duration to wait for |
0 | on success |
-EAGAIN | on timeout |
int imu_linear_downsample_scaled | ( | struct imu_linear_downsample_scaled_state * | state, |
const struct imu_sample * | input, | ||
uint16_t | num_input ) |
#include <infuse/drivers/imu.h>
Downsample IMU samples to a new frequency using linear interpolation.
Function returns as soon as state.output_offset == state.output_size. Function should be called again with remaining samples once output buffer has been processed and state.output_offset reset to 0.
output_frequency = input_frequency * freq_mult / freq_div
state | State structure |
input | Input IMU sample buffer |
num_input | Number of samples in input |
number | of input samples consumed |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Get the local ticks between samples in a buffer.
meta | Metadata for the relevant channel in a buffer |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Get the approximate sample rate of a buffer.
meta | Metadata for the relevant channel in a buffer |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Get the local tick counter of a given sample in a buffer.
meta | Metadata for the relevant channel in a buffer |
sample | Sample index to get timestamp for |
|
inlinestatic |
#include <infuse/drivers/imu.h>
Run self-test functionality on the IMU.
dev | IMU to run self-test on |
0 | on success |
-errno | on error |