added example app to rp pico

This commit is contained in:
Jacob Weaver
2024-12-17 11:12:30 -06:00
parent a243b860d2
commit 5401d624bd
3 changed files with 9 additions and 8 deletions
+2
View File
@@ -41,7 +41,9 @@ impl App for Example {
ExampleCmd::Noop => info!("NOOP command received"),
ExampleCmd::Reset => {
info!("RESET command received");
let perf = self.data.hk.perf;
self.data = Default::default();
self.data.hk.perf = perf;
}
},
_ => {
+1
View File
@@ -8,6 +8,7 @@ embassy-usb-logger = { git = "https://github.com/embassy-rs/embassy.git" }
rfe = { path = "../../rfe", default-features = false, features = ["rp2040"] }
to = { path = "../../apps/to", default-features = false }
hs = { path = "../../apps/hs", default-features = false, features = ["rp2040"] }
example = { path = "../../apps/example" }
anyhow.workspace = true
anyhow.default_features = false
embedded-alloc = "0.6.0"
+6 -8
View File
@@ -15,10 +15,11 @@ mod app {
usb::{self, Driver},
};
use embedded_hal::digital::v2::OutputPin;
use example::Example;
use fugit::Duration;
use hs::{Hs, HsConfig, Rp2040Watchdog, StubSystemInfoGrabber};
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 rp_pico::hal::{
clocks,
@@ -69,19 +70,13 @@ mod app {
self.counter += 1;
self.on = !self.on;
if self.on {
info!("led on!");
self.led_pin.set_high().ok();
} else {
info!("led off!");
self.led_pin.set_low().ok();
}
}
fn hk(&mut self, rfe: &mut Rfe) {
rfe.send(msg::Msg::ExampleHk(ExampleHk {
counter: self.counter,
}));
}
fn hk(&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 example = Example::new();
let mut wd = Rp2040Watchdog::new(ctx.local.wd.take().unwrap());
let mut grabber = StubSystemInfoGrabber::new();
let mut hs = Hs::new(
HsConfig {
@@ -218,6 +215,7 @@ mod app {
instance.add_app("blink_app", &mut blink_app).unwrap();
instance.add_app("to", &mut to).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);