Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sensor_decode_context Struct Reference

Used for iterating over the data frames via the sensor_decoder_api. More...

#include <sensor.h>

Data Fields

const struct sensor_decoder_apidecoder
 
const uint8_tbuffer
 
struct sensor_chan_spec channel
 
uint32_t fit
 

Detailed Description

Used for iterating over the data frames via the sensor_decoder_api.

Example usage:

(.c)
while (true) {
struct sensor_three_axis_data accel_out_data;
num_decoded_channels = sensor_decode(ctx, &accel_out_data, 1);
if (num_decoded_channels <= 0) {
printk("Done decoding buffer\n");
break;
}
printk("Decoded (%" PRId32 ", %" PRId32 ", %" PRId32 ")\n", accel_out_data.readings[0].x,
accel_out_data.readings[0].y, accel_out_data.readings[0].z);
}
static int sensor_decode(struct sensor_decode_context *ctx, void *out, uint16_t max_count)
Decode N frames using a sensor_decode_context.
Definition sensor.h:582
#define SENSOR_DECODE_CONTEXT_INIT(decoder_, buffer_, channel_type_, channel_index_)
Initialize a sensor_decode_context.
Definition sensor.h:566
@ SENSOR_CHAN_ACCEL_XYZ
Acceleration on the X, Y and Z axes.
Definition sensor.h:69
#define PRId32
Definition inttypes.h:15
static void printk(const char *fmt,...)
Print kernel debugging message.
Definition printk.h:51
Used for iterating over the data frames via the sensor_decoder_api.
Definition sensor.h:556
const struct sensor_decoder_api * decoder
Definition sensor.h:557
const uint8_t * buffer
Definition sensor.h:558
Data for a sensor channel which reports on three axes.
Definition sensor_data_types.h:52

Field Documentation

◆ buffer

const uint8_t* sensor_decode_context::buffer

◆ channel

struct sensor_chan_spec sensor_decode_context::channel

◆ decoder

const struct sensor_decoder_api* sensor_decode_context::decoder

◆ fit

uint32_t sensor_decode_context::fit

The documentation for this struct was generated from the following file: