The friendly Operating System for the Internet of Things
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_
20 #define PERIPH_CPU_
21 
22 #include "periph_cpu_common.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define GPIO_BASE (NRF_GPIO)
33 #define UART_IRQN (UART0_IRQn)
34 #define SPI_SCKSEL (dev(bus)->PSELSCK)
35 #define SPI_MOSISEL (dev(bus)->PSELMOSI)
36 #define SPI_MISOSEL (dev(bus)->PSELMISO)
37 
43 #define HAVE_I2C_SPEED_T
44 typedef enum {
45  I2C_SPEED_LOW = 0x01,
46  I2C_SPEED_NORMAL = TWI_FREQUENCY_FREQUENCY_K100,
47  I2C_SPEED_FAST = TWI_FREQUENCY_FREQUENCY_K400,
49  I2C_SPEED_HIGH = 0x03,
50 } i2c_speed_t;
56 typedef struct {
57  NRF_TWI_Type *dev;
58  uint8_t pin_scl;
59  uint8_t pin_sda;
60  uint8_t ppi;
61 } i2c_conf_t;
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* PERIPH_CPU_ */
68 
I2C configuration options.
uint8_t ppi
PPI channel to use.
NRF_TWI_Type * dev
hardware device
uint8_t pin_scl
SCL pin.
uint8_t pin_sda
SDA pin.