32 lines
909 B
Rust
32 lines
909 B
Rust
use esp_idf_sys as _;
|
|
use std::thread;
|
|
use ups_esp32c3_rust::beep;
|
|
use ups_esp32c3_rust::blink;
|
|
|
|
fn main() {
|
|
// Temporary. Will disappear once ESP-IDF 4.4 is released, but for now it is necessary to call this function once,
|
|
// or else some patches to the runtime implemented by esp-idf-sys might not link properly.
|
|
esp_idf_sys::link_patches();
|
|
|
|
let peripherals = esp_idf_hal::peripherals::Peripherals::take().unwrap();
|
|
|
|
thread::spawn(move || {
|
|
let mut blink = blink::Blink::new(
|
|
peripherals
|
|
.pins
|
|
.gpio5
|
|
.into_output()
|
|
.expect("Failed to set GPIO5 as output"),
|
|
);
|
|
blink.play();
|
|
});
|
|
|
|
beep::Beep::new(peripherals
|
|
.pins
|
|
.gpio5
|
|
.into_output()
|
|
.expect("Failed to set GPIO6 as output"),);
|
|
|
|
println!("Hello, world!");
|
|
}
|