jamesmcm / esp-idf-isr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esp-idf-isr

A minimal implementation of a trait allowing to subscribe to interrupts on GPIO Pin of the ESP32.

Example usage

let (mut eventloop, _subscription) = init_eventloop().unwrap();

let peripherals = Peripherals::take().unwrap();
let mut interrupt_pin = peripherals.pins.gpio0
    .into_input().unwrap()
    .into_pull_up().unwrap();
interrupt_pin.configure_interrupt(InterruptType::NegEdge).unwrap();
let _subscription = unsafe {
    interrupt_pin.subscribe(move || {
        eventloop.post(&event::EventLoopMessage::new(1), None).unwrap();
    })?
};

About

License:MIT License


Languages

Language:Rust 100.0%