Open jannic opened 2 years ago
NOTE: I don't have hardware to actually test this fix.
Sadly currently neither do I since I burned my redv :(
I tested this on my RED-V, works fine :+1: .
An aside: I was wondering, whether if in the output functions (into_output
, into_inverted_output
, into_output_drive
, and into_inverted_output_drive
) we should also be clearing the input_en
enable bit (e.g., adding the line $GPIOX::set_input_en(Self::INDEX, false);
) in all the aforementioned functions?
According to https://docs.rs/embedded-hal/latest/embedded_hal/digital/v2/trait.StatefulOutputPin.html, the functions in StatefulOutputPin should not read the actual electrical value of the pin, but the current state of the output driver.
The fe310 manual states: "Reading the output_val register returns the written value. Reading the input_val register returns the actual value of the pin gated by input_en."
So the right thing to do here is to read the corresponding bit in the output register.
NOTE: I don't have hardware to actually test this fix.