The friendly Operating System for the Internet of Things
boards/opencm904/include/periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 INRIA
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 "periph_cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define CLOCK_HSE (8000000U) /* external oscillator */
33 #define CLOCK_CORECLOCK (72000000U) /* desired core clock frequency */
34 
35 /* the actual PLL values are automatically generated */
36 #define CLOCK_PLL_DIV (1)
37 #define CLOCK_PLL_MUL CLOCK_CORECLOCK / CLOCK_HSE
38 
39 /* AHB, APB1, APB2 dividers */
40 #define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1
41 #define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV1
42 #define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV2
43 
44 /* Bus clocks */
45 #define CLOCK_APB1 (CLOCK_CORECLOCK / 2)
46 #define CLOCK_APB2 (CLOCK_CORECLOCK)
47 
48 /* Flash latency */
49 #define CLOCK_FLASH_LATENCY FLASH_ACR_LATENCY_2 /* for >= 72 MHz */
50 
56 #define ADC_NUMOF (0)
57 
63 #define DAC_NUMOF (0)
64 
70 static const timer_conf_t timer_config[] = {
71  {
72  .dev = TIM2,
73  .max = 0x0000ffff,
74  .rcc_mask = RCC_APB1ENR_TIM2EN,
75  .bus = APB1,
76  .irqn = TIM2_IRQn
77  },
78  {
79  .dev = TIM3,
80  .max = 0x0000ffff,
81  .rcc_mask = RCC_APB1ENR_TIM3EN,
82  .bus = APB1,
83  .irqn = TIM3_IRQn
84  }
85 };
86 
87 #define TIMER_0_ISR isr_tim2
88 #define TIMER_1_ISR isr_tim3
89 
90 #define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
91 
97 static const uart_conf_t uart_config[] = {
98  {
99  .dev = USART2,
100  .rcc_mask = RCC_APB1ENR_USART2EN,
101  .rx_pin = GPIO_PIN(PORT_A, 3),
102  .tx_pin = GPIO_PIN(PORT_A, 2),
103  .bus = APB1,
104  .irqn = USART2_IRQn
105  },
106  {
107  .dev = USART1,
108  .rcc_mask = RCC_APB2ENR_USART1EN,
109  .rx_pin = GPIO_PIN(PORT_B, 7),
110  .tx_pin = GPIO_PIN(PORT_B, 6),
111  .bus = APB2,
112  .irqn = USART1_IRQn
113  },
114  {
115  .dev = USART3,
116  .rcc_mask = RCC_APB1ENR_USART3EN,
117  .rx_pin = GPIO_PIN(PORT_B, 11),
118  .tx_pin = GPIO_PIN(PORT_B, 10),
119  .bus = APB1,
120  .irqn = USART3_IRQn
121  }
122 };
123 
124 #define UART_0_ISR isr_usart2
125 #define UART_1_ISR isr_usart1
126 #define UART_2_ISR isr_usart3
127 
128 #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
129 
135 #define I2C_NUMOF (0)
136 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* PERIPH_CONF_H */
USART_TypeDef * dev
USART device used.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
UART device configuration.
cc2538_gptimer_t * dev
timer device
Timer configuration data.