-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
sensor: sensing: unified api #64478
Merged
carlescufi
merged 15 commits into
zephyrproject-rtos:main
from
lixuzha:sensing_unified_api
Jan 24, 2024
Merged
sensor: sensing: unified api #64478
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2833e51
sensing: refine sensing API
ghu0510 e573e0f
sensing: unified the sensing sensor api
lixuzha 5577434
sensing: implement set/get interval and sensitivity
lixuzha acb0a57
sensing: implement sensor data dispatching
lixuzha d0b1ec3
sensor: add helper functions to convert milli/micro to sensor_value
lixuzha 180834b
sensing: implement the phy_3d_sensor
lixuzha 206d155
sensing: add stream mode property for sensing sensor
lixuzha aa0b05e
sensing: add hinge angle sensor
lixuzha 7385ee0
samples: sensing: add more sample code
lixuzha 75d0e36
sensing: support multiple sensor types in one device
lixuzha 8940777
sensing: Simplify and correct some docstrings
teburd 4a3da59
sensing: Code formatting fixups
teburd 69dfb7d
sensing: Fix initializer compile-time constant
teburd 1b5cdef
sensing: using the single sensing_connections for the same device
lixuzha 437501e
sensing: add rtio implement for sensing subsys
lixuzha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2023, Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
description: Sensing subsystem hinge angle sensor bindings. | ||
|
||
compatible: "zephyr,sensing-hinge-angle" | ||
|
||
# Common sensor subsystem sensor properties. | ||
include: ["zephyr,sensing-sensor.yaml"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,11 @@ struct sensing_sensor_version { | |
*/ | ||
#define SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1) | ||
|
||
/** | ||
* @brief SENSING_SENSITIVITY_INDEX_ALL indicating sensitivity of each data field should be set | ||
* | ||
*/ | ||
#define SENSING_SENSITIVITY_INDEX_ALL -1 | ||
|
||
/** | ||
* @brief Sensing subsystem sensor state. | ||
|
@@ -110,7 +115,8 @@ typedef void *sensing_sensor_handle_t; | |
*/ | ||
typedef void (*sensing_data_event_t)( | ||
sensing_sensor_handle_t handle, | ||
const void *buf); | ||
const void *buf, | ||
void *context); | ||
|
||
/** | ||
* @struct sensing_sensor_info | ||
|
@@ -144,6 +150,7 @@ struct sensing_sensor_info { | |
*/ | ||
struct sensing_callback_list { | ||
sensing_data_event_t on_data_event; | ||
void *context; | ||
Comment on lines
152
to
+153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need doxygen comment |
||
}; | ||
/** | ||
* @struct sensing_sensor_config | ||
|
@@ -152,7 +159,10 @@ struct sensing_callback_list { | |
*/ | ||
struct sensing_sensor_config { | ||
enum sensing_sensor_attribute attri; | ||
|
||
/** \ref SENSING_SENSITIVITY_INDEX_ALL */ | ||
int8_t data_field; | ||
|
||
union { | ||
uint32_t interval; | ||
uint32_t sensitivity; | ||
|
@@ -186,15 +196,16 @@ int sensing_get_sensors(int *num_sensors, const struct sensing_sensor_info **inf | |
* | ||
* @param info The sensor info got from \ref sensing_get_sensors | ||
* | ||
* @param cb_list callback list to be registered to sensing. | ||
* @param cb_list callback list to be registered to sensing, must have a static | ||
* lifetime. | ||
* | ||
* @param handle The opened instance handle, if failed will be set to NULL. | ||
* | ||
* @return 0 on success or negative error value on failure. | ||
*/ | ||
int sensing_open_sensor( | ||
const struct sensing_sensor_info *info, | ||
const struct sensing_callback_list *cb_list, | ||
struct sensing_callback_list *cb_list, | ||
sensing_sensor_handle_t *handle); | ||
|
||
/** | ||
|
@@ -207,14 +218,15 @@ int sensing_open_sensor( | |
* | ||
* @param dev pointer device get from device tree. | ||
* | ||
* @param cb_list callback list to be registered to sensing. | ||
* @param cb_list callback list to be registered to sensing, must have a static | ||
* lifetime. | ||
* | ||
* @param handle The opened instance handle, if failed will be set to NULL. | ||
* | ||
* @return 0 on success or negative error value on failure. | ||
*/ | ||
int sensing_open_sensor_by_dt( | ||
const struct device *dev, const struct sensing_callback_list *cb_list, | ||
const struct device *dev, struct sensing_callback_list *cb_list, | ||
sensing_sensor_handle_t *handle); | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs doxygen comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Submitted #68317 to fix it.