Module peripherals::example[][src]

Expand description

Example of generated types

The macro invocations can be seen in the source code. This module exists only in documentation and tests

To actually use the generated device struct, it must be cased from (). This should idealy be done in the runtime support crate (-rt crate), or at the very beginning of your main function. There sould be only one instance of the device (and the right one) in your whole program.

// In some library
peripherals::device! {
    YourDevice;
    // peripherals elided
}

// In a `-rt` crate or at the very beginning of your program:
let peripherals: YourDevice = unsafe { core::mem::transmute(()) };

Modules

complex

A more complex example that shares fields and registers

device

Example of generated device API

field_type

Example of generated field type API

periph

Example of generated peripheral API

register

Example of generated register API