Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015-2017 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "periph_cpu_common.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
27#define CLOCK_CORECLOCK (16000000U)
28
33#define SPI_SCKSEL (dev(bus)->PSELSCK)
34#define SPI_MOSISEL (dev(bus)->PSELMOSI)
35#define SPI_MISOSEL (dev(bus)->PSELMISO)
37
38#ifndef DOXYGEN
43#define HAVE_I2C_SPEED_T
44typedef enum {
45 I2C_SPEED_LOW = 0x01,
46 I2C_SPEED_NORMAL = TWI_FREQUENCY_FREQUENCY_K100,
47 I2C_SPEED_FAST = TWI_FREQUENCY_FREQUENCY_K400,
48 I2C_SPEED_FAST_PLUS = 0x02,
49 I2C_SPEED_HIGH = 0x03,
52#endif /* ndef DOXYGEN */
53
59#define PERIPH_I2C_NEED_READ_REG
61#define PERIPH_I2C_NEED_WRITE_REG
63
64#ifndef DOXYGEN
69#define HAVE_ADC_RES_T
70typedef enum {
71 ADC_RES_6BIT = 0xf0,
72 ADC_RES_8BIT = 0x00,
73 ADC_RES_10BIT = 0x02,
74 ADC_RES_12BIT = 0xf1,
75 ADC_RES_14BIT = 0xf2,
76 ADC_RES_16BIT = 0xf3
77} adc_res_t;
79#endif /* ndef DOXYGEN */
80
84typedef gpio_t adc_conf_t;
85
89typedef struct {
90 NRF_TWI_Type *dev;
91 gpio_t pin_scl;
92 gpio_t pin_sda;
93 uint8_t ppi;
96
100typedef struct {
101 NRF_SPI_Type *dev;
102 gpio_t sclk;
103 gpio_t mosi;
104 gpio_t miso;
105} spi_conf_t;
106
107#ifdef __cplusplus
108}
109#endif
110
i2c_speed_t
Definition periph_cpu.h:272
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition periph_cpu.h:276
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition periph_cpu.h:273
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition periph_cpu.h:278
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:275
adc_res_t
Possible ADC resolution settings.
Definition adc.h:92
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition adc.h:98
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition adc.h:94
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition adc.h:97
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition adc.h:93
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition adc.h:95
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition adc.h:96
ADC device configuration.
Definition periph_cpu.h:374
I2C configuration structure.
Definition periph_cpu.h:295
uint8_t ppi
PPI channel to use.
Definition periph_cpu.h:93
i2c_speed_t speed
Configured bus speed, actual speed may be lower but never higher.
Definition periph_cpu.h:300
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:296
gpio_t pin_sda
SDA pin.
Definition periph_cpu.h:92
gpio_t pin_scl
SCL pin.
Definition periph_cpu.h:91
SPI device configuration.
Definition periph_cpu.h:333
gpio_t mosi
GPIO used as MOSI pin.
Definition periph_cpu.h:863
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:334
gpio_t sclk
SCLK pin.
Definition periph_cpu.h:86
gpio_t miso
GPIO used as MISO pin.
Definition periph_cpu.h:864