PebbleOS v4.47.0-1075-g013613c8a
Loading...
Searching...
No Matches
nRF5 GPIO

GPIO ports of the nRF5 SoCs. More...

Data Structures

struct  pbl_gpio_nrf5
 nRF5 GPIO port. More...
 

Macros

#define PBL_GPIO_NRF5_DEFINE(sym, _name, _base, _gpiote, _num_pins)
 Define an nRF5 GPIO port and its interrupt controller, sym_intc.
 

Functions

static uint32_t pbl_gpio_nrf5_pin (const struct pbl_gpio *gpio)
 Absolute pin number of a pin, as nrfx takes it.
 
int pbl_gpio_nrf5_gpiote_alloc (uint8_t *channel)
 Allocate a GPIOTE channel for use outside of the interrupt controllers.
 

Detailed Description

GPIO ports of the nRF5 SoCs.

Each port carries an Interrupt controller controller whose lines are the pins, backed by the GPIOTE IN channels shared by all ports. Lines are edge triggered only.


Data Structure Documentation

◆ pbl_gpio_nrf5

struct pbl_gpio_nrf5

nRF5 GPIO port.

Data Fields
uintptr_t base Register base address.
uintptr_t gpiote Registers of the GPIOTE.
uint8_t index Port index.
struct pbl_gpio_port port GPIO port.

Macro Definition Documentation

◆ PBL_GPIO_NRF5_DEFINE

#define PBL_GPIO_NRF5_DEFINE (   sym,
  _name,
  _base,
  _gpiote,
  _num_pins 
)
Value:
extern const struct pbl_intc sym##_intc; \
PBL_DEVICE_STATE_DEFINE(sym); \
PBL_INTC_STATE_DEFINE(sym##_intc, _num_pins); \
PBL_DEVICE_INSTANCE(sym, struct pbl_gpio_nrf5, struct pbl_gpio_port, port){ \
.port = PBL_GPIO_PORT_INIT(sym, _name, pbl_gpio_nrf5_init, nullptr, &pbl_gpio_nrf5_port_ops, \
_num_pins, &sym##_intc), \
.base = (_base), \
.index = PBL_GPIO_NRF5__INDEX(_base), \
.gpiote = (_gpiote), \
}; \
PBL_DEVICE_INSTANCE(sym##_intc, struct pbl_gpio_nrf5_intc, struct pbl_intc, intc) { \
.intc = PBL_INTC_INIT(sym##_intc, _name "_intc", nullptr, &sym##_inst.port.dev, \
&pbl_gpio_nrf5_intc_ops), \
.port = &sym##_inst, \
}
nRF5 GPIO port.
Definition nrf5.h:23
A GPIO controller.
Definition gpio.h:101
#define PBL_GPIO_PORT_INIT(sym, _name, _init, _parent, _ops, _num_pins, _intc)
Initializer for a struct pbl_gpio_port.
Definition gpio.h:123
An interrupt controller.
Definition intc.h:89
#define PBL_INTC_INIT(sym, _name, _init, _parent, _ops)
Initializer for the struct pbl_intc of controller sym.
Definition intc.h:123

Define an nRF5 GPIO port and its interrupt controller, sym_intc.

Parameters
symSymbol of the port, a struct pbl_gpio_port.
_nameName.
_baseRegisters.
_gpioteRegisters of the GPIOTE.
_num_pinsNumber of pins.

Function Documentation

◆ pbl_gpio_nrf5_gpiote_alloc()

int pbl_gpio_nrf5_gpiote_alloc ( uint8_t *  channel)

Allocate a GPIOTE channel for use outside of the interrupt controllers.

Parameters
[out]channelAllocated channel.
Returns
0 or -ENOMEM if all channels are in use.

◆ pbl_gpio_nrf5_pin()

static uint32_t pbl_gpio_nrf5_pin ( const struct pbl_gpio *  gpio)
inlinestatic

Absolute pin number of a pin, as nrfx takes it.

Parameters
gpioPin on an nRF5 port.
Returns
Absolute pin number.

References PBL_CONTAINER_OF, pbl_gpio::pin, pbl_gpio::port, and pbl_gpio_nrf5::port.