Zephyr Project API
3.4.0
A Scalable Open Source RTOS
|
Decodes a single raw data buffer. More...
#include <sensor.h>
Data Fields | |
int(* | get_frame_count )(const uint8_t *buffer, uint16_t *frame_count) |
Get the number of frames in the current buffer. More... | |
int(* | get_timestamp )(const uint8_t *buffer, uint64_t *timestamp_ns) |
Get the timestamp associated with the first frame. More... | |
int(* | get_shift )(const uint8_t *buffer, enum sensor_channel channel_type, int8_t *shift) |
Get the shift count of a particular channel (multiplier) More... | |
int(* | decode )(const uint8_t *buffer, sensor_frame_iterator_t *fit, sensor_channel_iterator_t *cit, enum sensor_channel *channels, q31_t *values, uint8_t max_count) |
Decode up to N samples from the buffer. More... | |
Decodes a single raw data buffer.
Data buffers are provided on the :c:struct:rtio
context that's supplied to c:func:sensor_read
.
int(* sensor_decoder_api::decode) (const uint8_t *buffer, sensor_frame_iterator_t *fit, sensor_channel_iterator_t *cit, enum sensor_channel *channels, q31_t *values, uint8_t max_count) |
Decode up to N samples from the buffer.
This function will never wrap frames. If 1 channel is available in the current frame and max_count
is 2, only 1 channel will be decoded and the frame iterator will be modified so that the next call to decode will begin at the next frame.
[in] | buffer | The buffer provided on the :c:struct:rtio context |
[in,out] | fit | The current frame iterator |
[in,out] | cit | The current channel iterator |
[out] | channels | The channels that were decoded |
[out] | values | The scaled data that was decoded |
[in] | max_count | The maximum number of channels to decode. |
Get the number of frames in the current buffer.
[in] | buffer | The buffer provided on the :c:struct:rtio context. |
[out] | frame_count | The number of frames on the buffer (at least 1) |
int(* sensor_decoder_api::get_shift) (const uint8_t *buffer, enum sensor_channel channel_type, int8_t *shift) |
Get the shift count of a particular channel (multiplier)
This value can be used by shifting the q31_t value resulting in the SI unit of the reading. It is guaranteed that the shift for a channel will not change between frames.
[in] | buffer | The buffer provided on the :c:struct:rtio context. |
[in] | channel_type | The c:enum:sensor_channel to query |
[out] | shift | The bit shift of the channel for this data buffer. |
channel_type
doesn't exist in the buffer Get the timestamp associated with the first frame.
[in] | buffer | The buffer provided on the :c:struct:rtio context. |
[out] | timestamp_ns | The closest timestamp for when the first frame was generated as attained by :c:func:k_uptime_ticks . |