Skip to content
Snippets Groups Projects
Commit d5074b38 authored by Astro's avatar Astro :gear:
Browse files

lcd

parent d8b322ea
Branches
No related tags found
No related merge requests found
#[link(name = "card10")]
extern {
fn LCD_SetBacklight(brightness: usize);
fn LCD_Clear(color: usize);
fn LCD_ClearWindow(xstart: usize, ystart: usize, xend: usize, yend: usize, color: usize);
fn LCD_SetWindowColor(xstart: usize, ystart: usize, xend: usize, yend: usize, color: usize);
fn LCD_SetUWORD(x: usize, y: usize, color: usize);
fn LCD_Update();
}
pub const W: usize = 160;
pub const H: usize = 80;
pub fn set_backlight(brightness: usize) {
unsafe {
LCD_SetBacklight(brightness);
}
}
pub fn put_pixel(x: usize, y: usize, color: usize) {
unsafe {
LCD_SetUWORD(x, y, color);
}
}
pub fn update() {
unsafe {
LCD_Update();
}
}
...@@ -4,6 +4,8 @@ pub use max32665; ...@@ -4,6 +4,8 @@ pub use max32665;
pub use cortex_m_rt as _; pub use cortex_m_rt as _;
pub use cortex_m_rt::entry; pub use cortex_m_rt::entry;
pub mod lcd;
#[link(name = "card10")] #[link(name = "card10")]
extern { extern {
fn card10_init(); fn card10_init();
......
...@@ -2,12 +2,27 @@ ...@@ -2,12 +2,27 @@
#![no_main] #![no_main]
use panic_abort as _; use panic_abort as _;
use card10::entry; use card10::{entry, lcd};
#[entry] #[entry]
fn main() -> ! { fn main() -> ! {
card10::init(); card10::init();
panic!("TODO"); lcd::set_backlight(1000);
let mut t = 0;
loop {
for x in 0..lcd::W {
for y in 0..lcd::H {
if (((x - 2 * t) / 8) + ((y + t) / 8)) % 2 == 0 {
lcd::put_pixel(x, y, 0);
} else {
lcd::put_pixel(x, y, 0xffff);
}
}
}
lcd::update();
t += 1;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment