auto enable interrupts (#1014)
* auto enable interrupts * changelog * cfgs
This commit is contained in:
parent
6288e6421d
commit
19c9cef9a8
@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- S2 / S3: Don't require GPIO 18 to create a USB peripheral driver instance (#990)
|
- S2 / S3: Don't require GPIO 18 to create a USB peripheral driver instance (#990)
|
||||||
- Updated to latest release candidate (`1.0.0-rc.2`) for `embedded-hal{-async,-nb}` (#994)
|
- Updated to latest release candidate (`1.0.0-rc.2`) for `embedded-hal{-async,-nb}` (#994)
|
||||||
- Explicit panic when hitting the `DefaultHandler` (#1005)
|
- Explicit panic when hitting the `DefaultHandler` (#1005)
|
||||||
|
- Relevant interrupts are now auto enabled in `embassy::init` (#1014).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@ -67,8 +67,8 @@ ufmt-write = { version = "0.1.0", optional = true }
|
|||||||
esp32 = { version = "0.28.0", features = ["critical-section"], optional = true }
|
esp32 = { version = "0.28.0", features = ["critical-section"], optional = true }
|
||||||
esp32c2 = { version = "0.16.0", features = ["critical-section"], optional = true }
|
esp32c2 = { version = "0.16.0", features = ["critical-section"], optional = true }
|
||||||
esp32c3 = { version = "0.19.0", features = ["critical-section"], optional = true }
|
esp32c3 = { version = "0.19.0", features = ["critical-section"], optional = true }
|
||||||
esp32c6 = { version = "0.9.0", features = ["critical-section"], optional = true }
|
esp32c6 = { version = "0.10.0", features = ["critical-section"], optional = true }
|
||||||
esp32h2 = { version = "0.5.0", features = ["critical-section"], optional = true }
|
esp32h2 = { version = "0.6.0", features = ["critical-section"], optional = true }
|
||||||
esp32s2 = { version = "0.19.0", features = ["critical-section"], optional = true }
|
esp32s2 = { version = "0.19.0", features = ["critical-section"], optional = true }
|
||||||
esp32s3 = { version = "0.23.0", features = ["critical-section"], optional = true }
|
esp32s3 = { version = "0.23.0", features = ["critical-section"], optional = true }
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,8 @@ use core::cell::Cell;
|
|||||||
|
|
||||||
use embassy_time::driver::{AlarmHandle, Driver};
|
use embassy_time::driver::{AlarmHandle, Driver};
|
||||||
|
|
||||||
|
use crate::{interrupt::Priority, peripherals::Interrupt};
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
all(systimer, feature = "embassy-time-systick"),
|
all(systimer, feature = "embassy-time-systick"),
|
||||||
path = "time_driver_systimer.rs"
|
path = "time_driver_systimer.rs"
|
||||||
@ -96,7 +98,69 @@ use time_driver::EmbassyTimer;
|
|||||||
|
|
||||||
use crate::clock::Clocks;
|
use crate::clock::Clocks;
|
||||||
|
|
||||||
|
/// Initialise embassy, including setting up interrupts for the DMA and async
|
||||||
|
/// enabled peripherals.
|
||||||
pub fn init(clocks: &Clocks, td: time_driver::TimerType) {
|
pub fn init(clocks: &Clocks, td: time_driver::TimerType) {
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_IN_CH0, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_OUT_CH0, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_IN_CH1, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_OUT_CH1, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_IN_CH2, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32s3, esp32c6, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_OUT_CH2, Priority::max()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(esp32s3)]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_IN_CH3, Priority::max()).unwrap();
|
||||||
|
#[cfg(esp32s3)]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_OUT_CH3, Priority::max()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(any(esp32c3, esp32c2))]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_CH0, Priority::max()).unwrap();
|
||||||
|
#[cfg(esp32c3)]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_CH1, Priority::max()).unwrap();
|
||||||
|
#[cfg(esp32c3)]
|
||||||
|
crate::interrupt::enable(Interrupt::DMA_CH2, Priority::max()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(any(esp32))]
|
||||||
|
crate::interrupt::enable(Interrupt::SPI1_DMA, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32, esp32s2))]
|
||||||
|
crate::interrupt::enable(Interrupt::SPI2_DMA, Priority::max()).unwrap();
|
||||||
|
#[cfg(any(esp32, esp32s2))]
|
||||||
|
crate::interrupt::enable(Interrupt::SPI3_DMA, Priority::max()).unwrap();
|
||||||
|
#[cfg(esp32s2)]
|
||||||
|
crate::interrupt::enable(Interrupt::SPI4_DMA, Priority::max()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(i2s0)]
|
||||||
|
crate::interrupt::enable(Interrupt::I2S0, Priority::min()).unwrap();
|
||||||
|
#[cfg(i2s1)]
|
||||||
|
crate::interrupt::enable(Interrupt::I2S1, Priority::min()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(rmt)]
|
||||||
|
crate::interrupt::enable(Interrupt::RMT, Priority::min()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(usb_device)]
|
||||||
|
crate::interrupt::enable(Interrupt::USB_DEVICE, Priority::min()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(all(parl_io, not(esp32h2)))]
|
||||||
|
crate::interrupt::enable(Interrupt::PARL_IO, Priority::min()).unwrap();
|
||||||
|
#[cfg(all(parl_io, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::PARL_IO_RX, Priority::min()).unwrap();
|
||||||
|
#[cfg(all(parl_io, esp32h2))]
|
||||||
|
crate::interrupt::enable(Interrupt::PARL_IO_TX, Priority::min()).unwrap();
|
||||||
|
|
||||||
|
#[cfg(uart0)]
|
||||||
|
crate::interrupt::enable(Interrupt::UART0, Priority::min()).unwrap();
|
||||||
|
#[cfg(uart1)]
|
||||||
|
crate::interrupt::enable(Interrupt::UART1, Priority::min()).unwrap();
|
||||||
|
|
||||||
|
crate::interrupt::enable(Interrupt::I2C_EXT0, Priority::min()).unwrap();
|
||||||
|
crate::interrupt::enable(Interrupt::GPIO, Priority::min()).unwrap();
|
||||||
|
|
||||||
EmbassyTimer::init(clocks, td)
|
EmbassyTimer::init(clocks, td)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,8 +48,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -70,13 +70,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio14)
|
.with_din(io.pins.gpio14)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::I2S0,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -94,13 +94,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio14)
|
.with_dout(io.pins.gpio14)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::I2S0,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -67,13 +67,6 @@ async fn main(spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
spawner
|
spawner
|
||||||
.spawn(signal_task(io.pins.gpio15.into_push_pull_output()))
|
.spawn(signal_task(io.pins.gpio15.into_push_pull_output()))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
@ -49,13 +49,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -47,12 +47,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
|
let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timer_group0.timer0);
|
embassy::init(&clocks, timer_group0.timer0);
|
||||||
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::SPI2_DMA,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio19;
|
let sclk = io.pins.gpio19;
|
||||||
let miso = io.pins.gpio25;
|
let miso = io.pins.gpio25;
|
||||||
|
|||||||
@ -33,13 +33,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 0 as input
|
// GPIO 0 as input
|
||||||
let mut input = io.pins.gpio0.into_pull_down_input();
|
let mut input = io.pins.gpio0.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32_hal::interrupt::enable(
|
|
||||||
esp32_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,12 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32c2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
esp32c2_hal::interrupt::enable(
|
|
||||||
esp32c2_hal::peripherals::Interrupt::DMA_CH0,
|
|
||||||
esp32c2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio6;
|
let sclk = io.pins.gpio6;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
|
|||||||
@ -35,13 +35,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 9 as input
|
// GPIO 9 as input
|
||||||
let mut input = io.pins.gpio9.into_pull_down_input();
|
let mut input = io.pins.gpio9.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32c2_hal::interrupt::enable(
|
|
||||||
esp32c2_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32c2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -80,13 +80,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio5)
|
.with_din(io.pins.gpio5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::DMA_CH0,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -104,13 +104,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio3)
|
.with_dout(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::DMA_CH0,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -59,13 +59,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 1,
|
length1: 1,
|
||||||
|
|||||||
@ -55,13 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,12 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::DMA_CH0,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio6;
|
let sclk = io.pins.gpio6;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
|
|||||||
@ -38,12 +38,6 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32c3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::USB_DEVICE,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@ -35,13 +35,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 9 as input
|
// GPIO 9 as input
|
||||||
let mut input = io.pins.gpio9.into_pull_down_input();
|
let mut input = io.pins.gpio9.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32c3_hal::interrupt::enable(
|
|
||||||
esp32c3_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32c3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -80,13 +80,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio5)
|
.with_din(io.pins.gpio5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -104,13 +104,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio3)
|
.with_dout(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -71,13 +71,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_config(rx_pins, NoClkPin, BitPackOrder::Msb, Some(0xfff))
|
.with_config(rx_pins, NoClkPin, BitPackOrder::Msb, Some(0xfff))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
loop {
|
loop {
|
||||||
parl_io_rx.read_dma_async(buffer).await.unwrap();
|
parl_io_rx.read_dma_async(buffer).await.unwrap();
|
||||||
|
|||||||
@ -92,13 +92,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::PARL_IO,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = tx_buffer;
|
let buffer = tx_buffer;
|
||||||
for i in 0..buffer.len() {
|
for i in 0..buffer.len() {
|
||||||
buffer[i] = (i % 255) as u8;
|
buffer[i] = (i % 255) as u8;
|
||||||
|
|||||||
@ -59,13 +59,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 1,
|
length1: 1,
|
||||||
|
|||||||
@ -55,13 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,17 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
embassy::init(&clocks, timer_group0.timer0);
|
embassy::init(&clocks, timer_group0.timer0);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio6;
|
let sclk = io.pins.gpio6;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
|
|||||||
@ -37,12 +37,6 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32c6_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::USB_DEVICE,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@ -35,13 +35,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 9 as input
|
// GPIO 9 as input
|
||||||
let mut input = io.pins.gpio9.into_pull_down_input();
|
let mut input = io.pins.gpio9.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32c6_hal::interrupt::enable(
|
|
||||||
esp32c6_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32c6_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -80,13 +80,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio5)
|
.with_din(io.pins.gpio5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -104,13 +104,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio3)
|
.with_dout(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -71,13 +71,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_config(rx_pins, NoClkPin, BitPackOrder::Msb, Some(0xfff))
|
.with_config(rx_pins, NoClkPin, BitPackOrder::Msb, Some(0xfff))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
loop {
|
loop {
|
||||||
parl_io_rx.read_dma_async(buffer).await.unwrap();
|
parl_io_rx.read_dma_async(buffer).await.unwrap();
|
||||||
|
|||||||
@ -92,13 +92,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::PARL_IO_TX,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = tx_buffer;
|
let buffer = tx_buffer;
|
||||||
for i in 0..buffer.len() {
|
for i in 0..buffer.len() {
|
||||||
buffer[i] = (i % 255) as u8;
|
buffer[i] = (i % 255) as u8;
|
||||||
|
|||||||
@ -59,13 +59,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 1,
|
length1: 1,
|
||||||
|
|||||||
@ -55,13 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,17 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
embassy::init(&clocks, timer_group0.timer0);
|
embassy::init(&clocks, timer_group0.timer0);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio1;
|
let sclk = io.pins.gpio1;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
|
|||||||
@ -37,12 +37,6 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32h2_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::USB_DEVICE,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@ -35,13 +35,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 9 as input
|
// GPIO 9 as input
|
||||||
let mut input = io.pins.gpio9.into_pull_down_input();
|
let mut input = io.pins.gpio9.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32h2_hal::interrupt::enable(
|
|
||||||
esp32h2_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32h2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -78,13 +78,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio5)
|
.with_din(io.pins.gpio5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::I2S0,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -103,13 +103,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio3)
|
.with_dout(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::I2S0,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -73,13 +73,6 @@ async fn main(spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
spawner
|
spawner
|
||||||
.spawn(signal_task(io.pins.gpio15.into_push_pull_output()))
|
.spawn(signal_task(io.pins.gpio15.into_push_pull_output()))
|
||||||
.ok();
|
.ok();
|
||||||
|
|||||||
@ -55,13 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,12 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
embassy::init(&clocks, timer_group0.timer0);
|
embassy::init(&clocks, timer_group0.timer0);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::SPI2_DMA,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio36;
|
let sclk = io.pins.gpio36;
|
||||||
let miso = io.pins.gpio37;
|
let miso = io.pins.gpio37;
|
||||||
|
|||||||
@ -41,13 +41,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 0 as input
|
// GPIO 0 as input
|
||||||
let mut input = io.pins.gpio0.into_pull_down_input();
|
let mut input = io.pins.gpio0.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32s2_hal::interrupt::enable(
|
|
||||||
esp32s2_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32s2_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
@ -56,8 +56,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
&clocks,
|
&clocks,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(Interrupt::I2C_EXT0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
let mut lis3dh = Lis3dh::new_i2c(i2c0, SlaveAddr::Alternate).await.unwrap();
|
||||||
lis3dh.set_range(Range::G8).await.unwrap();
|
lis3dh.set_range(Range::G8).await.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -80,13 +80,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_din(io.pins.gpio5)
|
.with_din(io.pins.gpio5)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let buffer = rx_buffer;
|
let buffer = rx_buffer;
|
||||||
println!("Start");
|
println!("Start");
|
||||||
|
|
||||||
|
|||||||
@ -104,13 +104,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
.with_dout(io.pins.gpio3)
|
.with_dout(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// you need to manually enable the DMA channel's interrupt!
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let data =
|
let data =
|
||||||
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
unsafe { core::slice::from_raw_parts(&SINE as *const _ as *const u8, SINE.len() * 2) };
|
||||||
|
|
||||||
|
|||||||
@ -59,13 +59,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 1,
|
length1: 1,
|
||||||
|
|||||||
@ -55,13 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// you have to enable the interrupt for async to work
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::RMT,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut data = [PulseCode {
|
let mut data = [PulseCode {
|
||||||
level1: true,
|
level1: true,
|
||||||
length1: 200,
|
length1: 200,
|
||||||
|
|||||||
@ -90,8 +90,6 @@ async fn main(spawner: Spawner) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let (tx, rx) = uart0.split();
|
let (tx, rx) = uart0.split();
|
||||||
|
|
||||||
interrupt::enable(Interrupt::UART0, interrupt::Priority::Priority1).unwrap();
|
|
||||||
|
|
||||||
let signal = &*make_static!(Signal::new());
|
let signal = &*make_static!(Signal::new());
|
||||||
|
|
||||||
spawner.spawn(reader(rx, &signal)).ok();
|
spawner.spawn(reader(rx, &signal)).ok();
|
||||||
|
|||||||
@ -55,17 +55,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
embassy::init(&clocks, timer_group0.timer0);
|
embassy::init(&clocks, timer_group0.timer0);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::DMA_IN_CH0,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::DMA_OUT_CH0,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio6;
|
let sclk = io.pins.gpio6;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
|
|||||||
@ -37,12 +37,6 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
esp32s3_hal::timer::TimerGroup::new(peripherals.TIMG0, &clocks).timer0,
|
||||||
);
|
);
|
||||||
|
|
||||||
interrupt::enable(
|
|
||||||
peripherals::Interrupt::USB_DEVICE,
|
|
||||||
interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@ -41,13 +41,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
// GPIO 0 as input
|
// GPIO 0 as input
|
||||||
let mut input = io.pins.gpio0.into_pull_down_input();
|
let mut input = io.pins.gpio0.into_pull_down_input();
|
||||||
|
|
||||||
// Async requires the GPIO interrupt to wake futures
|
|
||||||
esp32s3_hal::interrupt::enable(
|
|
||||||
esp32s3_hal::peripherals::Interrupt::GPIO,
|
|
||||||
esp32s3_hal::interrupt::Priority::Priority1,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
esp_println::println!("Waiting...");
|
esp_println::println!("Waiting...");
|
||||||
input.wait_for_rising_edge().await.unwrap();
|
input.wait_for_rising_edge().await.unwrap();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user