"I found my debugger had trouble..." <- > <@michael.desilva:matrix.org> I found my debugger had trouble stepping into certain blocks so I decided to toggle another LED - just to cofirm the logic path. I haven't been able to see any defmt output, so > > ```rust > fn get_pin_state( > cs: critical_section::CriticalSection<'_>, > got_pin: Option<&mut Pin<'E', 3, Output>>, > ) { > if let Some(pin) = got_pin { > defmt::info!("Got pin BLUE"); > match pin.get_state() { > stm32h7xx_hal::gpio::PinState::Low => { > defmt::info!("Got pin BLUE state: PinState::Low"); > let binding = &mut *LED_GREEN.borrow_ref_mut(cs); > if let Some(pin) = binding { > pin.set_low(); > }; > } > stm32h7xx_hal::gpio::PinState::High => { > defmt::info!("Got pin BLUE state: PinState::High"); > let binding = &mut *LED_GREEN.borrow_ref_mut(cs); > if let Some(pin) = binding { > pin.set_high(); > }; > } > } > } > } > ``` > > This isn't necessary, but I thought if I could pass `got_pin: Option<&mut Pin<'E', 3, Output>>` in a type-erased way to allow the caller to determine the type. > > Suppose we can downcast from something like: > > ```rust > fn get_pin_state(cs: critical_section::CriticalSection<'_>, got_pin: Option) { > // FIXME needs to downcast correctly > if let Some(pin) = got_pin { > ``` > > I could just rename the fn as `get_led_blue_pin_state`, but I wondered if there's a cleaner way Gotcha, check out the erased pin type I linked you, it's meant for exactly that without any dark magic.