Register definitions: get rid of some macro magic that doesn't help much
Instead of e.g. GPIO.DATA.GPIO_08, you now use GPIO->DATA.GPIO_08.
This commit is contained in:
parent
bf94b6d3bd
commit
ac2cac1e1d
5 changed files with 17 additions and 25 deletions
|
@ -39,13 +39,13 @@
|
|||
/* Structure-based GPIO access
|
||||
Example usage:
|
||||
|
||||
GPIO.FUNC_SEL0 |= 0x00008000; // set a whole register
|
||||
GPIO->FUNC_SEL0 |= 0x00008000; // set a whole register
|
||||
|
||||
GPIO.FUNC_SEL_08 = 2; // set just one pin
|
||||
GPIO->FUNC_SEL_08 = 2; // set just one pin
|
||||
|
||||
#define MY_PIN GPIO_08
|
||||
GPIO.FUNC_SEL.MY_PIN = 2; // same, to allow #define for pin names
|
||||
GPIO.DATA.MY_PIN = 1;
|
||||
GPIO->FUNC_SEL.MY_PIN = 2; // same, to allow #define for pin names
|
||||
GPIO->DATA.MY_PIN = 1;
|
||||
*/
|
||||
|
||||
#define _V(x,n,i) uint32_t x##_##i : n;
|
||||
|
@ -87,8 +87,7 @@ struct GPIO_struct {
|
|||
#undef _REP
|
||||
#undef _V
|
||||
|
||||
static volatile struct GPIO_struct * const _GPIO = (void *) (0x80000000);
|
||||
#define GPIO (*_GPIO)
|
||||
static volatile struct GPIO_struct * const GPIO = (void *) (0x80000000);
|
||||
|
||||
|
||||
/* Old register definitions, for compatibility */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue