Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2017 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef PERIPH_CPU_H
20#define PERIPH_CPU_H
21
22#include "periph_cpu_common.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
31#define CLOCK_CORECLOCK (16000000U)
32
37#define SPI_SCKSEL (dev(bus)->PSELSCK)
38#define SPI_MOSISEL (dev(bus)->PSELMOSI)
39#define SPI_MISOSEL (dev(bus)->PSELMISO)
42#ifndef DOXYGEN
47#define HAVE_I2C_SPEED_T
48typedef enum {
49 I2C_SPEED_LOW = 0x01,
50 I2C_SPEED_NORMAL = TWI_FREQUENCY_FREQUENCY_K100,
51 I2C_SPEED_FAST = TWI_FREQUENCY_FREQUENCY_K400,
52 I2C_SPEED_FAST_PLUS = 0x02,
53 I2C_SPEED_HIGH = 0x03,
56#endif /* ndef DOXYGEN */
57
63#define PERIPH_I2C_NEED_READ_REG
65#define PERIPH_I2C_NEED_WRITE_REG
68#ifndef DOXYGEN
73#define HAVE_ADC_RES_T
74typedef enum {
75 ADC_RES_6BIT = 0xf0,
76 ADC_RES_8BIT = 0x00,
77 ADC_RES_10BIT = 0x02,
78 ADC_RES_12BIT = 0xf1,
79 ADC_RES_14BIT = 0xf2,
80 ADC_RES_16BIT = 0xf3
81} adc_res_t;
83#endif /* ndef DOXYGEN */
84
88typedef gpio_t adc_conf_t;
89
93typedef struct {
94 NRF_TWI_Type *dev;
95 gpio_t pin_scl;
96 gpio_t pin_sda;
97 uint8_t ppi;
98 i2c_speed_t speed;
100
104typedef struct {
105 NRF_SPI_Type *dev;
106 gpio_t sclk;
107 gpio_t mosi;
108 gpio_t miso;
109} spi_conf_t;
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* PERIPH_CPU_H */
i2c_speed_t
Definition periph_cpu.h:276
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition periph_cpu.h:280
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition periph_cpu.h:277
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition periph_cpu.h:282
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:279
gpio_t adc_conf_t
ADC configuration wrapper.
Definition periph_cpu.h:337
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
I2C configuration structure.
Definition periph_cpu.h:299
uint8_t ppi
PPI channel to use.
Definition periph_cpu.h:97
NRF_TWI_Type * dev
hardware device
Definition periph_cpu.h:94
gpio_t pin_sda
SDA pin.
Definition periph_cpu.h:96
gpio_t pin_scl
SCL pin.
Definition periph_cpu.h:95
SPI device configuration.
Definition periph_cpu.h:337
NRF_SPI_Type * dev
SPI device used.
Definition periph_cpu.h:105