lcd.rs 705 Bytes
Newer Older
Astro's avatar
lcd  
Astro committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[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();
    }
}