Skip to content

Commit

Permalink
flush lcd per 10ms
Browse files Browse the repository at this point in the history
  • Loading branch information
buhe committed Nov 15, 2021
1 parent 97bd3ef commit 2ef287c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion os/src/driver/lcd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ lazy_static! {
pub fn print_with_lcd(args: fmt::Arguments) {
CONSOLE.lock().write_fmt(args).unwrap();
unsafe {
CONSOLE.lock().render(&mut IMAGE);
CONSOLE.lock().render(&mut IMAGE);
}
}

pub fn flush() {
unsafe {
if CONSOLE.lock().dirty {
DRIVER.lock().flush(&IMAGE);
CONSOLE.lock().dirty = false;
Expand Down
1 change: 1 addition & 0 deletions os/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pub fn init() {
// network::init();
}
pub use lcd::print_with_lcd;
pub use lcd::flush;
6 changes: 6 additions & 0 deletions os/src/timer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::config::CLOCK_FREQ;
use crate::driver::flush;
use crate::scall_sbi::set_timer;
use riscv::register::time;

Expand All @@ -15,4 +16,9 @@ pub fn get_time_ms() -> usize {

pub fn set_next_trigger() {
set_timer(get_time() + CLOCK_FREQ / TICKS_PER_SEC);
flush_at_10ms();
}

pub fn flush_at_10ms() {
flush();
}

0 comments on commit 2ef287c

Please sign in to comment.