japaric-archived / cu

Testing ground for the Copper book (http://japaric.github.io/copper/).
Apache License 2.0
58 stars 1 forks source link

Settle on an API to manipulate registers #44

Open japaric opened 8 years ago

japaric commented 8 years ago

Current design

extern {
    static mut GPIOA: Gpio;
    static mut GPIOB: Gpio;
}

For an example of the use of the current API, check the src/bin folder.

Constraints

fn gpioa() -> &'static Gpio {
    unsafe { mem::transmute(0xdeadbeef) }
}

unsafe fn gpioa_mut() -> &'static mut Gpio {
    unsafe { mem::transmute(0xdeadbeef) }
}