From a3e0fcef0bf18ff862c80a8b2fec3292dbddcfdf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 17 May 2022 06:27:26 +0200 Subject: [PATCH] Impl drop for embassy-rp gpio Output This commit implements drop for embassy-rp gpio Output which is currently a todo. --- embassy-rp/src/gpio.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 28dfce47..68995b78 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -135,7 +135,14 @@ impl<'d, T: Pin> Output<'d, T> { impl<'d, T: Pin> Drop for Output<'d, T> { fn drop(&mut self) { - // todo + let val = 1 << self.pin.pin(); + unsafe { + self.pin.sio_out().value_clr().write_value(val); + self.pin.sio_oe().value_clr().write_value(val); + self.pin.io().ctrl().write(|w| { + w.set_funcsel(pac::io::vals::Gpio0CtrlFuncsel::NULL.0); + }); + }; } }