Skip to content

Instantly share code, notes, and snippets.

@stestagg
Last active May 5, 2017 07:26
Show Gist options
  • Save stestagg/464098b78d990b3b61625695865139fc to your computer and use it in GitHub Desktop.
Save stestagg/464098b78d990b3b61625695865139fc to your computer and use it in GitHub Desktop.
ioregs! (GPIO @ 0x50000000 = { //! power management unit
0x504 => reg32 out { 31..0 => pins }, // write to gpio
0x508 => reg32 outset { 31..0 => pins }, // set individual out pins to high
0x50c => reg32 outclr { 31..0 => pins } , // set individual out pins to low
0x510 => reg32 in { 31..0 => pins } , // read pin values
0x514 => reg32 dir { 31..0 => pins } , // set direction of all pins (1=output, 0=input)
0x518 => reg32 dirset { 31..0 => pins } , // set individual pins to output
0x51c => reg32 dirclr { 31..0 => pins } , // set individual pins to input
0x700 => reg32 pin_config[32] {
0 => dir,
1 => input,
3..2 => pull,
10..8 => drive,
17..16 => sense,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment