periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universität Berlin
3  * 2016 Inria
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef PERIPH_CONF_H
22 #define PERIPH_CONF_H
23 
24 /* HSE available on this board */
25 #ifndef CONFIG_BOARD_HAS_HSE
26 #define CONFIG_BOARD_HAS_HSE 1
27 #endif
28 
29 /* This board provides an LSE */
30 #ifndef CONFIG_BOARD_HAS_LSE
31 #define CONFIG_BOARD_HAS_LSE 1
32 #endif
33 
34 #include "periph_cpu.h"
35 #include "f0/cfg_clock_default.h"
36 #include "cfg_i2c1_pb8_pb9.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
46 static const timer_conf_t timer_config[] = {
47  {
48  .dev = TIM1,
49  .max = 0x0000ffff,
50  .rcc_mask = RCC_APB2ENR_TIM1EN,
51  .bus = APB2,
52  .irqn = TIM1_CC_IRQn
53  }
54 };
55 
56 #define TIMER_0_ISR isr_tim1_cc
57 
58 
59 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
60 
66 static const uart_conf_t uart_config[] = {
67  {
68  .dev = USART2,
69  .rcc_mask = RCC_APB1ENR_USART2EN,
70  .rx_pin = GPIO_PIN(PORT_A, 3),
71  .tx_pin = GPIO_PIN(PORT_A, 2),
72  .rx_af = GPIO_AF1,
73  .tx_af = GPIO_AF1,
74  .bus = APB1,
75  .irqn = USART2_IRQn
76  },
77  {
78  .dev = USART1,
79  .rcc_mask = RCC_APB2ENR_USART1EN,
80  .rx_pin = GPIO_PIN(PORT_A, 10),
81  .tx_pin = GPIO_PIN(PORT_A, 9),
82  .rx_af = GPIO_AF1,
83  .tx_af = GPIO_AF1,
84  .bus = APB2,
85  .irqn = USART1_IRQn
86  },
87  {
88  .dev = USART3,
89  .rcc_mask = RCC_APB1ENR_USART3EN,
90  .rx_pin = GPIO_PIN(PORT_C, 11),
91  .tx_pin = GPIO_PIN(PORT_C, 10),
92  .rx_af = GPIO_AF1,
93  .tx_af = GPIO_AF1,
94  .bus = APB1,
95  .irqn = USART3_4_IRQn
96  }
97 };
98 
99 #define UART_0_ISR (isr_usart2)
100 #define UART_1_ISR (isr_usart1)
101 #define UART_2_ISR (isr_usart3_8)
102 
103 #define UART_NUMOF ARRAY_SIZE(uart_config)
104 
110 static const pwm_conf_t pwm_config[] = {
111  {
112  .dev = TIM3,
113  .rcc_mask = RCC_APB1ENR_TIM3EN,
114  .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0 },
115  { .pin = GPIO_PIN(PORT_B, 5) /* D4 */, .cc_chan = 1 },
116  { .pin = GPIO_UNDEF, .cc_chan = 0 },
117  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
118  .af = GPIO_AF1,
119  .bus = APB1
120  },
121  {
122  .dev = TIM15,
123  .rcc_mask = RCC_APB2ENR_TIM15EN,
124  .chan = { { .pin = GPIO_PIN(PORT_B, 14), .cc_chan = 0 },
125  { .pin = GPIO_PIN(PORT_B, 15), .cc_chan = 1 },
126  { .pin = GPIO_UNDEF, .cc_chan = 0 },
127  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
128  .af = GPIO_AF1,
129  .bus = APB2
130  }
131 };
132 
133 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
134 
140 static const adc_conf_t adc_config[] = {
141  { GPIO_PIN(PORT_A, 0), 0 },
142  { GPIO_PIN(PORT_A, 1), 1 },
143  { GPIO_PIN(PORT_A, 4), 4 },
144  { GPIO_PIN(PORT_B, 0), 8 },
145  { GPIO_PIN(PORT_C, 1), 11 },
146  { GPIO_PIN(PORT_C, 0), 10 }
147 };
148 
149 #define ADC_NUMOF ARRAY_SIZE(adc_config)
150 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif /* PERIPH_CONF_H */
157 
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
pwm_conf_t::dev
mini_timer_t * dev
Timer used.
Definition: periph_cpu_common.h:154
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
pwm_conf_t
PWM device configuration.
Definition: periph_cpu_common.h:153
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition: periph_cpu_common.h:52
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
GPIO_AF1
@ GPIO_AF1
use alternate function 1
Definition: periph_cpu_common.h:87
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
adc_conf_t
ADC device configuration.
Definition: periph_cpu.h:74
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
APB2
@ APB2
APB2 bus.
Definition: periph_cpu.h:177
cfg_clock_default.h
Default clock configuration for STM32F0.
timer_conf_t::dev
uint32_t dev
Address of timer base.
Definition: periph_cpu.h:112
cfg_i2c1_pb8_pb9.h
Common configuration for STM32 I2C.
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176