-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use esp_idf_hal::sys::EspError; | ||
|
||
fn main() -> Result<(), EspError> { | ||
// It is necessary to call this function once. Otherwise some patches to the runtime | ||
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71 | ||
esp_idf_hal::sys::link_patches(); | ||
|
||
let per = esp_idf_hal::peripherals::Peripherals::take().unwrap(); | ||
|
||
let timer_conf = esp_idf_hal::timer::config::Config::new().auto_reload(true); | ||
let mut timer = esp_idf_hal::timer::TimerDriver::new(per.timer00, &timer_conf)?; | ||
|
||
esp_idf_hal::task::block_on(async move { | ||
loop { | ||
timer.delay(timer.tick_hz()).await?; // Every second | ||
println!("Tick"); | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters