-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Introduce new generic ADC driver for ADS1115 chip #14437
Conversation
fa8db9c
to
ccd1722
Compare
I don't quite understand the need for the I2C_Interface and the ADS1115_Wrapper. Why not just have a simple ADS1115 that extends device::I2C? Example: https://github.com/PX4/Firmware/blob/master/src/drivers/magnetometer/isentek/ist8308/IST8308.hpp The other minor thing is the placement within another module (drivers/adc). I'd like to avoid modules within modules, although obviously our organization system needs work (where to put or name the generic adc driver). |
I just want to make it more clear to understand. Seems it cannot be achieved now.... I'll migrate them into the same place |
24bc3c3
to
339d873
Compare
70e297f
to
de4478b
Compare
962ff61
to
b3b6849
Compare
b3b6849
to
0d2bf87
Compare
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
updated & checked for availability |
a48bca0
to
647f6a8
Compare
647f6a8
to
08168d2
Compare
Happy to merge once #14477 is in. |
a1ce74d
to
8c479d7
Compare
Ready. |
boards/px4/fmu-v3/default.cmake
Outdated
@@ -19,6 +19,7 @@ px4_add_board( | |||
TEL4:/dev/ttyS6 | |||
DRIVERS | |||
adc/board_adc | |||
adc/ADS1115 |
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 is nitpicky, but for consistency how about keeping the folder name lowercase like all the other drivers and modules?
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.
Confirmed.
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.
Everything seems ok to me @SalimTerryLi great work.
Update: The only issue I have faced testing your driver is when the driver is already running and is started again, it crashes and the driver can never be started again unless the autopilot is rebooted.
Oh yes. It seems I forget to do ScheduleClear() on exit. I will test and fix it later. Thanks for your report. |
Could you please provide more information? How it crashed? Anything outputted? It works just fine on my Pi. BTW there is no need to manually call
|
Oh ok it is my bad. I am working on my customized firmware that is still back at 1.9.0. Therefore I have ammended your main function. My start() implementation was wrong. I have fixed it now. |
Describe problem solved by this pull request
This driver would provide ADC interface for boards without on-chip ADC function such as RPi.
Describe your solution
Sampling on trigger, SPS=250, VREF=6.144.
Scheduled at 80Hz, looping through its four multiplexed channel, the driver publishes a new adc_report after all 4 channels are captured, at 20Hz.
This driver is designed to run on any platforms. But ADC subscribers are not checking devID at now, so it should only run on boards without on-chip ADC.
Test data / coverage

Works fine on RPi.