start adding embassy example
Some checks failed
Rust/va416xx-rs/pipeline/head There was a failure building this commit
Rust/va416xx-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
2024-09-11 20:44:10 +02:00
parent cad968342a
commit b9d5243fef
9 changed files with 133 additions and 8 deletions

View File

@ -0,0 +1,22 @@
[package]
name = "embassy"
version = "0.1.0"
edition = "2021"
[dependencies]
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7"
embedded-hal = "1"
rtt-target = { version = "0.5" }
panic-rtt-target = { version = "0.1" }
embassy-sync = { version = "0.6.0" }
embassy-time = { version = "0.3.2", features = ["tick-hz-32_768"] }
[dependencies.embassy-executor]
version = "0.6.0"
features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "integrated-timers"]
[dependencies.va416xx-hal]
path = "../../va416xx-hal"
features = ["va41630"]

View File

@ -0,0 +1,23 @@
#![no_std]
#![no_main]
use embassy_executor::Spawner;
use embassy_time::Timer;
use embedded_hal::digital::StatefulOutputPin;
use panic_rtt_target as _;
use rtt_target::{rprintln, rtt_init_print};
use va416xx_hal::{gpio::PinsG, pac};
// main is itself an async function.
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
rtt_init_print!();
rprintln!("VA416xx RTT Demo");
let mut dp = pac::Peripherals::take().unwrap();
let portg = PinsG::new(&mut dp.sysconfig, dp.portg);
let mut led = portg.pg5.into_readable_push_pull_output();
loop {
Timer::after_millis(200).await;
led.toggle().ok();
}
}