Skip to content

Commit

Permalink
Clean up example
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 4, 2024
1 parent 7317b7c commit 83e419f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/src/bin/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ use critical_section::Mutex;
use esp_backtrace as _;
use esp_hal::{
delay::Delay,
gpio::{self, Event, Input, Io, Level, Output, Pull},
gpio::{Event, GpioPin, Input, Io, Level, Output, Pull},
macros::ram,
prelude::*,
};

cfg_if::cfg_if! {
if #[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))] {
static BUTTON: Mutex<RefCell<Option<Input<gpio::GpioPin<0>>>>> = Mutex::new(RefCell::new(None));
const BUTTON_PIN: u8 = 0;
} else {
static BUTTON: Mutex<RefCell<Option<Input<gpio::GpioPin<9>>>>> = Mutex::new(RefCell::new(None));
const BUTTON_PIN: u8 = 9;
}
}

static BUTTON: Mutex<RefCell<Option<Input<GpioPin<BUTTON_PIN>>>>> = Mutex::new(RefCell::new(None));

#[entry]
fn main() -> ! {
let (peripherals, clocks) = esp_hal::init(esp_hal::Config::default());
Expand Down

0 comments on commit 83e419f

Please sign in to comment.