-
Notifications
You must be signed in to change notification settings - Fork 1
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
SNS - Initial ADC Implementation #25
base: main
Are you sure you want to change the base?
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.
A few changes are needed now because of the change in repo structure. You'll need to move the lib/io/stm32l476rg/src/adc.rs
into boards/stm32l476rg/src/io
. (You need to open the boards/stm32l476rg
folder in VS Code to get IDE features from Rust Analyzer.) Not sure about the channel...
ADC implementation which passes |
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.
Figured out the channel thing:
embassy_stm32::adc::Adc::new
takes in a peripheral which is the ADC on the board (there is more than one), e.g.p.ADC1
- Then the
AnyAdcChannel
input toAdc::blocking_read
is a pin which implements theAnyAdcChannel
trait for selected ADC which was passed intonew
.
Basically makes sense to rename pin
to channel
anyway but otherwise looks perfect. To instantiate it would be this (I've just checked that this compiles properly):
let adc = Adc::new(p.ADC1);
let hyped_adc = Stm32l476rgAdc::new(adc, p.PA0.degrade_adc());
Also fix typos + formatting, then mark as ready for review :)
Converted the
adc.hpp
from 2024. David and I discussed and realised that no ADC exclusive sensor was ever used last year, and so only the MUX code has ever been usedAs such this is being temporarily abandoned, the work done thusfar (however minimal) is being kept here
(Update)
We determined that it was worth implementing, though because Embassy has ADC functionality most of the C++ implementation could be ignored
I've implemented something basic for ADC, but it's not been tested and will need looked at by somebody else