* Remove the chip-specific HAL packages * Update some doc comments which were missed, fix build script for ESP32/S2 * Refactor/update `esp-hal-procmacros` * Create the `examples` package, add back all of the previously existing examples * Use `xtask` automation package for checking examples and documentation in CI * Combine the `rt-riscv` and `rt-xtensa` features into a single `rt` feature * Bump MSRV to 1.76.0 (shocking!) * Re-document the features for the HAL * No need to re-export the `riscv` package like this * Make clippy happy, improve CI clippy checks * Update `CHANGELOG.md` * riscv: zero bss Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com> * Address a number of review comments * Correct pin number in `hello_rgb` example for ESP32-C3 * Address the remaining review comments * More small tweaks/improvements * Fix RMT examples (#11) * Fix RMT examples * Remove logger-init * Make I2S examples work on ESP32 (#12) * Make I2S examples work on ESP32 * Remove logger init * Fix the direct-vectoring examples on all RISCV chips (#10) * Update GPIOs for some examples... * Embassy timer example fixes (#13) * Switch to generic queue instead of integrated for all examples * changelog * Update GPIO in another example, make `rustfmt` happy * Fix ESP32-S2 PSRAM * Avoid UART0 and SPI flash pins (#15) * Avoid UART0 and SPI flash pins * Fix spi_eh1_device_loopback for non-ESP32 * Update examples/src/bin/gpio_interrupt.rs Co-authored-by: Juraj Sadel <jurajsadel@gmail.com> --------- Co-authored-by: Juraj Sadel <jurajsadel@gmail.com> --------- Co-authored-by: Scott Mabin <scott@mabez.dev> Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com> Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de> Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
41 lines
1.0 KiB
Rust
41 lines
1.0 KiB
Rust
//! Control LED on GPIO1 by the BOOT-BUTTON via ETM
|
|
|
|
//% CHIPS: esp32c6 esp32h2
|
|
|
|
#![no_std]
|
|
#![no_main]
|
|
|
|
use esp_backtrace as _;
|
|
use esp_hal::{
|
|
etm::Etm,
|
|
gpio::{etm::GpioEtmChannels, IO},
|
|
peripherals::Peripherals,
|
|
prelude::*,
|
|
};
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let peripherals = Peripherals::take();
|
|
|
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
|
let mut led = io.pins.gpio1.into_push_pull_output();
|
|
let button = io.pins.gpio9.into_pull_down_input();
|
|
|
|
led.set_high().unwrap();
|
|
|
|
// setup ETM
|
|
let gpio_ext = GpioEtmChannels::new(peripherals.GPIO_SD);
|
|
let led_task = gpio_ext.channel0_task.toggle(&mut led);
|
|
let button_event = gpio_ext.channel0_event.falling_edge(button);
|
|
|
|
let etm = Etm::new(peripherals.SOC_ETM);
|
|
let channel0 = etm.channel0;
|
|
|
|
// make sure the configured channel doesn't get dropped - dropping it will
|
|
// disable the channel
|
|
let _configured_channel = channel0.setup(&button_event, &led_task);
|
|
|
|
// the LED is controlled by the button without involving the CPU
|
|
loop {}
|
|
}
|