can load & reload programs
This commit is contained in:
@@ -21,7 +21,7 @@ mod utils;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use crate::{
|
||||
display::{clear_fb, display_handler, init_display},
|
||||
display::{FRAMEBUFFER, clear_fb, display_handler, init_display},
|
||||
peripherals::{
|
||||
conf_peripherals,
|
||||
keyboard::{KeyState, read_keyboard_fifo},
|
||||
@@ -31,7 +31,8 @@ use crate::{
|
||||
ui::{SELECTIONS, clear_selection, ui_handler},
|
||||
usb::usb_handler,
|
||||
};
|
||||
use abi_sys::EntryFn;
|
||||
use abi_sys::{EntryFn, Rgb565, RgbColor};
|
||||
use embedded_graphics::prelude::DrawTarget;
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@@ -149,10 +150,15 @@ async fn userland_task() {
|
||||
defmt::info!("Executing Binary");
|
||||
entry();
|
||||
|
||||
defmt::info!("Putting kernel back in UI mode");
|
||||
// enable kernel ui
|
||||
{
|
||||
ENABLE_UI.store(true, Ordering::Release);
|
||||
UI_CHANGE.signal(());
|
||||
unsafe { FRAMEBUFFER.clear(Rgb565::BLACK).unwrap() };
|
||||
|
||||
let mut selections = SELECTIONS.lock().await;
|
||||
selections.set_changed(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,11 +245,11 @@ async fn kernel_task(
|
||||
|
||||
loop {
|
||||
let ui_enabled = ENABLE_UI.load(Ordering::Relaxed);
|
||||
defmt::info!("ui enabled? {:?}", ui_enabled);
|
||||
if ui_enabled {
|
||||
let ui_fut = ui_handler();
|
||||
let binary_search_fut = prog_search_handler();
|
||||
defmt::info!("starting ui");
|
||||
|
||||
select(join(ui_fut, binary_search_fut), UI_CHANGE.wait()).await;
|
||||
select(join(ui_handler(), prog_search_handler()), UI_CHANGE.wait()).await;
|
||||
} else {
|
||||
select(key_handler(), UI_CHANGE.wait()).await;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::{
|
||||
};
|
||||
use alloc::{str::FromStr, string::String, vec::Vec};
|
||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex};
|
||||
use embassy_time::Timer;
|
||||
use embedded_graphics::{
|
||||
Drawable,
|
||||
mono_font::{MonoTextStyle, ascii::FONT_9X15},
|
||||
@@ -55,6 +56,8 @@ pub async fn ui_handler() {
|
||||
clear_selection().await;
|
||||
draw_selection().await;
|
||||
}
|
||||
|
||||
Timer::after_millis(50).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +149,10 @@ impl SelectionList {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_changed(&mut self, changed: bool) {
|
||||
self.changed = changed
|
||||
}
|
||||
|
||||
pub fn update_selections(&mut self, selections: Vec<FileName>) {
|
||||
self.selections = selections;
|
||||
self.changed = true;
|
||||
|
||||
Reference in New Issue
Block a user