-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from braun-embedded/mrt
Add embedded-hal alpha and embedded-time support to MRT
- Loading branch information
Showing
4 changed files
with
131 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#![no_main] | ||
#![no_std] | ||
|
||
extern crate panic_rtt_target; | ||
|
||
use embedded_time::{duration::Extensions as _, Clock as _}; | ||
use lpc8xx_hal::{cortex_m_rt::entry, gpio::Level, mrt, Peripherals}; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
rtt_target::rtt_init_print!(); | ||
|
||
let p = Peripherals::take().unwrap(); | ||
|
||
let mut syscon = p.SYSCON.split(); | ||
let gpio = p.GPIO.enable(&mut syscon.handle); | ||
let mut mrt = p.MRT0.split(&mut syscon.handle).mrt0; | ||
|
||
let mut led = p | ||
.pins | ||
.pio1_1 | ||
.into_output_pin(gpio.tokens.pio1_1, Level::Low); | ||
|
||
loop { | ||
mrt.start(mrt::MAX_VALUE); | ||
|
||
let timer = mrt.new_timer(1u32.seconds()); | ||
timer.start().unwrap().wait().unwrap(); | ||
|
||
led.toggle(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters