Hi,
I am trying to use the ADC on my Microbit. I must admit that I am new to Rust. So far I managed to get the ADC initialization to compile. But now I m stuck at using the read function from nrf-hal-common/src/adc.rs:
impl<PIN> OneShot<Adc, i16, PIN> for Adc
where
PIN: Channel<Adc, ID = u8>,
{
type Error = ();
fn read(&mut self, _pin: &mut PIN) -> nb::Result<i16, Self::Error> {
let original_inpsel = self.0.config.read().inpsel();
match PIN::channel() {
0 => self.0.config.modify(|_, w| w.psel().analog_input0()),
Short question: How do I define the PIN for the read function?
A physical pin does not work:
let mut anapin = board.adc_pins.adc03;
Long Question: The implementation uses a generic type which has a trait with more generic parameters as its type?
PIN: Channel<Adc, ID = u8>,
Any hints are appreciated.
Cheers,
Torsten