Crate peripherals[−][src]
peripherals
Define and access your microcontroller peripherals
Features
- A macro to generate code for peripherals, registers, and register fields
- Zero-sized structs to represent peripherals and registers
- Enums or newtype struct to represent fields values
- Combine values to write to a regiser with
|
(binary or) - Read/write access at the regiser level
- Strong typing ensure you don’t mix up registers
- Generic over the peripheral instance
- See the example module for an example of usage and generated API
Usage
- Define peripherals with the
periph!
macro - Define microcontrollers / devices with the
device!
macro - Take a look at the
example
module to see what the generated API looks like
To use the generated device struct, create it from ()
as part of your initialisation routine.
There sould be only one instance of the device (and the right one) in your whole program.
Modules
example | Example of generated types |
Macros
device | Define a microcontroller and which peripherals it has |
periph | Define a peripheral and all its associated registers, fields and values |
Structs
InvalidValue | Error returned when converting an interger to a field value fails |
Traits
Peripheral | A peripheral instance, that has a given address |