38#define GPIO (GPIO_BASE)
42#define GPIO_OUT MMIO32(GPIO_BASE + 0x504)
43#define GPIO_OUTSET MMIO32(GPIO_BASE + 0x508)
44#define GPIO_OUTCLR MMIO32(GPIO_BASE + 0x50C)
46#define GPIO_IN MMIO32(GPIO_BASE + 0x510)
48#define GPIO_DIR MMIO32(GPIO_BASE + 0x514)
49#define GPIO_DIRSET MMIO32(GPIO_BASE + 0x518)
50#define GPIO_DIRCLR MMIO32(GPIO_BASE + 0x51C)
52#define GPIO_PIN_CNF(N) MMIO32(GPIO_BASE + 0x700 + 0x4 * (N))
57#define GPIO_CNF_MODE_MASK 2
58#define GPIO_CNF_MODE_SHIFT 0
64#define GPIO_MODE_INPUT 0
65#define GPIO_MODE_OUTPUT 1
66#define GPIO_MODE_ANALOG 2
69#define GPIO_CNF_PUPD_MASK 2
70#define GPIO_CNF_PUPD_SHIFT 2
75#define GPIO_PUPD_NONE 0x0
76#define GPIO_PUPD_PULLDOWN 0x1
77#define GPIO_PUPD_PULLUP 0x2
80#define GPIO_CNF_DRIVE_SHIFT 8
81#define GPIO_CNF_DRIVE_MASK 7
87#define GPIO_CNF_DRIVE_S0S1 0
90#define GPIO_CNF_DRIVE_H0S1 1
93#define GPIO_CNF_DRIVE_S0H1 2
96#define GPIO_CNF_DRIVE_H0H1 3
99#define GPIO_CNF_DRIVE_D0S1 4
102#define GPIO_CNF_DRIVE_D0H1 5
105#define GPIO_CNF_DRIVE_S0D1 6
108#define GPIO_CNF_DRIVE_H0D1 7
112#define GPIO_CNF_SENSE_SHIFT 16
113#define GPIO_CNF_SENSE_MASK 3
119#define GPIO_CNF_SENSE_DISABLE 0
122#define GPIO_CNF_SENSE_HIGH 2
125#define GPIO_CNF_SENSE_LOW 3
130#define GPIO_TASK_OUT(n) MMIO32(GPIOTE_BASE + 0x4 * (n))
131#define GPIO_EVENT_IN(n) MMIO32(GPIOTE_BASE + 0x100 + 0x4 * (n))
133#define GPIO_EVENT_PORT MMIO32(GPIOTE_BASE + 0x17C)
135#define GPIO_INTEN MMIO32(GPIOTE_BASE + 0x300)
136#define GPIO_INTENSET MMIO32(GPIOTE_BASE + 0x304)
137#define GPIO_INTENCLR MMIO32(GPIOTE_BASE + 0x308)
139#define GPIO_TE_CONFIG(n) MMIO32(GPIOTE_BASE + 0x510 + 0x4 * (n))
142#define GPIO_INTEN_IN(n) (1 << (n))
144#define GPIO_INTEN_PORT (1 << 31)
148#define GPIO_TE_CONFIG_MODE_SHIFT 0
149#define GPIO_TE_CONFIG_MODE_MASK 3
151#define GPIO_TE_CONFIG_PSEL_SHIFT 8
152#define GPIO_TE_CONFIG_PSEL_MASK 0x1f
154#define GPIO_TE_CONFIG_POLARITY_SHIFT 16
155#define GPIO_TE_CONFIG_POLARITY_MASK 3
157#define GPIO_TE_CONFIG_OUTINIT (1 << 20)
159#define GPIO_TE_MODE_DISABLED 0
160#define GPIO_TE_MODE_EVENT 1
161#define GPIO_TE_MODE_TASK 3
163#define GPIO_TE_POLARITY_NONE 0
164#define GPIO_TE_POLARITY_LO_TO_HI 1
165#define GPIO_TE_POLARITY_HI_TO_LO 2
166#define GPIO_TE_POLARITY_TOGGLE 3
168#define GPIO_TE_OUTINIT_LOW 0
169#define GPIO_TE_OUTINIT_HIGH 1
176#define GPIO0 (1 << 0)
177#define GPIO1 (1 << 1)
178#define GPIO2 (1 << 2)
179#define GPIO3 (1 << 3)
180#define GPIO4 (1 << 4)
181#define GPIO5 (1 << 5)
182#define GPIO6 (1 << 6)
183#define GPIO7 (1 << 7)
184#define GPIO8 (1 << 8)
185#define GPIO9 (1 << 9)
186#define GPIO10 (1 << 10)
187#define GPIO11 (1 << 11)
188#define GPIO12 (1 << 12)
189#define GPIO13 (1 << 13)
190#define GPIO14 (1 << 14)
191#define GPIO15 (1 << 15)
192#define GPIO16 (1 << 16)
193#define GPIO17 (1 << 17)
194#define GPIO18 (1 << 18)
195#define GPIO19 (1 << 19)
196#define GPIO20 (1 << 20)
197#define GPIO21 (1 << 21)
198#define GPIO22 (1 << 22)
199#define GPIO23 (1 << 23)
200#define GPIO24 (1 << 24)
201#define GPIO25 (1 << 25)
202#define GPIO26 (1 << 26)
203#define GPIO27 (1 << 27)
204#define GPIO28 (1 << 28)
205#define GPIO29 (1 << 29)
206#define GPIO30 (1 << 30)
207#define GPIO31 (1 << 31)
208#define GPIO_ALL 0xffffffff
214void gpio_set(uint32_t gpioport, uint32_t gpios);
215void gpio_clear(uint32_t gpioport, uint32_t gpios);
216uint32_t
gpio_get(uint32_t gpioport, uint32_t gpios);
217void gpio_toggle(uint32_t gpioport, uint32_t gpios);
219void gpio_mode_setup(uint32_t gpioport, uint32_t mode, uint32_t pull_up_down,
226 uint8_t pin_num, uint8_t polarity, uint32_t init);
uint32_t gpio_get(uint32_t gpioport, uint32_t gpios)
Read GPIO values.
void gpio_configure_event(uint8_t event_num, uint8_t pin_num, uint8_t polarity)
Configure Event in GPIO TE Module.
void gpio_disable_interrupts(uint32_t mask)
Disable GPIO interrupts.
void gpio_set(uint32_t gpioport, uint32_t gpios)
Atomic set output.
void gpio_configure_task(uint8_t task_num, uint8_t pin_num, uint8_t polarity, uint32_t init)
Configure Task in GPIO TE Module.
void gpio_set_options(uint32_t gpioport, uint32_t drive, uint32_t sense, uint32_t gpios)
Configure GPIO pin input and output specifics.
void gpio_clear_interrupts(void)
Disable all GPIO interrupts.
void gpio_clear(uint32_t gpioport, uint32_t gpios)
Atomic clear output.
void gpio_toggle(uint32_t gpioport, uint32_t gpios)
Toggle output.
void gpio_enable_interrupts(uint32_t mask)
Enable GPIO interrupts.
void gpio_mode_setup(uint32_t gpioport, uint32_t mode, uint32_t pull_up_down, uint32_t gpios)
Set GPIO Pin Mode.