summaryrefslogtreecommitdiffstats
path: root/demo/src/main.rs
blob: 5f2cd9992f381bcbd854af2ff1457285d784d10a (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#![feature(asm)]
#![feature(asm_const)]
#![feature(asm_sym)]
#![feature(naked_functions)]
#![feature(panic_info_message)]

#![no_std]
#![no_main]

use ibugger_rt::entry;
use s5l87xx::Peripherals;
use nano5g::lcd::{LCD, Display};

use core::fmt::Write;

mod console;
mod panique;

entry!(main);

fn main() -> ! {
    let periphs = unsafe { Peripherals::steal() };
    let lcd = LCD::new(periphs.LCD);
    let mut display = Display::new(lcd);

    let mut console = console::Console::<{240/6}, {320/14}>::new();
    console.write_str("Hello, world!\n");
    console.blit(&mut display);
    display.flush();

    let mut i = 0;
    loop {
        core::fmt::write(&mut console, format_args!("tick {}\n", i));
        i += 1;
        console.blit(&mut display);
        display.flush();
        if i > 10 {
            break
        }
    }

    let foo: Option<i32> = None;
    foo.unwrap();

    loop {}
}