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
9#pragma once
10
20
21#include "periph_cpu_common.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
30#define CLOCK_CORECLOCK (16000000U)
31
36#define SPI_SCKSEL (dev(bus)->PSELSCK)
37#define SPI_MOSISEL (dev(bus)->PSELMOSI)
38#define SPI_MISOSEL (dev(bus)->PSELMISO)
40
41#ifndef DOXYGEN
46#define HAVE_I2C_SPEED_T
47typedef enum {
48 I2C_SPEED_LOW = 0x01,
49 I2C_SPEED_NORMAL = TWI_FREQUENCY_FREQUENCY_K100,
50 I2C_SPEED_FAST = TWI_FREQUENCY_FREQUENCY_K400,
51 I2C_SPEED_FAST_PLUS = 0x02,
52 I2C_SPEED_HIGH = 0x03,
55#endif /* ndef DOXYGEN */
56
62#define PERIPH_I2C_NEED_READ_REG
64#define PERIPH_I2C_NEED_WRITE_REG
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 = 0x02,
77 ADC_RES_12BIT = 0xf1,
78 ADC_RES_14BIT = 0xf2,
79 ADC_RES_16BIT = 0xf3
80} adc_res_t;
82#endif /* ndef DOXYGEN */
83
87typedef gpio_t adc_conf_t;
88
92typedef struct {
93 NRF_TWI_Type *dev;
94 gpio_t pin_scl;
95 gpio_t pin_sda;
96 uint8_t ppi;
99
103typedef struct {
104 NRF_SPI_Type *dev;
105 gpio_t sclk;
106 gpio_t mosi;
107 gpio_t miso;
108} spi_conf_t;
109
110#ifdef __cplusplus
111}
112#endif
113
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:96
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:95
gpio_t pin_scl
SCL pin.
Definition periph_cpu.h:94
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:89
gpio_t miso
GPIO used as MISO pin.
Definition periph_cpu.h:864