-
Notifications
You must be signed in to change notification settings - Fork 8.1k
drivers: sensor: async_api: Adding channels to stream triggers #97708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
drivers: sensor: async_api: Adding channels to stream triggers #97708
Conversation
|
@kartben The CI encountered an API rate limit error. I’m not sure if there’s anything I need to do. Is this an issue on Zephyr’s end or on my organization’s end? |
|
Thanks @kartben for your quick action on this — much appreciated. |
|
Should it be |
|
Oh, you’re right, @alexapostolu — I didn’t think about the channel indices. I’ll make the change. |
fec73ac to
a4f510a
Compare
Added `struct sensor_chan_spec chan_spec` in `struct sensor_stream_trigger` in order to allow the user to configure different `opt` to different channels using the same `trigger`. Signed-off-by: Logan Saint-Germain <[email protected]>
The zero fill of the new struct sensor_stream_trigger make default channel
into `SENSOR_CHAN_ACCEL_X`. Reworked macro instanciation for
sensor_stream_trigger to construct structure with fall back to default
SENSOR_CHAN_ALL. It changes `{}` to `()` in order to use
`FOR_EACH_NONEMPTY_TERM` macro.
Also changed every sample using it and documentation.
Signed-off-by: Logan Saint-Germain <[email protected]>
…igger The changes of sensor_stream_trigger constrution inside `SENSOR_DT_STREAM_IODEV` created divergence in parameter providing method. sensor_chan_spec is now at the same state. Also changed samples using it and documentation. Signed-off-by: Logan Saint-Germain <[email protected]>
a4f510a to
99560ad
Compare
|
Added two commits to address the following points:
Of course the changes impact samples and documentation. |
|
|
@MaureenHelm the CI is all green. Whenever you have a chance, your review would be greatly appreciated. |



Some sensors have one trigger type for different data.
To address this feature, the standard api
sample_fetch/channel_getallows the user to specify channels with the trigger type.However, the async API
ReadandDecodedoesn't gives channels configuration oportunity.Proposition:
This issue can be handled by adding
enum sensor_channel chaninstruct sensor_stream_trigger.Adding it to the end of the structure doesn't break any macro or existing code.
It allows the user to configure different
optfor different channels using the sametriggertype.Implications:
While the default value
{0, 0}forchan_specis not an issue in itself, it becomes problematic when developers start checking forchan_specin the stream API.A reworked SENSOR_DT_STREAM_IODEV macro addresses this issue.
In this new design, the macro now handles an array of tuples of size 2 or 3 —
(T, O)or(T, O, {C, I})— instead of the previous array format{T, O}or{T, O, {C, I}}.This approach enables the use of FOR_EACH_NONEMPTY_TERM in tandem with the newly introduced SENSOR_CHAN_SPEC_PREP, which prepares the construction of the struct sensor_stream_trigger.
Consistency
The
struct sensor_chan_spechas been updated for consistency with thestruct sensor_stream_trigger.