periph_cpu_common.h File Reference

nRF5x common definitions for handling peripherals More...

Detailed Description

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"
+ Include dependency graph for periph_cpu_common.h:

Go to the source code of this file.

Data Structures

struct  timer_conf_t
 Timer configuration. More...
 

Macros

#define CPUID_ADDR   (&NRF_FICR->DEVICEID[0])
 Starting offset of CPU_ID.
 
#define CPUID_LEN   (8U)
 Length of the CPU_ID in octets.
 

Functions

uint8_t gpio_int_get_exti (gpio_t pin)
 Retrieve the exti(GPIOTE) channel associated with a gpio. More...
 

Override macro for defining GPIO pins

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 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
 

WDT upper and lower bound times in ms

#define NWDT_TIME_LOWER_LIMIT   (1)
 
#define NWDT_TIME_UPPER_LIMIT   ((UINT32_MAX >> 15) * US_PER_MS + 1)
 

Macro Definition Documentation

◆ 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 71 of file periph_cpu_common.h.

Function Documentation

◆ gpio_int_get_exti()

uint8_t gpio_int_get_exti ( gpio_t  pin)

Retrieve the exti(GPIOTE) channel associated with a gpio.

Parameters
pinGPIO pin to retrieve the channel for
Returns
the channel number
0xff if no channel is found