Loading...
Searching...
No Matches
periph_cpu.h File Reference

nRF52 specific definitions for handling peripherals More...

Detailed Description

nRF52 specific definitions for handling peripherals

Author
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Philipp-Alexander Blum phili.nosp@m.pp-b.nosp@m.lum@j.nosp@m.akik.nosp@m.u.de

Definition in file periph_cpu.h.

#include "periph_cpu_common.h"
+ Include dependency graph for periph_cpu.h:

Go to the source code of this file.

#define CLOCK_CORECLOCK   (64000000U)
 System core clock speed, fixed to 64MHz for all NRF52x CPUs.
 

Peripheral clock speed (fixed to 16MHz for nRF52 based CPUs)

#define PERIPH_CLOCK   (16000000U)
 
#define ADC_NUMOF   (9U)
 The nRF52 family of CPUs provides a fixed number of 9 ADC lines.
 
#define UART_TXBUF_SIZE   (64)
 Size of the UART TX buffer for non-blocking mode.
 
enum  {
  NRF52_AIN0 = 0 , NRF52_AIN1 = 1 , NRF52_AIN2 = 2 , NRF52_AIN3 = 3 ,
  NRF52_AIN4 = 4 , NRF52_AIN5 = 5 , NRF52_AIN6 = 6 , NRF52_AIN7 = 7 ,
  NRF52_VDD = 8
}
 nRF52 specific naming of ADC lines (for convenience) More...
 
typedef void(* spi_twi_irq_cb_t) (void *arg)
 Common SPI/I2C interrupt callback.
 
void spi_twi_irq_register_spi (NRF_SPIM_Type *bus, spi_twi_irq_cb_t cb, void *arg)
 Register a SPI IRQ handler for a shared I2C/SPI irq vector.
 
void spi_twi_irq_register_i2c (NRF_TWIM_Type *bus, spi_twi_irq_cb_t cb, void *arg)
 Register a I2C IRQ handler for a shared I2C/SPI irq vector.
 
void nrf5x_i2c_acquire (NRF_TWIM_Type *bus, spi_twi_irq_cb_t cb, void *arg)
 Acquire the shared I2C/SPI peripheral in I2C mode.
 
void nrf5x_i2c_release (NRF_TWIM_Type *bus)
 Release the shared I2C/SPI peripheral in I2C mode.
 
void nrf5x_spi_acquire (NRF_SPIM_Type *bus, spi_twi_irq_cb_t cb, void *arg)
 Acquire the shared I2C/SPI peripheral in SPI mode.
 
void nrf5x_spi_release (NRF_SPIM_Type *bus)
 Acquire the shared I2C/SPI peripheral in SPI mode.
 

Macro Definition Documentation

◆ ADC_NUMOF

#define ADC_NUMOF   (9U)

The nRF52 family of CPUs provides a fixed number of 9 ADC lines.

Definition at line 46 of file periph_cpu.h.

◆ CLOCK_CORECLOCK

#define CLOCK_CORECLOCK   (64000000U)

System core clock speed, fixed to 64MHz for all NRF52x CPUs.

Definition at line 33 of file periph_cpu.h.

◆ PERIPH_CLOCK

#define PERIPH_CLOCK   (16000000U)

Definition at line 38 of file periph_cpu.h.

◆ UART_TXBUF_SIZE

#define UART_TXBUF_SIZE   (64)

Size of the UART TX buffer for non-blocking mode.

Definition at line 88 of file periph_cpu.h.

Typedef Documentation

◆ spi_twi_irq_cb_t

typedef void(* spi_twi_irq_cb_t) (void *arg)

Common SPI/I2C interrupt callback.

Parameters
argOpaque context pointer

Definition at line 96 of file periph_cpu.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

nRF52 specific naming of ADC lines (for convenience)

Enumerator
NRF52_AIN0 

Analog Input 0.

NRF52_AIN1 

Analog Input 1.

NRF52_AIN2 

Analog Input 2.

NRF52_AIN3 

Analog Input 3.

NRF52_AIN4 

Analog Input 4.

NRF52_AIN5 

Analog Input 5.

NRF52_AIN6 

Analog Input 6.

NRF52_AIN7 

Analog Input 7.

NRF52_VDD 

VDD, not useful if VDD is reference...

Definition at line 52 of file periph_cpu.h.

Function Documentation

◆ nrf5x_i2c_acquire()

void nrf5x_i2c_acquire ( NRF_TWIM_Type *  bus,
spi_twi_irq_cb_t  cb,
void *  arg 
)

Acquire the shared I2C/SPI peripheral in I2C mode.

Parameters
busbus to acquire exclusive access on
cbISR handler to call on IRQ
argISR handler argument

◆ nrf5x_i2c_release()

void nrf5x_i2c_release ( NRF_TWIM_Type *  bus)

Release the shared I2C/SPI peripheral in I2C mode.

Parameters
busbus to release exclusive access on

◆ nrf5x_spi_acquire()

void nrf5x_spi_acquire ( NRF_SPIM_Type *  bus,
spi_twi_irq_cb_t  cb,
void *  arg 
)

Acquire the shared I2C/SPI peripheral in SPI mode.

Parameters
busbus to release exclusive access on
cbISR handler to call on IRQ
argISR handler argument

◆ nrf5x_spi_release()

void nrf5x_spi_release ( NRF_SPIM_Type *  bus)

Acquire the shared I2C/SPI peripheral in SPI mode.

Parameters
busbus to release exclusive access on

◆ spi_twi_irq_register_i2c()

void spi_twi_irq_register_i2c ( NRF_TWIM_Type *  bus,
spi_twi_irq_cb_t  cb,
void *  arg 
)

Register a I2C IRQ handler for a shared I2C/SPI irq vector.

Parameters
busbus to register the IRQ handler on
cbcallback to call on IRQ
argArgument to pass to the handler

◆ spi_twi_irq_register_spi()

void spi_twi_irq_register_spi ( NRF_SPIM_Type *  bus,
spi_twi_irq_cb_t  cb,
void *  arg 
)

Register a SPI IRQ handler for a shared I2C/SPI irq vector.

Parameters
busbus to register the IRQ handler on
cbcallback to call on IRQ
argArgument to pass to the handler