mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
shell: use new graphics subsystem
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
7fc8dafc39
commit
c33794c859
1 changed files with 20 additions and 53 deletions
|
|
@ -150,6 +150,7 @@ fn shell_main() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut last_time: u64 = 0;
|
let mut last_time: u64 = 0;
|
||||||
|
let mut string_buffer = StringBuffer::new(4096);
|
||||||
loop {
|
loop {
|
||||||
// a message passing demo -- checking time
|
// a message passing demo -- checking time
|
||||||
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
||||||
|
|
@ -186,67 +187,33 @@ fn shell_main() -> ! {
|
||||||
println!("error requesting ticktimer!")
|
println!("error requesting ticktimer!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// println!("Sending a scalar message with id {}...", counter + 4096);
|
graphics_server::set_style(
|
||||||
// match xous::syscall::send_message(
|
graphics_conn,
|
||||||
// log_conn,
|
5,
|
||||||
// xous::Message::Scalar(xous::ScalarMessage {
|
if lfsr & 1 == 0 { dark } else { light },
|
||||||
// id: counter + 4096,
|
if lfsr & 1 == 0 { dark } else { light },
|
||||||
// arg1: counter,
|
)
|
||||||
// arg2: counter * 2,
|
.expect("unable to draw to screen: {:?}");
|
||||||
// arg3: !counter,
|
|
||||||
// arg4: counter + 1,
|
|
||||||
// }),
|
|
||||||
// ) {
|
|
||||||
// Err(xous::Error::ServerQueueFull) => {
|
|
||||||
// // println!("Server queue is full... retrying");
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// Ok(_) => {
|
|
||||||
// println!("Loop {}", counter);
|
|
||||||
// counter += 1;
|
|
||||||
// }
|
|
||||||
// Err(e) => panic!("Unable to send message: {:?}", e),
|
|
||||||
// }
|
|
||||||
|
|
||||||
// lfsr = move_lfsr(lfsr);
|
|
||||||
|
|
||||||
loop {
|
|
||||||
match graphics_server::set_style(
|
|
||||||
graphics_conn,
|
|
||||||
5,
|
|
||||||
if lfsr & 1 == 0 { dark } else { light },
|
|
||||||
if lfsr & 1 == 0 { dark } else { light },
|
|
||||||
) {
|
|
||||||
Err(xous::Error::ServerQueueFull) => continue,
|
|
||||||
Ok(_) => break,
|
|
||||||
Err(e) => panic!("unable to draw to screen: {:?}", e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let x1 = move_lfsr(lfsr);
|
let x1 = move_lfsr(lfsr);
|
||||||
let y1 = move_lfsr(x1);
|
let y1 = move_lfsr(x1);
|
||||||
let x2 = move_lfsr(y1);
|
let x2 = move_lfsr(y1);
|
||||||
let y2 = move_lfsr(x2);
|
let y2 = move_lfsr(x2);
|
||||||
lfsr = y2;
|
lfsr = y2;
|
||||||
|
|
||||||
loop {
|
graphics_server::draw_line(
|
||||||
match graphics_server::draw_line(
|
graphics_conn,
|
||||||
graphics_conn,
|
graphics_server::Point::new((x1 % 336) as _, (y1 % 536) as _),
|
||||||
graphics_server::Point::new((x1 % 336) as _, (y1 % 536) as _),
|
graphics_server::Point::new((x2 % 336) as _, (y2 % 536) as _),
|
||||||
graphics_server::Point::new((x2 % 336) as _, (y2 % 536) as _),
|
)
|
||||||
) {
|
.expect("unable to draw to screen");
|
||||||
Err(xous::Error::ServerQueueFull) => continue,
|
|
||||||
Ok(_) => break,
|
|
||||||
Err(e) => panic!("unable to draw to screen: {:?}", e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loop {
|
string_buffer.clear();
|
||||||
match graphics_server::flush(graphics_conn) {
|
write!(&mut string_buffer, "Elapsed time: {}ms", last_time).expect("Can't write");
|
||||||
Err(xous::Error::ServerQueueFull) => continue,
|
graphics_server::clear_region(graphics_conn, 0, 0, 300, 40).expect("unable to clear region");
|
||||||
Ok(_) => break,
|
string_buffer.lend(graphics_conn, 1).expect("unable to draw string");
|
||||||
Err(e) => panic!("unable to draw to screen: {:?}", e),
|
|
||||||
}
|
graphics_server::flush(graphics_conn).expect("unable to draw to screen");
|
||||||
}
|
|
||||||
|
|
||||||
// let lfsr = move_lfsr(lfsr);
|
// let lfsr = move_lfsr(lfsr);
|
||||||
// if lfsr.trailing_zeros() >= 3 {
|
// if lfsr.trailing_zeros() >= 3 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue