boards/ikea-tradfri/include/periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Bas Stottelaar <basstottelaar@gmail.com>
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_CONF_H
20 #define PERIPH_CONF_H
21 
22 #include "cpu.h"
23 
24 #include "periph_cpu.h"
25 
26 #include "em_cmu.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #define PERIPH_NUMOF(config) (sizeof(config) / sizeof(config[0]))
36 
41 #ifndef CLOCK_HF
42 #define CLOCK_HF cmuSelect_HFRCO
43 #endif
44 #ifndef CLOCK_CORE_DIV
45 #define CLOCK_CORE_DIV cmuClkDiv_1
46 #endif
47 #ifndef CLOCK_LFA
48 #define CLOCK_LFA cmuSelect_LFRCO
49 #endif
50 #ifndef CLOCK_LFB
51 #define CLOCK_LFB cmuSelect_LFRCO
52 #endif
53 #ifndef CLOCK_LFE
54 #define CLOCK_LFE cmuSelect_LFRCO
55 #endif
56 
61 #define RTC_NUMOF (1U)
62 
67 #define RTT_NUMOF (1U)
68 
69 #define RTT_MAX_VALUE (0xFFFFFFFF)
70 #define RTT_FREQUENCY (1U)
71 
77 static const spi_dev_t spi_config[] = {
78  {
79  .dev = USART1,
80  .mosi_pin = GPIO_PIN(PD, 15),
81  .miso_pin = GPIO_PIN(PD, 14),
82  .clk_pin = GPIO_PIN(PD, 13),
83  .loc = USART_ROUTELOC0_RXLOC_LOC21 |
84  USART_ROUTELOC0_TXLOC_LOC23 |
85  USART_ROUTELOC0_CLKLOC_LOC19,
86  .cmu = cmuClock_USART1,
87  .irq = USART1_RX_IRQn
88  }
89 };
90 
91 #define SPI_NUMOF PERIPH_NUMOF(spi_config)
92 
100 static const timer_conf_t timer_config[] = {
101  {
102  {
103  .dev = TIMER0,
104  .cmu = cmuClock_TIMER0
105  },
106  {
107  .dev = TIMER1,
108  .cmu = cmuClock_TIMER1
109  },
110  .irq = TIMER1_IRQn
111  }
112 };
113 
114 #define TIMER_NUMOF PERIPH_NUMOF(timer_config)
115 #define TIMER_0_ISR isr_timer1
116 
122 static const uart_conf_t uart_config[] = {
123  {
124  .dev = USART0,
125  .rx_pin = GPIO_PIN(PB, 15),
126  .tx_pin = GPIO_PIN(PB, 14),
127  .loc = USART_ROUTELOC0_RXLOC_LOC9 |
128  USART_ROUTELOC0_TXLOC_LOC9,
129  .cmu = cmuClock_USART0,
130  .irq = USART0_RX_IRQn
131  }
132 };
133 
134 #define UART_NUMOF PERIPH_NUMOF(uart_config)
135 #define UART_0_ISR_RX isr_usart0_rx
136 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* PERIPH_CONF_H */
143 
SPI device configuration.
void * dev
UART, USART or LEUART device used.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
NRF_TIMER_Type * dev
timer device
UART device configuration.
USART_TypeDef * dev
USART device used.
Timer configuration.