[−][src]Macro ruspiro_register::define_register
Macro to define a single register with a specific defined access mode.
The access mode could one of: ReadOnly, WriteOnly, ReadWrite.
The register size/width could be one of: u8, u16, u32, u64
Examples
define_register!( GPFSEL0: ReadWrite<u32> @ 0x3F20_0000 ); let _ = GPFSEL0::Register.get();
const GPIO_BASE:u32 = 0x3F00_0000; define_register!( GPFSEL1: ReadWrite<u32> @ GPIO_BASE + 0x04 ); let _ = GPFSEL1::Register.get();
To pass a more specific definition of the fields the register represents they could be added in the [] of the definition like so:
define_register!( GPFSEL2: ReadWrite<u32> @ 0x3F20_0000 => [ FSEL20 OFFSET(0) BITS(3), FSEL21 OFFSET(3) BITS(3), FSEL22 OFFSET(6) BITS(3) ] ); GPFSEL2::Register.modify(GPFSEL2::FSEL21, 0b001);