Skip to content
Snippets Groups Projects
Commit 7f46e4cb authored by Per Lindgren's avatar Per Lindgren
Browse files

blinky_msg123

parent 44f3a558
Branches
No related tags found
No related merge requests found
......@@ -55,7 +55,15 @@ name = "serial"
required-features = ["stm32f4xx-hal"]
[[example]]
name = "rtfm_blinky"
name = "rtfm_blinky_msg1"
required-features = ["rtfm"]
[[example]]
name = "rtfm_blinky_msg2"
required-features = ["rtfm"]
[[example]]
name = "rtfm_blinky_msg3"
required-features = ["rtfm"]
[profile.dev]
......
#![deny(unsafe_code)]
// #![deny(warnings)]
#![deny(warnings)]
#![no_main]
#![no_std]
......@@ -16,9 +16,9 @@ const APP: () = {
GPIOA: stm32::GPIOA,
}
#[init(schedule = [toggle])]
fn init(mut cx: init::Context) -> init::LateResources {
fn init(cx: init::Context) -> init::LateResources {
let mut core = cx.core;
let mut device = cx.device;
let device = cx.device;
// Initialize (enable) the monotonic timer (CYCCNT)
core.DCB.enable_trace();
......
#![deny(unsafe_code)]
// #![deny(warnings)]
#![deny(warnings)]
#![no_main]
#![no_std]
......@@ -16,9 +16,9 @@ const APP: () = {
GPIOA: stm32::GPIOA,
}
#[init(schedule = [toggle])]
fn init(mut cx: init::Context) -> init::LateResources {
fn init(cx: init::Context) -> init::LateResources {
let mut core = cx.core;
let mut device = cx.device;
let device = cx.device;
// Initialize (enable) the monotonic timer (CYCCNT)
core.DCB.enable_trace();
......
#![deny(unsafe_code)]
// #![deny(warnings)]
#![deny(warnings)]
#![no_main]
#![no_std]
......@@ -12,9 +12,9 @@ use stm32f4xx_hal::stm32;
#[rtfm::app(device = stm32f4xx_hal::stm32, monotonic = rtfm::cyccnt::CYCCNT, peripherals = true)]
const APP: () = {
#[init(schedule = [toggle])]
fn init(mut cx: init::Context) {
fn init(cx: init::Context) {
let mut core = cx.core;
let mut device = cx.device;
let device = cx.device;
// Initialize (enable) the monotonic timer (CYCCNT)
core.DCB.enable_trace();
......@@ -32,10 +32,11 @@ const APP: () = {
device.GPIOA.moder.modify(|_, w| w.moder5().bits(1));
cx.schedule
.toggle(now + 8_000_000.cycles(), true, device.GPIOA);
.toggle(now + 8_000_000.cycles(), true, device.GPIOA)
.ok();
}
#[task(schedule = [toggle])]
#[task(schedule= [toggle])]
fn toggle(cx: toggle::Context, toggle: bool, gpioa: stm32::GPIOA) {
hprintln!("toggle @ {:?}", Instant::now()).unwrap();
......@@ -46,7 +47,8 @@ const APP: () = {
}
cx.schedule
.toggle(cx.scheduled + 8_000_000.cycles(), !toggle, gpioa);
.toggle(cx.scheduled + 8_000_000.cycles(), !toggle, gpioa)
.ok();
}
extern "C" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment