|
|
@ -48,6 +48,33 @@ impl Screen {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
|
|
|
|
pub fn clear() {
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
|
|
|
|
// Write a 1 to the screen clear byte
|
|
|
|
|
|
|
|
write_volatile(SCREEN_CONTROL_POINTER as *mut u8, 1);
|
|
|
|
|
|
|
|
write_volatile(SCREEN_CONTROL_POINTER as *mut u8, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
|
|
|
pub fn display() {
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
|
|
|
|
// Write a 1 to the screen display byte
|
|
|
|
|
|
|
|
write_volatile((SCREEN_CONTROL_POINTER as *mut u8).byte_offset(1), 1);
|
|
|
|
|
|
|
|
write_volatile((SCREEN_CONTROL_POINTER as *mut u8).byte_offset(1), 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
|
|
|
pub fn change_mode(mode: ScreenMode) {
|
|
|
|
|
|
|
|
match mode {
|
|
|
|
|
|
|
|
ScreenMode::AlwaysDisplay => unsafe {
|
|
|
|
|
|
|
|
write_volatile((SCREEN_CONTROL_POINTER as *mut u8).byte_offset(1), 1);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ScreenMode::Buffered => unsafe {
|
|
|
|
|
|
|
|
write_volatile((SCREEN_CONTROL_POINTER as *mut u8).byte_offset(1), 0);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn turn_pixel_on(x: u8, y: u8) {
|
|
|
|
pub fn turn_pixel_on(x: u8, y: u8) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
let mut row = read_volatile(SCREEN_POINTER.offset(y as isize));
|
|
|
|
let mut row = read_volatile(SCREEN_POINTER.offset(y as isize));
|
|
|
|