-
Notifications
You must be signed in to change notification settings - Fork 8.3k
sensor: Introduce Phosense XBR818 Driver #81013
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
Conversation
jilaypandya
left a 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.
add an entry to the build_all test
https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/drivers/build_all/sensor/i2c.dtsi
Addressed all the comments, can you confirm what i've added to i2c.dtsi is correct? Thanks. Edit: I'm not sure what is causing the build failure, the changes I made shouldn't affect this, unless unknown vendor prefix breaks the test (which it shouldnt do knowing the majority of vendors are not in that list and i was told it's only a copy of the linux one, so we cant add to it). |
Try adding the vendor name over here |
Done, but I am concerned it isn't fine, though maybe I misunderstand something. |
|
give it a try with parenthesis
|
2d3bcad to
13b3571
Compare
jilaypandya
left a 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.
I believe you need to refactor the files in drivers/sensor/<vendor_name>/
I dont think so, looks to be only if there is more than one sensor of the vendor (eg sensor/bosch folder vs sensor/mhz19b or sensor/hp206c for example) |
|
Found a couple more cases of variable possibly spending longer time on stack than needed so i removed the init at 0 for them too. |
c86fa65 to
b49ba2b
Compare
|
Rebased on latest main. |
yperess
left a 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.
One more nit that I missed on the first pass, should be simple enough to update, then I think the driver looks ready.
|
No objections to the vendor-prefixes.txt change. I don't see anything else for me to review here. |
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.
| test_i2c_xbr818: xrb818@aa { | |
| test_i2c_xbr818: xbr818@aa { |
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.
Done.
drivers/sensor/xbr818/xbr818.c
Outdated
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.
i believe this is actually a violation of our coding guidelines (rule 10.3, casting enum essential type to int essential type). I think the proper solution is:
| switch ((int)attr) { | |
| switch ((enum sensor_attribute_xbr818)attr) { |
drivers/sensor/xbr818/xbr818.c
Outdated
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.
| switch ((int)attr) { | |
| switch ((enum sensor_attribute_xbr818)attr) { |
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.
This does not in the other direction this time (SENSOR_ATTR_SAMPLING_FREQUENCY case value '0' not in enumerated type 'enum sensor_attribute_xbr818'
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.
Eh, right 😐
Guess this pattern might be better then
| if (attr == SENSOR_ATTR_LOWER_THRESH) { |
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.
Done.
1fb13b3 to
42d4704
Compare
drivers/sensor/xbr818/xbr818.c
Outdated
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.
Just noticed this, val1 can also be negative, so you should add || val->val1 < 0
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.
Done.
drivers/sensor/xbr818/xbr818.c
Outdated
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.
Same here
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.
Done.
drivers/sensor/xbr818/xbr818.c
Outdated
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.
Can just return xbr818_disable_i2c(dev); here
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.
Done.
This Introduces a driver for the i2c interface of Phosense XBR818. XBR818 is a 10.525Ghz Radar chip with builtin detection algorithm. Signed-off-by: Camille BAUD <[email protected]>
rruuaanng
left a 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.
Thank you for taking my advice!
|
@MaureenHelm can you have a look please? PR has gone through quite a few iterations so I'm hopeful it's good to go :) |
| return ret; | ||
| } | ||
|
|
||
| static const struct sensor_driver_api xbr818_api = { |
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.
| static const struct sensor_driver_api xbr818_api = { | |
| static DEVICE_API(sensor, xbr818_api) = { |
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.
Should I submit a fix commit for this given this was merged before i had the time to update it?
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.
This would be great :)
Given feature freeze is in less than 24 hours I wanted to make sure this got in (and so did @MaureenHelm by not making that comment a blocker)
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.
It is at #85762


This Introduces a driver for the i2c interface of Phosense XBR818.
XBR818 is a 10.525Ghz Radar chip with in-built movement detection algorithm.