-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcore.rs
54 lines (42 loc) · 1.03 KB
/
core.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
52
53
54
#![feature(asm)]
#![feature(lang_items)]
#![feature(no_std)]
#![no_std]
use arduino::{init, delay, pinMode, digitalWrite, analogWrite, LOW, HIGH, OUTPUT};
mod arduino;
trait MarkerTrait : PhantomFn<Self> { }
impl<T: ?Sized> MarkerTrait for T { }
#[lang = "phantom_fn"]
trait PhantomFn<A:?Sized,R:?Sized=()> { }
#[lang="sized"]
trait Sized : MarkerTrait {}
#[lang="copy"]
trait Copy : MarkerTrait {}
#[lang="sync"]
trait Sync : MarkerTrait {}
static PWM:u32 = 2;
static LED:u32 = 13;
static PWM_LOW:u32 = 0;
static PWM_HIGH:u32 = 16;
#[no_mangle]
pub fn main() {
init();
delay(1);
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
analogWrite(PWM, PWM_LOW);
loop {
analogWrite(PWM, PWM_HIGH);
digitalWrite(LED, HIGH);
delay(100);
analogWrite(PWM, PWM_LOW);
digitalWrite(LED, LOW);
delay(100);
analogWrite(PWM, PWM_HIGH);
digitalWrite(LED, HIGH);
delay(1000);
analogWrite(PWM, PWM_LOW);
digitalWrite(LED, LOW);
delay(1000);
}
}