added example app to rp pico
This commit is contained in:
@@ -41,7 +41,9 @@ impl App for Example {
|
|||||||
ExampleCmd::Noop => info!("NOOP command received"),
|
ExampleCmd::Noop => info!("NOOP command received"),
|
||||||
ExampleCmd::Reset => {
|
ExampleCmd::Reset => {
|
||||||
info!("RESET command received");
|
info!("RESET command received");
|
||||||
|
let perf = self.data.hk.perf;
|
||||||
self.data = Default::default();
|
self.data = Default::default();
|
||||||
|
self.data.hk.perf = perf;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ embassy-usb-logger = { git = "https://github.com/embassy-rs/embassy.git" }
|
|||||||
rfe = { path = "../../rfe", default-features = false, features = ["rp2040"] }
|
rfe = { path = "../../rfe", default-features = false, features = ["rp2040"] }
|
||||||
to = { path = "../../apps/to", default-features = false }
|
to = { path = "../../apps/to", default-features = false }
|
||||||
hs = { path = "../../apps/hs", default-features = false, features = ["rp2040"] }
|
hs = { path = "../../apps/hs", default-features = false, features = ["rp2040"] }
|
||||||
|
example = { path = "../../apps/example" }
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
anyhow.default_features = false
|
anyhow.default_features = false
|
||||||
embedded-alloc = "0.6.0"
|
embedded-alloc = "0.6.0"
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ mod app {
|
|||||||
usb::{self, Driver},
|
usb::{self, Driver},
|
||||||
};
|
};
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::OutputPin;
|
||||||
|
use example::Example;
|
||||||
use fugit::Duration;
|
use fugit::Duration;
|
||||||
use hs::{Hs, HsConfig, Rp2040Watchdog, StubSystemInfoGrabber};
|
use hs::{Hs, HsConfig, Rp2040Watchdog, StubSystemInfoGrabber};
|
||||||
use log::info;
|
use log::info;
|
||||||
use msg::{ExampleHk, Instance, MsgKind, MsgPacket, TargetMsg, TlmSetItem, ToTlmSet};
|
use msg::{Instance, MsgKind, MsgPacket, TargetMsg, TlmSetItem, ToTlmSet};
|
||||||
use rfe::{connector::Connector, Rate, *};
|
use rfe::{connector::Connector, Rate, *};
|
||||||
use rp_pico::hal::{
|
use rp_pico::hal::{
|
||||||
clocks,
|
clocks,
|
||||||
@@ -69,19 +70,13 @@ mod app {
|
|||||||
self.counter += 1;
|
self.counter += 1;
|
||||||
self.on = !self.on;
|
self.on = !self.on;
|
||||||
if self.on {
|
if self.on {
|
||||||
info!("led on!");
|
|
||||||
self.led_pin.set_high().ok();
|
self.led_pin.set_high().ok();
|
||||||
} else {
|
} else {
|
||||||
info!("led off!");
|
|
||||||
self.led_pin.set_low().ok();
|
self.led_pin.set_low().ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hk(&mut self, rfe: &mut Rfe) {
|
fn hk(&mut self, _rfe: &mut Rfe) {}
|
||||||
rfe.send(msg::Msg::ExampleHk(ExampleHk {
|
|
||||||
counter: self.counter,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn out_data(&mut self, _rfe: &mut Rfe) {}
|
fn out_data(&mut self, _rfe: &mut Rfe) {}
|
||||||
|
|
||||||
@@ -198,7 +193,9 @@ mod app {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
let mut to = To::new(&mut log_connector, tlmsets);
|
let mut to = To::new(&mut log_connector, tlmsets);
|
||||||
|
let mut example = Example::new();
|
||||||
let mut wd = Rp2040Watchdog::new(ctx.local.wd.take().unwrap());
|
let mut wd = Rp2040Watchdog::new(ctx.local.wd.take().unwrap());
|
||||||
|
|
||||||
let mut grabber = StubSystemInfoGrabber::new();
|
let mut grabber = StubSystemInfoGrabber::new();
|
||||||
let mut hs = Hs::new(
|
let mut hs = Hs::new(
|
||||||
HsConfig {
|
HsConfig {
|
||||||
@@ -218,6 +215,7 @@ mod app {
|
|||||||
instance.add_app("blink_app", &mut blink_app).unwrap();
|
instance.add_app("blink_app", &mut blink_app).unwrap();
|
||||||
instance.add_app("to", &mut to).unwrap();
|
instance.add_app("to", &mut to).unwrap();
|
||||||
instance.add_app("hs", &mut hs).unwrap();
|
instance.add_app("hs", &mut hs).unwrap();
|
||||||
|
instance.add_app("example", &mut example).unwrap();
|
||||||
|
|
||||||
let mut next_time = Mono::now() + Duration::<u64, 1, 1000000>::from_ticks(10000);
|
let mut next_time = Mono::now() + Duration::<u64, 1, 1000000>::from_ticks(10000);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user