-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
133 additions
and
8 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
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,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"] |
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,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(); | ||
} | ||
} |
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,24 @@ | ||
[package] | ||
name = "rtic" | ||
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" } | ||
rtic-sync = { version = "1.3", features = ["defmt-03"] } | ||
panic-rtt-target = { version = "0.1.3" } | ||
|
||
[dependencies.va416xx-hal] | ||
path = "../../va416xx-hal" | ||
features = ["va41630"] | ||
|
||
[dependencies.rtic] | ||
version = "2" | ||
features = ["thumbv7-backend"] | ||
|
||
[dependencies.rtic-monotonics] | ||
version = "2" | ||
features = ["cortex-m-systick"] |
File renamed without changes.
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,57 @@ | ||
//! RTIC minimal blinky | ||
#![no_main] | ||
#![no_std] | ||
|
||
#[rtic::app(device = pac, dispatchers = [U1, U2, U3])] | ||
mod app { | ||
use cortex_m::asm; | ||
use embedded_hal::digital::StatefulOutputPin; | ||
use panic_rtt_target as _; | ||
use rtic_monotonics::systick::prelude::*; | ||
use rtic_monotonics::Monotonic; | ||
use rtt_target::{rprintln, rtt_init_default}; | ||
use va416xx_hal::{ | ||
gpio::{OutputReadablePushPull, Pin, PinsG, PG5}, | ||
pac, | ||
}; | ||
|
||
#[local] | ||
struct Local { | ||
led: Pin<PG5, OutputReadablePushPull>, | ||
} | ||
|
||
#[shared] | ||
struct Shared {} | ||
|
||
rtic_monotonics::systick_monotonic!(Mono, 10_000); | ||
|
||
#[init] | ||
fn init(_ctx: init::Context) -> (Shared, Local) { | ||
rtt_init_default!(); | ||
rprintln!("-- Vorago RTIC template --"); | ||
let mut dp = pac::Peripherals::take().unwrap(); | ||
let portg = PinsG::new(&mut dp.sysconfig, dp.portg); | ||
let led = portg.pg5.into_readable_push_pull_output(); | ||
blinky::spawn().ok(); | ||
(Shared {}, Local { led }) | ||
} | ||
|
||
// `shared` cannot be accessed from this context | ||
#[idle] | ||
fn idle(_cx: idle::Context) -> ! { | ||
loop { | ||
asm::nop(); | ||
} | ||
} | ||
|
||
#[task( | ||
priority = 3, | ||
local=[led], | ||
)] | ||
async fn blinky(cx: blinky::Context) { | ||
loop { | ||
cx.local.led.toggle().ok(); | ||
Mono::delay(200.millis()).await; | ||
} | ||
} | ||
} |
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