blob: 9241e74418aca2a6f2045f0232cc9b675b285e62 [file] [log] [blame]
#![no_std]
use libtock::result::TockResult;
use libtock::timer::Duration;
// Example works on P0.03
#[libtock::main]
async fn main() -> TockResult<()> {
let mut drivers = libtock::retrieve_drivers()?;
let mut gpio_driver = drivers.gpio.init_driver()?;
let mut timer_driver = drivers.timer.create_timer_driver();
let timer_driver = timer_driver.activate()?;
let mut gpio = gpio_driver.gpios().next().unwrap();
let gpio_out = gpio.enable_output()?;
loop {
gpio_out.set_high()?;
timer_driver.sleep(Duration::from_ms(500)).await?;
gpio_out.set_low()?;
timer_driver.sleep(Duration::from_ms(500)).await?;
}
}