Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2018 Freie Universität Berlin
3 * 2020 Philipp-Alexander Blum <philipp-blum@jakiku.de>
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
21#ifndef PERIPH_CPU_H
22#define PERIPH_CPU_H
23
24#include "periph_cpu_common.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
33#define CLOCK_CORECLOCK (64000000U)
34
38#define PERIPH_CLOCK (16000000U)
39
43#ifdef SAADC_CH_PSELP_PSELP_VDDHDIV5
44#define ADC_NUMOF (10U)
45#else
46#define ADC_NUMOF (9U)
47#endif
48
52enum {
62#ifdef SAADC_CH_PSELP_PSELP_VDDHDIV5
63 NRF52_VDDHDIV5 = 9,
64#endif
65};
66
67#ifndef DOXYGEN
72#define HAVE_ADC_RES_T
73typedef enum {
74 ADC_RES_6BIT = 0xf0,
75 ADC_RES_8BIT = 0x00,
76 ADC_RES_10BIT = 0x01,
77 ADC_RES_12BIT = 0x02,
78 ADC_RES_14BIT = 0xf1,
79 ADC_RES_16BIT = 0xf2
80} adc_res_t;
82#endif /* ndef DOXYGEN */
83
87#ifndef UART_TXBUF_SIZE
88#define UART_TXBUF_SIZE (64)
89#endif
90
96typedef void (*spi_twi_irq_cb_t)(void *arg);
97
105void spi_twi_irq_register_spi(NRF_SPIM_Type *bus,
106 spi_twi_irq_cb_t cb, void *arg);
107
115void spi_twi_irq_register_i2c(NRF_TWIM_Type *bus,
116 spi_twi_irq_cb_t cb, void *arg);
117
125void nrf5x_i2c_acquire(NRF_TWIM_Type *bus, spi_twi_irq_cb_t cb, void *arg);
126
132void nrf5x_i2c_release(NRF_TWIM_Type *bus);
133
141void nrf5x_spi_acquire(NRF_SPIM_Type *bus, spi_twi_irq_cb_t cb, void *arg);
142
148void nrf5x_spi_release(NRF_SPIM_Type *bus);
149
150#ifdef __cplusplus
151}
152#endif
153
154#endif /* PERIPH_CPU_H */
adc_res_t
Possible ADC resolution settings.
Definition adc.h:93
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition adc.h:99
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition adc.h:95
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition adc.h:98
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition adc.h:94
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition adc.h:96
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition adc.h:97
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_spi_release(NRF_SPIM_Type *bus)
Acquire the shared I2C/SPI peripheral in SPI 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(* spi_twi_irq_cb_t)(void *arg)
Common SPI/I2C interrupt callback.
Definition periph_cpu.h:96
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.
@ NRF52_AIN2
Analog Input 2.
Definition periph_cpu.h:55
@ NRF52_AIN6
Analog Input 6.
Definition periph_cpu.h:59
@ NRF52_AIN0
Analog Input 0.
Definition periph_cpu.h:53
@ NRF52_AIN1
Analog Input 1.
Definition periph_cpu.h:54
@ NRF52_AIN4
Analog Input 4.
Definition periph_cpu.h:57
@ NRF52_AIN3
Analog Input 3.
Definition periph_cpu.h:56
@ NRF52_VDD
VDD, not useful if VDD is reference...
Definition periph_cpu.h:61
@ NRF52_AIN7
Analog Input 7.
Definition periph_cpu.h:60
@ NRF52_AIN5
Analog Input 5.
Definition periph_cpu.h:58
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.