write can now open a monitor right after flashing

This commit is contained in:
2025-09-19 16:13:51 +02:00
parent b6b79e7fcf
commit 1b9f1ea4c1
3 changed files with 30 additions and 7 deletions

View File

@@ -21,8 +21,9 @@ impl Monitor {
Self { hooks }
}
pub fn add_hook(&mut self, key: Key, desc: &'static str) {
pub fn add_hook(&mut self, key: Key, desc: &'static str) -> &mut Self {
self.hooks.push((key, desc));
self
}
pub fn run(&mut self, port: &mut SerialPort) -> Result<Key, Error> {
@@ -32,6 +33,7 @@ impl Monitor {
port.set_dtr(false)?;
port.set_rts(false)?;
println!();
println!("Monitor controls:");
for (key, desc) in &self.hooks {