-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.rs
52 lines (40 loc) · 875 Bytes
/
main.rs
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
47
48
49
50
51
#![feature(no_std)]
#![feature(core)]
#![feature(lang_items)]
#![no_std]
#![crate_type="staticlib"]
extern crate core;
mod bitflags;
mod runtime;
mod sysctl;
mod led_driver;
mod gpio;
mod systick;
fn clock_init() {
let clock_config = sysctl::SYSCTL_SYSDIV_2_5 + sysctl::SYSCTL_USE_PLL +
sysctl::SYSCTL_XTAL_16MHZ + sysctl::SYSCTL_OSC_MAIN;
sysctl::clock_set(clock_config);
}
fn handler() {
}
#[no_mangle] pub fn main()
{
clock_init();
led_driver::init();
systick::init();
systick::set_period_us(10 * 1000);
systick::set_handler(handler);
systick::start();
loop {
let mut i = 0;
while i < 1000000 {
i += 1;
led_driver::set_red(false);
}
i = 0;
while i < 1000000 {
i += 1;
led_driver::set_red(true);
}
}
}