Exercise B: Adaptation Challenge

~15 min

The Challenge

The example handles one button. Can you handle two?

What to Explore

  1. Add a second GPIO interrupt for another input on the uFerris board (or use a second pin connected to the same button if only one button is available)

  2. How does sharing work? You need another static Mutex<RefCell<Option<Input>>> for the second pin. Or can you reuse the same handler?

  3. Different behavior per pin: Can you make one button toggle the LED and the other change the blink speed?

Questions to Answer from the Docs

  • Can multiple GPIO pins share the same interrupt handler?
  • How do you tell which pin triggered the interrupt inside the handler?
  • Can you set different Event triggers for different pins?

Resources

  • esp_hal::gpio — look at the module-level docs for interrupt-related information
  • Your uFerris pinout card — what other pins can you use?
  • The Create → Configure → Control pattern applies to interrupt setup too