Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
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
25
extern
"C"
{
26
#endif
27
31
#define CLOCK_CORECLOCK (16000000U)
32
37
#define UART_IRQN (UART0_IRQn)
38
#define SPI_SCKSEL (dev(bus)->PSELSCK)
39
#define SPI_MOSISEL (dev(bus)->PSELMOSI)
40
#define SPI_MISOSEL (dev(bus)->PSELMISO)
41
43
#ifndef DOXYGEN
44
48
#define HAVE_I2C_SPEED_T
49
typedef
enum
{
50
I2C_SPEED_LOW
= 0x01,
51
I2C_SPEED_NORMAL
= TWI_FREQUENCY_FREQUENCY_K100,
52
I2C_SPEED_FAST
= TWI_FREQUENCY_FREQUENCY_K400,
53
I2C_SPEED_FAST_PLUS
= 0x02,
54
I2C_SPEED_HIGH
= 0x03,
55
}
i2c_speed_t
;
57
#endif
/* ndef DOXYGEN */
58
64
#define PERIPH_I2C_NEED_READ_REG
65
66
#define PERIPH_I2C_NEED_WRITE_REG
67
69
#ifndef DOXYGEN
70
74
#define HAVE_ADC_RES_T
75
typedef
enum
{
76
ADC_RES_6BIT
= 0xf0,
77
ADC_RES_8BIT
= 0x00,
78
ADC_RES_10BIT
= 0x02,
79
ADC_RES_12BIT
= 0xf1,
80
ADC_RES_14BIT
= 0xf2,
81
ADC_RES_16BIT
= 0xf3
82
}
adc_res_t
;
84
#endif
/* ndef DOXYGEN */
85
89
typedef
gpio_t
adc_conf_t
;
90
94
typedef
struct
{
95
NRF_TWI_Type *
dev
;
96
gpio_t
pin_scl
;
97
gpio_t
pin_sda
;
98
uint8_t
ppi
;
99
i2c_speed_t
speed;
100
}
i2c_conf_t
;
101
105
typedef
struct
{
106
NRF_SPI_Type *
dev
;
107
gpio_t sclk;
108
gpio_t mosi;
109
gpio_t miso;
110
}
spi_conf_t
;
111
112
#ifdef __cplusplus
113
}
114
#endif
115
116
#endif
/* PERIPH_CPU_H */
117
ADC_RES_6BIT
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition:
adc.h:94
i2c_conf_t::ppi
uint8_t ppi
PPI channel to use.
Definition:
periph_cpu.h:98
i2c_conf_t::dev
NRF_TWI_Type * dev
hardware device
Definition:
periph_cpu.h:95
spi_conf_t::dev
NRF_SPI_Type * dev
SPI device used.
Definition:
periph_cpu.h:106
I2C_SPEED_LOW
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition:
i2c.h:176
I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition:
i2c.h:177
i2c_conf_t::pin_scl
gpio_t pin_scl
SCL pin.
Definition:
periph_cpu.h:96
ADC_RES_14BIT
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition:
adc.h:98
adc_res_t
adc_res_t
Possible ADC resolution settings.
Definition:
adc.h:93
ADC_RES_16BIT
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition:
adc.h:99
i2c_speed_t
i2c_speed_t
Default mapping of I2C bus speed values.
Definition:
i2c.h:175
ADC_RES_8BIT
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition:
adc.h:95
adc_conf_t
gpio_t adc_conf_t
ADC configuration wrapper.
Definition:
periph_cpu.h:315
ADC_RES_10BIT
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition:
adc.h:96
ADC_RES_12BIT
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition:
adc.h:97
i2c_conf_t
I2C configuration options.
Definition:
periph_cpu.h:128
I2C_SPEED_FAST_PLUS
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition:
i2c.h:179
I2C_SPEED_FAST
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition:
i2c.h:178
I2C_SPEED_HIGH
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition:
i2c.h:180
spi_conf_t
SPI configuration structure type.
Definition:
periph_cpu.h:273
i2c_conf_t::pin_sda
gpio_t pin_sda
SDA pin.
Definition:
periph_cpu.h:97
Generated on Tue Nov 24 2020 19:46:49 by
1.8.17