Skip to content
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

sensors: Add streaming APIs #60063

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

yperess
Copy link
Collaborator

@yperess yperess commented Jul 5, 2023

Introduce a streaming API that uses the same data path as the async API.

This includes features to the decoder:

  • Checking if triggers are present

Adding streaming features built ontop of existing triggers:

  • Adding 3 operations to be done on a trigger
    • include - include the data with the trigger information
    • nop - do nothing
    • drop - drop the data (flush)
  • Add a new sensor_stream() API to mirror sensor_read() but add an
    optional handler to be able to cancel the stream.

Fixes #1387
Fixes #13718

asemjonovs
asemjonovs previously approved these changes Jul 17, 2023
include/zephyr/drivers/sensor.h Outdated Show resolved Hide resolved
@teburd
Copy link
Collaborator

teburd commented Jul 17, 2023

I'll try and look at this soon

This was referenced Jul 19, 2023
@microbuilder microbuilder self-requested a review July 19, 2023 19:56
@nashif
Copy link
Member

nashif commented Jul 19, 2023

@yperess do we need to update the documnetaion with this new addition?

@yperess
Copy link
Collaborator Author

yperess commented Jul 19, 2023

@yperess do we need to update the documnetaion with this new addition?

I'm holding off on the documentation to make sure it's stable before we start directing people to it. Though if you think there's a benefit to it I'm happy to do it and put a banner above for "experimental"

I have some changes in the pipe for the decoder (expected to be done late next week)

teburd
teburd previously approved these changes Jul 21, 2023
@yperess yperess dismissed stale reviews from teburd and asemjonovs via f707e7a July 26, 2023 19:11
@yperess yperess force-pushed the push-bot/sensor_stream branch 2 times, most recently from f707e7a to d02d9dc Compare July 26, 2023 19:12
@yperess
Copy link
Collaborator Author

yperess commented Jul 26, 2023

@teburd and @asemjonovs when looking at the Compare the first force push was a rebase, the second adds the doxygen.

asemjonovs
asemjonovs previously approved these changes Jul 26, 2023
teburd
teburd previously approved these changes Jul 26, 2023
@yperess yperess dismissed stale reviews from teburd and asemjonovs via 273c5e7 July 26, 2023 20:14
@yperess
Copy link
Collaborator Author

yperess commented Jul 26, 2023

Had an issue when rebasing. I had to move the streaming logic out to a separate file.

asemjonovs
asemjonovs previously approved these changes Jul 26, 2023
drivers/sensor/sensor_shell.c Outdated Show resolved Hide resolved
include/zephyr/drivers/sensor.h Outdated Show resolved Hide resolved
@yperess
Copy link
Collaborator Author

yperess commented Oct 31, 2023

@MaureenHelm @KeHIntel @lixuzha can you re-review?

KeHIntel
KeHIntel previously approved these changes Nov 1, 2023
@lixuzha
Copy link
Collaborator

lixuzha commented Nov 1, 2023

@MaureenHelm @KeHIntel @lixuzha can you re-review?

Please also use _CONCAT in SENSOR_DT_READ_IODEV. Thanks.

Introduce a streaming API that uses the same data path as the async API.

This includes features to the decoder:
* Checking if triggers are present

Adding streaming features built ontop of existing triggers:
* Adding 3 operations to be done on a trigger
  * include - include the data with the trigger information
  * nop - do nothing
  * drop - drop the data (flush)
* Add a new sensor_stream() API to mirror sensor_read() but add an
optional handler to be able to cancel the stream.

Signed-off-by: Yuval Peress <peress@google.com>
topic#sensor_stream
Add streaming implementation for icm42688 using both threshold and
full FIFO triggers.

Signed-off-by: Yuval Peress <peress@google.com>
topic#sensor_stream
Having a % FIFO watermark isn't very useful as it doesn't convey how long
the SoC can sleep (or do other work) while batching sensor data. Convert
the attribute to a batch duration using ticks. Currently the ticks are
in system ticks, but eventually when an external clock is attached to
the sensor it will be in the external clock's ticks.

Signed-off-by: Yuval Peress <peress@google.com>
@yperess
Copy link
Collaborator Author

yperess commented Nov 8, 2023

CI is blocked on #64881

@nashif
Copy link
Member

nashif commented Nov 10, 2023

CI is blocked on #64881

can you rebase please?

@nashif
Copy link
Member

nashif commented Nov 10, 2023

can you rebase please?

oh, it is passing already, why is this considered blocked

@kartben
Copy link
Collaborator

kartben commented Nov 10, 2023

can you rebase please?

oh, it is passing already, why is this considered blocked

@MaureenHelm had requested changes - but it looks like they have been addressed.

@MaureenHelm MaureenHelm merged commit 3c6e66e into zephyrproject-rtos:main Nov 10, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Updated Sensor API lack of a performant sensor API
10 participants