bouncing ball "招财猫"-like totem now working

This commit is contained in:
bunnie 2020-11-23 03:18:43 +08:00
parent 16e9f43015
commit 2d5bd20c16
5 changed files with 28 additions and 15 deletions

View file

@ -7,7 +7,7 @@ UPDATE_KERNEL=1
USE_USB=1
FPGA_IMAGE=../betrusted-soc/build/gateware/encrypted.bin
KERNEL_IMAGE=target/riscv32imac-unknown-none-elf/release/xous.img
CSR_CSV=../betrusted-soc/build/csr.csv.1 # always use the previous version for the current update!
CSR_CSV=../betrusted-soc/build/csr.csv.1
USE_IDENITY=0
POSITIONAL=()
@ -35,8 +35,12 @@ do
shift
shift
;;
--current-csr)
CSR_CSV=../betrusted-soc/build/csr.csv
shift
;;
-h|--help)
echo "$0 provisions betrusted. --kernel-skip skips the kernel, --fpga-skip skips the FPGA."
echo "$0 provisions betrusted. --kernel-skip skips the kernel, --fpga-skip skips the FPGA. --current-csr indicates to use the CSR for the new FPGA image to do the update (normally you want to use the one corresponding to the older, currently installed version)."
echo "Alternatively, using --copy-to <hostname> copies the files to a remote host and skips provisioning."
echo " --identity <id_file> supplies an identity file to the scp command."
echo " Copying assumes betrusted-scripts repo is cloned on ssh-target at ~/code/betrused-scripts/"

View file

@ -21,7 +21,8 @@ riscv = "0.5.6"
debug-print = []
print-panics = []
report-memory = ["stats_alloc"]
default = ["print-panics", "debug-print"]
#default = ["print-panics", "debug-print"]
default = []
[target.'cfg(any(windows, unix))'.dependencies]
lazy_static = "1.4"

View file

@ -14,7 +14,8 @@ rand = "0.7.3"
[features]
debug-print = []
earlyprintk = []
default = ["debug-print"]
#default = ["debug-print"]
default = []
[profile.release]
codegen-units = 1 # 1 better optimizations

View file

@ -411,7 +411,7 @@ pub fn circle(fb: &mut LcdFB, x: usize, y: usize, r: usize, stroke_width: usize,
center: Point{x: x as i16, y: y as i16},
radius: r as u16,
style: Style{ fill_color: Some(color), stroke_color: Some(color), stroke_width: stroke_width as i16},
p: Point::zero(),
p: Point::new(-(r as i16), -(r as i16)),
};
for pixel in c {

View file

@ -162,6 +162,7 @@ fn shell_main() -> ! {
let mut bouncyball = Bounce::new(14,
Rectangle::new(Point::new(0, 18 * 21),
Point::new(336, 536-1))); // TODO: make API call to get screen size
bouncyball.update();
#[cfg(baremetal)]
{
@ -219,6 +220,22 @@ fn shell_main() -> ! {
error!("error requesting ticktimer!")
}
string_buffer.clear();
write!(&mut string_buffer, "Elapsed time: {}ms", last_time).expect("Can't write");
graphics_server::clear_region(graphics_conn, 0, 0, 300, 40)
.expect("unable to clear region");
info!("drawing string: {}", string_buffer);
graphics_server::draw_string(graphics_conn, &string_buffer).expect("unable to draw string");
//ticktimer_server::sleep_ms(ticktimer_conn, 2000 + loops).expect("couldn't sleep");
loops += 1;
// draw the ball
bouncyball.update();
graphics_server::clear_region(graphics_conn,
bouncyball.bounds.top_left().x as _, bouncyball.bounds.top_left().y as _,
bouncyball.bounds.bottom_right().x as _, bouncyball.bounds.bottom_right().y as _)
.expect("unable to clear region");
graphics_server::draw_circle(
graphics_conn,
bouncyball.loc,
@ -226,16 +243,6 @@ fn shell_main() -> ! {
)
.expect("unable to draw to screen");
string_buffer.clear();
write!(&mut string_buffer, "Elapsed time: {}ms", last_time).expect("Can't write");
graphics_server::clear_region(graphics_conn, 0, 0, 300, 40)
.expect("unable to clear region");
info!("drawing string: {}", string_buffer);
graphics_server::draw_string(graphics_conn, &string_buffer).expect("unable to draw string");
graphics_server::flush(graphics_conn).expect("unable to draw to screen");
ticktimer_server::sleep_ms(ticktimer_conn, 2000 + loops).expect("couldn't sleep");
loops += 1;
bouncyball.update();
}
}