periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 OTA keys
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 #include "f0/cfg_clock_default.h"
24 #include "cfg_timer_tim2.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const uart_conf_t uart_config[] = {
35  {
36  .dev = USART2,
37  .rcc_mask = RCC_APB1ENR_USART2EN,
38  .rx_pin = GPIO_PIN(PORT_A, 15),
39  .tx_pin = GPIO_PIN(PORT_A, 2),
40  .rx_af = GPIO_AF1,
41  .tx_af = GPIO_AF1,
42  .bus = APB1,
43  .irqn = USART2_IRQn
44  },
45  {
46  .dev = USART1,
47  .rcc_mask = RCC_APB2ENR_USART1EN,
48  .rx_pin = GPIO_PIN(PORT_A, 10),
49  .tx_pin = GPIO_PIN(PORT_A, 9),
50  .rx_af = GPIO_AF1,
51  .tx_af = GPIO_AF1,
52  .bus = APB2,
53  .irqn = USART1_IRQn
54  }
55 };
56 
57 #define UART_0_ISR (isr_usart2)
58 #define UART_1_ISR (isr_usart1)
59 
60 #define UART_NUMOF ARRAY_SIZE(uart_config)
61 
67 static const pwm_conf_t pwm_config[] = {
68  {
69  .dev = TIM1,
70  .rcc_mask = RCC_APB2ENR_TIM1EN,
71  .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
72  { .pin = GPIO_UNDEF, .cc_chan = 0 },
73  { .pin = GPIO_UNDEF, .cc_chan = 0 },
74  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
75  .af = GPIO_AF2,
76  .bus = APB2
77  },
78  {
79  .dev = TIM14,
80  .rcc_mask = RCC_APB1ENR_TIM14EN,
81  .chan = { { .pin = GPIO_PIN(PORT_B, 1) /* D6 */, .cc_chan = 0 },
82  { .pin = GPIO_UNDEF, .cc_chan = 0 },
83  { .pin = GPIO_UNDEF, .cc_chan = 0 },
84  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
85  .af = GPIO_AF0,
86  .bus = APB1
87  },
88  {
89  .dev = TIM3,
90  .rcc_mask = RCC_APB1ENR_TIM3EN,
91  .chan = { { .pin = GPIO_PIN(PORT_B, 0) /* D3 */, .cc_chan = 2 },
92  { .pin = GPIO_UNDEF, .cc_chan = 0 },
93  { .pin = GPIO_UNDEF, .cc_chan = 0 },
94  { .pin = GPIO_UNDEF, .cc_chan = 0 }},
95  .af = GPIO_AF1,
96  .bus = APB1
97  }
98 };
99 
100 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
101 
107 static const spi_conf_t spi_config[] = {
108  {
109  .dev = SPI1,
110  .mosi_pin = GPIO_PIN(PORT_B, 5),
111  .miso_pin = GPIO_PIN(PORT_B, 4),
112  .sclk_pin = GPIO_PIN(PORT_B, 3),
113  .cs_pin = GPIO_UNDEF,
114  .mosi_af = GPIO_AF0,
115  .miso_af = GPIO_AF0,
116  .sclk_af = GPIO_AF0,
117  .cs_af = GPIO_AF0,
118  .rccmask = RCC_APB2ENR_SPI1EN,
119  .apbbus = APB2
120  }
121 };
122 
123 #define SPI_NUMOF ARRAY_SIZE(spi_config)
124 
130 static const adc_conf_t adc_config[] = {
131  { GPIO_PIN(PORT_A, 0), 0 },
132  { GPIO_PIN(PORT_A, 1), 1 },
133  { GPIO_PIN(PORT_A, 3), 3 },
134  { GPIO_PIN(PORT_A, 4), 4 },
135  { GPIO_PIN(PORT_A, 7), 7 }
136 };
137 
138 #define ADC_NUMOF ARRAY_SIZE(adc_config)
139 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif /* PERIPH_CONF_H */
146 
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
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.
GPIO_AF2
@ GPIO_AF2
use alternate function 2
Definition: periph_cpu_common.h:88
GPIO_AF0
@ GPIO_AF0
use alternate function 0
Definition: periph_cpu_common.h:86
cfg_timer_tim2.h
Common configuration for STM32 Timer peripheral based on TIM2.
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176