-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Due to GPIO changes mentioned in the changelog:
The OutputOpenDrain driver has been removed. You can use Output instead with
DriveMode::OpenDrain. The input-related methods of OutputOpenDrain (level,
is_high, is_low) are available through the (unstable) Flex driver.
- OutputOpenDrain::new(peripherals.GPIO0, Level::Low);
+ Output::new(
peripherals.GPIO0,
Level::Low,
OutputConfig::default()
.with_drive_mode(DriveMode::OpenDrain),
);Due to that the examples no longer works.
My workaround was:
let delay = Delay::new();
let mut pin = Output::new(
peripherals.GPIO5,
Level::High,
OutputConfig::default().with_drive_mode(DriveMode::OpenDrain),
)
.into_flex();
pin.set_input_enable(true);
pin.set_output_enable(true);
let mut dht22 = Dht22::new(pin, delay);
loop {
match dht22.read() {
Ok(sensor_reading) => log::info!(
"DHT 22 Sensor - Temperature: {} °C, humidity: {} %",
sensor_reading.temperature,
sensor_reading.humidity
),
Err(error) => {
log::error!("An error occurred while trying to read sensor: {:?}", error)
}
}syrtcevvi
Metadata
Metadata
Assignees
Labels
No labels