nrf51/include/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 
47 #define HAVE_I2C_SPEED_T
48 typedef enum {
49  I2C_SPEED_LOW = 0x01,
50  I2C_SPEED_NORMAL = TWI_FREQUENCY_FREQUENCY_K100,
51  I2C_SPEED_FAST = TWI_FREQUENCY_FREQUENCY_K400,
53  I2C_SPEED_HIGH = 0x03,
54 } i2c_speed_t;
62 #define PERIPH_I2C_NEED_READ_REG
63 
64 #define PERIPH_I2C_NEED_WRITE_REG
65 
71 #define HAVE_ADC_RES_T
72 typedef enum {
73  ADC_RES_6BIT = 0xf0,
74  ADC_RES_8BIT = 0x00,
75  ADC_RES_10BIT = 0x02,
76  ADC_RES_12BIT = 0xf1,
77  ADC_RES_14BIT = 0xf2,
78  ADC_RES_16BIT = 0xf3
79 } adc_res_t;
85 typedef struct {
86  NRF_TWI_Type *dev;
87  uint8_t pin_scl;
88  uint8_t pin_sda;
89  uint8_t ppi;
90  i2c_speed_t speed;
91 } i2c_conf_t;
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* PERIPH_CPU_H */
98 
I2C configuration options.
uint8_t ppi
PPI channel to use.
ADC resolution: 12 bit (not supported)
NRF_TWI_Type * dev
hardware device
ADC resolution: 14 bit (not supported)
ADC resolution: 10 bit.
ADC resolution: 16 bit (not supported)
ADC resolution: 8 bit.
ADC resolution: 6 bit (not supported)
uint8_t pin_scl
SCL pin.
uint8_t pin_sda
SDA pin.