nRF5x common definitions for handling peripherals
More...
nRF5x common definitions for handling peripherals
- Author
- Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Definition in file periph_cpu_common.h.
#include "cpu.h"
Go to the source code of this file.
|
uint8_t | gpio_int_get_exti (gpio_t pin) |
| Retrieve the exti(GPIOTE) channel associated with a gpio. More...
|
|
void | shared_irq_register_spi (NRF_SPIM_Type *bus, shared_irq_cb_t cb, void *arg) |
| Register a SPI IRQ handler for a shared UART/I2C/SPI irq vector. More...
|
|
void | shared_irq_register_i2c (NRF_TWIM_Type *bus, shared_irq_cb_t cb, void *arg) |
| Register an I2C IRQ handler for a shared UART/I2C/SPI irq vector. More...
|
|
void | shared_irq_register_uart (NRF_UARTE_Type *bus, shared_irq_cb_t cb, void *arg) |
| Register an UART IRQ handler for a shared UART/I2C/SPI irq vector. More...
|
|
void | nrf5x_i2c_acquire (NRF_TWIM_Type *bus, shared_irq_cb_t cb, void *arg) |
| Acquire the shared I2C/SPI peripheral in I2C mode. More...
|
|
void | nrf5x_i2c_release (NRF_TWIM_Type *bus) |
| Release the shared I2C/SPI peripheral in I2C mode. More...
|
|
void | nrf5x_spi_acquire (NRF_SPIM_Type *bus, shared_irq_cb_t cb, void *arg) |
| Acquire the shared I2C/SPI peripheral in SPI mode. More...
|
|
void | nrf5x_spi_release (NRF_SPIM_Type *bus) |
| Acquire the shared I2C/SPI peripheral in SPI mode. More...
|
|
|
The port definition is used (and zeroed) to suppress compiler warnings
|
#define | GPIO_PIN(x, y) ((x & 0) | y) |
|
#define | GPIO_UNDEF (UINT8_MAX) |
| Override GPIO_UNDEF value.
|
|
#define | ISR_GPIOTE isr_gpiote |
| Wrapper around GPIOTE ISR. More...
|
|
#define | GPIO_MODE(oe, ic, pr, dr) (oe | (ic << 1) | (pr << 2) | (dr << 8)) |
| Generate GPIO mode bitfields. More...
|
|
#define | SPI_HWCS(x) (SPI_CS_UNDEF) |
| No support for HW chip select...
|
|
#define | PERIPH_SPI_NEEDS_INIT_CS |
| Declare needed shared SPI functions.
|
|
#define | PERIPH_SPI_NEEDS_TRANSFER_BYTE |
|
#define | PERIPH_SPI_NEEDS_TRANSFER_REG |
|
#define | PERIPH_SPI_NEEDS_TRANSFER_REGS |
|
|
#define | NWDT_TIME_LOWER_LIMIT (1) |
|
#define | NWDT_TIME_UPPER_LIMIT ((UINT32_MAX >> 15) * US_PER_MS + 1) |
|
◆ CONFIG_SPI_MBUF_SIZE
#define CONFIG_SPI_MBUF_SIZE 64 |
Size of the UART TX buffer for non-blocking mode.
SPI temporary buffer size for storing const data in RAM before initiating DMA transfer
Definition at line 573 of file periph_cpu_common.h.
◆ GPIO_MODE
#define GPIO_MODE |
( |
|
oe, |
|
|
|
ic, |
|
|
|
pr, |
|
|
|
dr |
|
) |
| (oe | (ic << 1) | (pr << 2) | (dr << 8)) |
Generate GPIO mode bitfields.
We use 4 bit to encode the pin mode:
- bit 0: output enable
- bit 1: input connect
- bit 2+3: pull resistor configuration
- bit 8+9+10: drive configuration
Definition at line 102 of file periph_cpu_common.h.
◆ ISR_GPIOTE
#define ISR_GPIOTE isr_gpiote |
Wrapper around GPIOTE ISR.
- Note
- nRF53 has two GPIOTE instances available on Application Core but we always use the first one.
Definition at line 90 of file periph_cpu_common.h.
◆ SPI_SCKSEL
#define SPI_SCKSEL (dev(bus)->PSEL.SCK) |
Redefine some peripheral names to unify them across nRF families.
Macro for SPI clk
Definition at line 475 of file periph_cpu_common.h.
◆ TIMER_CHANNEL_NUMOF
#define TIMER_CHANNEL_NUMOF 5 |
Maximum number of channels.
- Note
- NRF_TIMER1 and NRF_TIMER2 only have 4 hardware channels (and 3 of of them are available to the application, as one has to be used to implement timer_read()). Use timer_query_channel_numof to check the actual number of supported channels for a given timer.
Definition at line 325 of file periph_cpu_common.h.
◆ shared_irq_cb_t
typedef void(* shared_irq_cb_t) (void *arg) |
Common UART/SPI/I2C interrupt callback.
- Parameters
-
arg | Opaque context pointer |
Definition at line 497 of file periph_cpu_common.h.
◆ gpio_int_get_exti()
uint8_t gpio_int_get_exti |
( |
gpio_t |
pin | ) |
|
Retrieve the exti(GPIOTE) channel associated with a gpio.
- Parameters
-
pin | GPIO pin to retrieve the channel for |
- Returns
- the channel number
-
0xff if no channel is found
◆ nrf5x_i2c_acquire()
void nrf5x_i2c_acquire |
( |
NRF_TWIM_Type * |
bus, |
|
|
shared_irq_cb_t |
cb, |
|
|
void * |
arg |
|
) |
| |
Acquire the shared I2C/SPI peripheral in I2C mode.
- Parameters
-
bus | bus to acquire exclusive access on |
cb | ISR handler to call on IRQ |
arg | ISR handler argument |
◆ nrf5x_i2c_release()
void nrf5x_i2c_release |
( |
NRF_TWIM_Type * |
bus | ) |
|
Release the shared I2C/SPI peripheral in I2C mode.
- Parameters
-
bus | bus to release exclusive access on |
◆ nrf5x_spi_acquire()
void nrf5x_spi_acquire |
( |
NRF_SPIM_Type * |
bus, |
|
|
shared_irq_cb_t |
cb, |
|
|
void * |
arg |
|
) |
| |
Acquire the shared I2C/SPI peripheral in SPI mode.
- Parameters
-
bus | bus to release exclusive access on |
cb | ISR handler to call on IRQ |
arg | ISR handler argument |
◆ nrf5x_spi_release()
void nrf5x_spi_release |
( |
NRF_SPIM_Type * |
bus | ) |
|
Acquire the shared I2C/SPI peripheral in SPI mode.
- Parameters
-
bus | bus to release exclusive access on |
◆ shared_irq_register_i2c()
void shared_irq_register_i2c |
( |
NRF_TWIM_Type * |
bus, |
|
|
shared_irq_cb_t |
cb, |
|
|
void * |
arg |
|
) |
| |
Register an I2C IRQ handler for a shared UART/I2C/SPI irq vector.
- Parameters
-
bus | bus to register the IRQ handler on |
cb | callback to call on IRQ |
arg | Argument to pass to the handler |
◆ shared_irq_register_spi()
void shared_irq_register_spi |
( |
NRF_SPIM_Type * |
bus, |
|
|
shared_irq_cb_t |
cb, |
|
|
void * |
arg |
|
) |
| |
Register a SPI IRQ handler for a shared UART/I2C/SPI irq vector.
- Parameters
-
bus | bus to register the IRQ handler on |
cb | callback to call on IRQ |
arg | Argument to pass to the handler |
◆ shared_irq_register_uart()
void shared_irq_register_uart |
( |
NRF_UARTE_Type * |
bus, |
|
|
shared_irq_cb_t |
cb, |
|
|
void * |
arg |
|
) |
| |
Register an UART IRQ handler for a shared UART/I2C/SPI irq vector.
- Parameters
-
bus | bus to register the IRQ handler on |
cb | callback to call on IRQ |
arg | Argument to pass to the handler |