Created
July 20, 2017 18:40
Rust code shared from the playground
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
#![feature(used)] | |
#![feature(const_fn)] | |
#![no_std] | |
extern crate cortex_m; | |
#[macro_use(exception)] | |
extern crate cortex_m_rt; | |
extern crate stm32f042; | |
extern crate volatile_register; | |
fn main() {} | |
exception!(SYS_TICK, hello_world); | |
struct Buffer {} | |
impl core::fmt::Write for Buffer { | |
fn write_str(&mut self, s: &str) -> core::fmt::Result { | |
let _ = s; | |
Ok(()) | |
} | |
} | |
fn hello_world() { | |
use core::fmt::Write; | |
let mut output = Buffer {}; | |
writeln!(&mut output, "Hello World!").unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment