Skip to content

Instantly share code, notes, and snippets.

Created July 20, 2017 18:40
Rust code shared from the playground
#![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