-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
lack of a performant sensor API #1387
Comments
Linux instance can now be closed from JS with process.exit() Fixes zephyrproject-rtos#1387 Signed-off-by: James Prestwood <james.prestwood@intel.com>
CC @pabigot |
I'd be interested in taking this on, but it'd start with some architectural design. A generic ability to have device-specific functions and state exposed to the user seems to be lacking in Zephyr and I believe that lack makes things difficult (for both sensors and for devices that support a generic API but have extra functionality that isn't obviously generalizable). |
What I don't like about the current API
|
I'm currently working on an RFC for the sensor API to address some of the limitations highlighted in this issue, which I've run into myself writing some drivers to contribute, and wanted to contribute to this issue as I work through writing up the initial RFC. ProblemsProblem 1: Lack of meta-data with sensor samplesToday, the sensor API has a workable abstraction layer where all sensors have:
Sensor drivers respond to requests for channels like This works fine for many basic uses cases, but you hit a wall when things don’t fall into the narrow constraints of the current channel definition(s). For example, we have channels for There is currently no way to add meta-data to channel responses, and if we add a new channel like Problem 2: Support for multiple instances of the same channelHow can we best handle situations where it's perfectly valid to have multiple distinct samples from the same channel on a sensor in one Possible Solution(s)As a naive solution, we could add two more values to the There are a number of possibilities here, but they all have tradeoffs, and I'm hoping to get a discussion started on what some of the pros/cons of different solutions to the above problems might be. As I mentioned, I'm working on an RFC addressing the issues related to light in particular, detailing the current problems and trying to suggest some solutions and the tradeoffs involved, but this is something that touches on the whole sensor API, so I wanted to add my initial thoughts here while I work on the RFC. I'll address some issues in other sensor families like motion-related devices, but light has the most obvious problems to me at present so I wanted to start there. Any suggestions on what might make sense to handle a situation like the spectrometer above would be useful, so that a meaningful proposal can be made for improvements. |
A What we've done so far is setting periodic @microbuilder How about adding a |
Likely resolved by #60063 |
While Zephyr has a sensor data API, it only allows to solve very simple problems. The API does not support FIFO-model which is critical to achieve power savings on the main MCU. A user would have to reimplement his own FIFO- and timestamping capable API if they decide to use Zephyr, and this is non-trivial. Additionally API has limited means to define context where measurement is run. Running each measurement in own thread or circulating measurements via global thread is neither convenient nor efficient.
Existing sensor APIs:
The text was updated successfully, but these errors were encountered: