Skip to content

Commit

Permalink
Clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 4, 2024
1 parent 7317b7c commit 5a9df2d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 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
5 changes: 2 additions & 3 deletions examples/src/bin/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use critical_section::Mutex;
use esp_backtrace as _;
use esp_hal::{
delay::Delay,
gpio,
gpio::Io,
gpio::{GpioPin, Io},
macros::ram,
prelude::*,
rtc_cntl::Rtc,
Expand All @@ -27,7 +26,7 @@ use esp_hal::{
};
use esp_println::println;

static TOUCH1: Mutex<RefCell<Option<TouchPad<gpio::GpioPin<4>, Continous, Blocking>>>> =
static TOUCH1: Mutex<RefCell<Option<TouchPad<GpioPin<4>, Continous, Blocking>>>> =
Mutex::new(RefCell::new(None));

#[handler]
Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/qspi_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cfg_if::cfg_if! {
struct Context {
spi: esp_hal::peripherals::SPI2,
dma_channel: Channel<'static, DmaChannel0, Blocking>,
miso: esp_hal::gpio::GpioPin<2>,
miso: GpioPin<2>,
miso_mirror: Output<'static, GpioPin<3>>,
clocks: Clocks<'static>,
}
Expand Down
6 changes: 3 additions & 3 deletions hil-test/tests/qspi_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use esp_hal::{
clock::Clocks,
dma::{Channel, Dma, DmaPriority, DmaTxBuf},
dma_buffers,
gpio::{Io, Pull},
gpio::{GpioPin, Io, Pull},
pcnt::{
channel::{EdgeMode, PcntInputConfig, PcntSource},
unit::Unit,
Expand Down Expand Up @@ -50,8 +50,8 @@ struct Context {
spi: esp_hal::peripherals::SPI2,
pcnt: esp_hal::peripherals::PCNT,
dma_channel: Channel<'static, DmaChannel0, Blocking>,
mosi: esp_hal::gpio::GpioPin<2>,
mosi_mirror: esp_hal::gpio::GpioPin<3>,
mosi: GpioPin<2>,
mosi_mirror: GpioPin<3>,
clocks: Clocks<'static>,
}

Expand Down
2 changes: 1 addition & 1 deletion hil-test/tests/qspi_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cfg_if::cfg_if! {
struct Context {
spi: esp_hal::peripherals::SPI2,
dma_channel: Channel<'static, DmaChannel0, Blocking>,
mosi: esp_hal::gpio::GpioPin<2>,
mosi: GpioPin<2>,
mosi_mirror: Output<'static, GpioPin<3>>,
clocks: Clocks<'static>,
}
Expand Down

0 comments on commit 5a9df2d

Please sign in to comment.