36#include "periph_cpu.h"
44#define PORT_BIT (1 << 5)
45#define PIN_MASK (0x1f)
46#define NRF5X_IO_AREA_START (0x40000000UL)
50#define NRF_P0 NRF_P0_S
53#if defined(CPU_FAM_NRF51)
54#define GPIO_PORT(num) ((gpio_port_t)NRF_GPIO)
55#define GPIO_PORT_NUM(port) 0
57#define GPIO_PORT(num) ((num) ? (gpio_port_t)NRF_P1 : (gpio_port_t)NRF_P0)
58#define GPIO_PORT_NUM(port) ((port == (gpio_port_t)NRF_P1) ? 1 : 0)
60#define GPIO_PORT(num) ((gpio_port_t)NRF_P0)
61#define GPIO_PORT_NUM(port) 0
66 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
72 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
78 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
84 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
90 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
98 NRF_GPIO_Type *p = (NRF_GPIO_Type *)port;
131 if (port >= NRF5X_IO_AREA_START) {
POSIX.1-2008 compliant version of the assert macro.
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
#define PIN_MASK(n)
Generate a bit mask in which only the specified bit is high.
static uint8_t gpio_get_pin_num(gpio_t pin)
Extract the pin number from a gpio_t
static void gpio_ll_set(gpio_port_t port, uword_t mask)
Perform an reg |= mask operation on the I/O register of the port.
static gpio_port_t gpio_port_pack_addr(void *addr)
Pack a pointer into a gpio_port_t.
static uword_t gpio_ll_read(gpio_port_t port)
Get the current input value of all GPIO pins of the given port as bitmask.
static gpio_port_t gpio_get_port(gpio_t pin)
Extract the gpio_port_t from a gpio_t
static void * gpio_port_unpack_addr(gpio_port_t port)
Extract a data pointer that was packed by gpio_port_pack_addr.
#define GPIO_PORT(num)
Get the gpio_port_t value of the port identified by num.
static bool is_gpio_port_num_valid(uint_fast8_t num)
Check if the given number is a valid argument for GPIO_PORT.
static uword_t gpio_ll_read_output(gpio_port_t port)
Get the current output value of all GPIO pins of the given port as bitmask.
static void gpio_ll_clear(gpio_port_t port, uword_t mask)
Perform an reg &= ~mask operation on the I/O register of the port.
static void gpio_ll_toggle(gpio_port_t port, uword_t mask)
Perform an reg ^= mask operation on the I/O register of the port.
static void gpio_ll_write(gpio_port_t port, uword_t state)
Perform a masked write operation on the I/O register of the port.
uintptr_t gpio_port_t
GPIO port type.
uint< NUM > _t uword_t
Word sized unsigned integer.