Skip to content

Commit f625a45

Browse files
committed
Fixes after rebase
1 parent 080f4ae commit f625a45

33 files changed

+106
-35
lines changed

esp-hal-common/src/prelude.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub use crate::{
5454
},
5555
},
5656
macros::*,
57-
serial::{Instance as _esp_hal_serial_Instance, UartPins as _esp_hal_serial_UartPins},
57+
uart::{Instance as _esp_hal_uart_Instance, UartPins as _esp_hal_uart_UartPins},
5858
spi::{
5959
dma::WithDmaSpi2 as _esp_hal_spi_dma_WithDmaSpi2,
6060
Instance as _esp_hal_spi_Instance,
@@ -132,7 +132,7 @@ pub mod eh1 {
132132
},
133133
},
134134
macros::*,
135-
serial::{Instance as _esp_hal_serial_Instance, UartPins as _esp_hal_serial_UartPins},
135+
uart::{Instance as _esp_hal_serial_Instance, UartPins as _esp_hal_serial_UartPins},
136136
spi::{
137137
dma::WithDmaSpi2 as _esp_hal_spi_dma_WithDmaSpi2,
138138
Instance as _esp_hal_spi_Instance,

esp-hal-common/src/pulse_control.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
//!
3737
//! ### Example (for ESP32-C3)
3838
//! ```
39-
//! let mut peripherals = pac::Peripherals::take().unwrap();
39+
//! let mut peripherals = peripherals::Peripherals::take().unwrap();
4040
//!
4141
//! // Configure RMT peripheral globally
4242
//! let pulse = PulseControl::new(

esp32-hal/examples/embassy_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use esp32_hal::{
99
clock::ClockControl,
1010
prelude::*,
1111
timer::TimerGroup,
12-
Rtc, embassy, pac::Peripherals,
12+
Rtc, embassy, peripherals::Peripherals,
1313
};
1414
use esp_backtrace as _;
1515
use static_cell::StaticCell;

esp32-hal/examples/i2c_bmp180_calibration_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32_hal::{
1313
clock::ClockControl,
1414
gpio::IO,
1515
i2c::I2C,
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32-hal/examples/i2s_read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use esp32_hal::{
1818
dma::{DmaPriority},
1919
pdma::Dma,
2020
i2s::{DataFormat, I2s, NoMclk, Standard, I2s0New, PinsBclkWsDin, I2sReadDma},
21-
pac::Peripherals,
21+
peripherals::Peripherals,
2222
prelude::*,
2323
timer::TimerGroup,
2424
Rtc,

esp32-hal/examples/i2s_sound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use esp32_hal::{
3434
dma::DmaPriority,
3535
pdma::Dma,
3636
i2s::{DataFormat, I2s, I2sWriteDma, NoMclk, PinsBclkWsDout, Standard, I2s0New},
37-
pac::Peripherals,
37+
peripherals::Peripherals,
3838
prelude::*,
3939
timer::TimerGroup,
4040
Rtc,

esp32-hal/examples/mcpwm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32_hal::{
1313
operator::PwmPinConfig,
1414
timer::PwmWorkingMode,
1515
},
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32-hal/examples/sha.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use esp32_hal::{
88
clock::ClockControl,
9-
pac::Peripherals,
9+
peripherals::Peripherals,
1010
prelude::*,
1111
timer::TimerGroup,
1212
Rtc,

esp32-hal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub use esp_hal_common::{
3131
Rng,
3232
Rtc,
3333
Rwdt,
34-
sha
34+
sha,
3535
Uart,
3636
};
3737

esp32c2-hal/examples/embassy_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use embassy_time::{Duration, Timer};
77
use esp32c2_hal::{
88
clock::ClockControl,
99
embassy,
10-
pac::Peripherals,
10+
peripherals::Peripherals,
1111
prelude::*,
1212
timer::TimerGroup,
1313
Rtc,

esp32c2-hal/examples/i2c_bmp180_calibration_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32c2_hal::{
1313
clock::ClockControl,
1414
gpio::IO,
1515
i2c::I2C,
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32c2-hal/examples/sha.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use esp32c2_hal::{
88
clock::ClockControl,
9-
pac::Peripherals,
9+
peripherals::Peripherals,
1010
prelude::*,
1111
timer::TimerGroup,
1212
Rtc,

esp32c3-hal/examples/embassy_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use esp32c3_hal::{
99
clock::ClockControl,
1010
prelude::*,
1111
timer::TimerGroup,
12-
Rtc, embassy, pac::Peripherals,
12+
Rtc, embassy, peripherals::Peripherals,
1313
};
1414
use esp_backtrace as _;
1515
use static_cell::StaticCell;

esp32c3-hal/examples/embassy_wait.rs

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#![no_std]
2+
#![no_main]
3+
#![feature(type_alias_impl_trait)]
4+
5+
use embassy_executor::Executor;
6+
use embassy_time::{Duration, Timer};
7+
8+
use esp32c3_hal::{
9+
clock::ClockControl,
10+
prelude::*,
11+
timer::TimerGroup,
12+
Rtc, embassy, peripherals::Peripherals, IO,
13+
};
14+
use esp_backtrace as _;
15+
use esp_hal_common::{PullDown, Bank0GpioRegisterAccess, InputOutputAnalogPinType, Input, GpioPin};
16+
use static_cell::StaticCell;
17+
18+
use embedded_hal_async::digital::Wait;
19+
20+
#[embassy_executor::task]
21+
async fn ping(mut pin: GpioPin<Input<PullDown>, Bank0GpioRegisterAccess, InputOutputAnalogPinType, 5>) {
22+
loop {
23+
esp_println::println!("Waiting...");
24+
pin.wait_for_rising_edge().await.unwrap();
25+
esp_println::println!("Ping!");
26+
Timer::after(Duration::from_millis(100)).await;
27+
}
28+
}
29+
30+
static EXECUTOR: StaticCell<Executor> = StaticCell::new();
31+
32+
#[riscv_rt::entry]
33+
fn main() -> ! {
34+
esp_println::println!("Init!");
35+
let peripherals = Peripherals::take().unwrap();
36+
let system = peripherals.SYSTEM.split();
37+
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
38+
39+
let mut rtc = Rtc::new(peripherals.RTC_CNTL);
40+
let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
41+
let mut wdt0 = timer_group0.wdt;
42+
let timer_group1 = TimerGroup::new(peripherals.TIMG1, &clocks);
43+
let mut wdt1 = timer_group1.wdt;
44+
45+
// Disable watchdog timers
46+
rtc.swd.disable();
47+
rtc.rwdt.disable();
48+
wdt0.disable();
49+
wdt1.disable();
50+
51+
#[cfg(feature = "embassy-time-systick")]
52+
embassy::init(&clocks, esp32c3_hal::systimer::SystemTimer::new(peripherals.SYSTIMER));
53+
54+
#[cfg(feature = "embassy-time-timg0")]
55+
embassy::init(&clocks, timer_group0.timer0);
56+
57+
// Set GPIO5 as an output, and set its state high initially.
58+
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
59+
let input = io.pins.gpio5.into_pull_down_input();
60+
61+
esp32c3_hal::interrupt::enable(
62+
esp32c3_hal::pac::Interrupt::GPIO,
63+
esp32c3_hal::interrupt::Priority::Priority1,
64+
)
65+
.unwrap();
66+
67+
let executor = EXECUTOR.init(Executor::new());
68+
executor.run(|spawner| {
69+
spawner.spawn(ping(input)).ok();
70+
});
71+
}

esp32c3-hal/examples/i2c_bmp180_calibration_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32c3_hal::{
1313
clock::ClockControl,
1414
gpio::IO,
1515
i2c::I2C,
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32c3-hal/examples/i2s_read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use esp32c3_hal::{
1919
dma::DmaPriority,
2020
gdma::Gdma,
2121
i2s::{DataFormat, I2s, I2sReadDma, MclkPin, PinsBclkWsDin, Standard, I2s0New},
22-
pac::Peripherals,
22+
peripherals::Peripherals,
2323
prelude::*,
2424
timer::TimerGroup,
2525
Rtc,

esp32c3-hal/examples/i2s_sound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use esp32c3_hal::{
3535
dma::DmaPriority,
3636
gdma::Gdma,
3737
i2s::{DataFormat, I2s, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard, I2s0New},
38-
pac::Peripherals,
38+
peripherals::Peripherals,
3939
prelude::*,
4040
timer::TimerGroup,
4141
Rtc,

esp32c3-hal/examples/sha.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use esp32c3_hal::{
88
clock::ClockControl,
9-
pac::Peripherals,
9+
peripherals::Peripherals,
1010
prelude::*,
1111
timer::TimerGroup,
1212
Rtc,

esp32c3-hal/examples/usb_serial_jtag.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use critical_section::Mutex;
1212
use esp32c3_hal::{
1313
clock::ClockControl,
1414
interrupt,
15-
pac::{self, USB_DEVICE},
15+
peripherals::{self, USB_DEVICE},
1616
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
@@ -55,7 +55,7 @@ fn main() -> ! {
5555
critical_section::with(|cs| USB_SERIAL.borrow_ref_mut(cs).replace(usb_serial));
5656

5757
interrupt::enable(
58-
pac::Interrupt::USB_SERIAL_JTAG,
58+
peripherals::Interrupt::USB_SERIAL_JTAG,
5959
interrupt::Priority::Priority1,
6060
)
6161
.unwrap();

esp32c3-hal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ unsafe fn configure_mmu() {
407407
0,
408408
);
409409

410-
let peripherals = pac::Peripherals::steal();
410+
let peripherals = peripherals::Peripherals::steal();
411411
peripherals.EXTMEM.icache_ctrl1.modify(|_, w| {
412412
w.icache_shut_ibus()
413413
.clear_bit()

esp32s2-hal/examples/embassy_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use esp32s2_hal::{
99
clock::ClockControl,
1010
prelude::*,
1111
timer::TimerGroup,
12-
Rtc, embassy, pac::Peripherals,
12+
Rtc, embassy, peripherals::Peripherals,
1313
};
1414
use esp_backtrace as _;
1515
use xtensa_atomic_emulation_trap as _;

esp32s2-hal/examples/i2c_bmp180_calibration_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32s2_hal::{
1313
clock::ClockControl,
1414
gpio::IO,
1515
i2c::I2C,
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32s2-hal/examples/i2s_read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use esp32s2_hal::{
1818
dma::{DmaPriority},
1919
pdma::Dma,
2020
i2s::{DataFormat, I2s, NoMclk, Standard, I2s0New, PinsBclkWsDin, I2sReadDma},
21-
pac::Peripherals,
21+
peripherals::Peripherals,
2222
prelude::*,
2323
timer::TimerGroup,
2424
Rtc,

esp32s2-hal/examples/i2s_sound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use esp32s2_hal::{
3535
dma::DmaPriority,
3636
pdma::Dma,
3737
i2s::{DataFormat, I2s, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard, I2s0New},
38-
pac::Peripherals,
38+
peripherals::Peripherals,
3939
prelude::*,
4040
timer::TimerGroup,
4141
Rtc,

esp32s2-hal/examples/sha.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use esp32s2_hal::{
88
clock::ClockControl,
9-
pac::Peripherals,
9+
peripherals::Peripherals,
1010
prelude::*,
1111
timer::TimerGroup,
1212
Rtc,

esp32s2-hal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub use esp_hal_common::{
3131
Rng,
3232
Rtc,
3333
Rwdt,
34-
sha
34+
sha,
3535
Uart,
3636
};
3737

esp32s3-hal/examples/embassy_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use esp32s3_hal::{
99
clock::ClockControl,
1010
prelude::*,
1111
timer::TimerGroup,
12-
Rtc, embassy, pac::Peripherals,
12+
Rtc, embassy, peripherals::Peripherals,
1313
};
1414
use esp_backtrace as _;
1515
use static_cell::StaticCell;

esp32s3-hal/examples/i2c_bmp180_calibration_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#![no_main]
1111

1212
use esp32s3_hal::{
13-
clock::ClockControl, gpio::IO, i2c::I2C, pac::Peripherals, prelude::*, timer::TimerGroup, Rtc,
13+
clock::ClockControl, gpio::IO, i2c::I2C, peripherals::Peripherals, prelude::*, timer::TimerGroup, Rtc,
1414
};
1515
use esp_backtrace as _;
1616
use esp_println::println;

esp32s3-hal/examples/i2s_read.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use esp32s3_hal::{
1919
dma::DmaPriority,
2020
gdma::Gdma,
2121
i2s::{DataFormat, I2s, I2sReadDma, MclkPin, PinsBclkWsDin, Standard, I2s0New},
22-
pac::Peripherals,
22+
peripherals::Peripherals,
2323
prelude::*,
2424
timer::TimerGroup,
2525
Rtc,

esp32s3-hal/examples/i2s_sound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use esp32s3_hal::{
3535
dma::DmaPriority,
3636
gdma::Gdma,
3737
i2s::{DataFormat, I2s, I2sWriteDma, MclkPin, PinsBclkWsDout, Standard, I2s0New},
38-
pac::Peripherals,
38+
peripherals::Peripherals,
3939
prelude::*,
4040
timer::TimerGroup,
4141
Rtc,

esp32s3-hal/examples/mcpwm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use esp32s3_hal::{
1313
operator::PwmPinConfig,
1414
timer::PwmWorkingMode,
1515
},
16-
pac::Peripherals,
16+
peripherals::Peripherals,
1717
prelude::*,
1818
timer::TimerGroup,
1919
Rtc,

esp32s3-hal/examples/sha.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use esp32s3_hal::{
88
clock::ClockControl,
9-
pac::Peripherals,
9+
peripherals::Peripherals,
1010
prelude::*,
1111
timer::TimerGroup,
1212
Rtc,

esp32s3-hal/examples/usb_serial_jtag.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use critical_section::Mutex;
1313
use esp32s3_hal::{
1414
clock::ClockControl,
1515
interrupt,
16-
pac::{self, USB_DEVICE},
16+
peripherals::{self, USB_DEVICE},
1717
peripherals::Peripherals,
1818
prelude::*,
1919
timer::TimerGroup,
@@ -50,7 +50,7 @@ fn main() -> ! {
5050

5151
critical_section::with(|cs| USB_SERIAL.borrow_ref_mut(cs).replace(usb_serial));
5252

53-
interrupt::enable(pac::Interrupt::USB_DEVICE, interrupt::Priority::Priority1).unwrap();
53+
interrupt::enable(peripherals::Interrupt::USB_DEVICE, interrupt::Priority::Priority1).unwrap();
5454

5555
loop {
5656
critical_section::with(|cs| {

0 commit comments

Comments
 (0)