-
Notifications
You must be signed in to change notification settings - Fork 135
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
Driver for Ads868x #860
base: develop
Are you sure you want to change the base?
Driver for Ads868x #860
Conversation
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.
Overall nice driver!
140af48
to
ba926d8
Compare
I've squashed your commits and refactored the driver to use resumable functions. I also added a simple example. |
Thanks, I tried to do it, but I failed ;) |
OOps |
Fetch your remote first, then switch branch to the new origin branch, then you can modify you branch again. |
I'll try the code next week, I got ~2 years of modm update to import the target fw. :) |
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 for contributing the driver!
I think it might make sense to name the driver differently, since there are several ADCs from TI under the name ADS868x
(🤦🏽♀️), of which only ADS8681, ADS8685 and ADS8689 (datasheet) fit with this driver.
The chips ADS8684 and ADS8688 (datasheet) have 4 and 8 channels respectively and need a different/extended driver.
@@ -0,0 +1,59 @@ | |||
/* | |||
* Copyright (c) 2021, Raphael Lehmann |
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.
Probably not 😆
def init(module): | ||
module.name = ":driver:ads868x" | ||
module.description = """ | ||
# ADS868x Driver. | ||
|
||
ADS868x 16-Bit, High-Speed, Single-Supply, SAR ADC Data Acquisition System | ||
With Programmable, Bipolar Input Ranges |
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.
def init(module): | |
module.name = ":driver:ads868x" | |
module.description = """ | |
# ADS868x Driver. | |
ADS868x 16-Bit, High-Speed, Single-Supply, SAR ADC Data Acquisition System | |
With Programmable, Bipolar Input Ranges | |
def init(module): | |
module.name = ":driver:ads8681" | |
module.description = """ | |
# ADS8681/ADS8685/ADS8689 Driver. | |
ADS8681/ADS8685/ADS8689 16-Bit, Single-Channel, High-Speed, Single-Supply, SAR ADC Data Acquisition System | |
With Programmable, Bipolar Input Ranges | |
This driver does not work with ADS8684 and ADS8685 quad/octa channel ADCs. |
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.
@salkinium (How) is it possible with lbuild to name this driver :ads8681
and have aliases :ads8685
/:ads8689
?
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.
Yes, lbuild has aliases already built-in. Though in this case we probably want a silent alias, not sure if that is supported currently, or if lbuild just prints an empty warning for it still.
modm::delay_us(1); | ||
Cs::reset(); |
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.
A non-blocking wait would be nicer here, like for example implemented here:
modm/src/modm/driver/inertial/adis16470.hpp
Lines 315 to 316 in 2b4855b
const modm::ShortPreciseDuration tStall{std::chrono::microseconds(16)}; | |
modm::ShortPreciseTimeout timeout{tStall}; |
modm/src/modm/driver/inertial/adis16470_impl.hpp
Lines 61 to 67 in 2b4855b
if (this->releaseMaster()) { | |
Cs::set(); | |
} | |
timeout.restart(tStall); | |
RF_WAIT_UNTIL(timeout.isExpired()); | |
RF_WAIT_UNTIL(this->acquireMaster()); | |
Cs::reset(); |
Cs::set(); | ||
modm::delay_us(1); | ||
Cs::reset(); |
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.
Non-blocking wait would be nicer, see above...
Implementation for ADS868x ADC