periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  * 2017 OTA keys
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 
20 #ifndef PERIPH_CONF_H
21 #define PERIPH_CONF_H
22 
23 #include "periph_cpu.h"
24 #include "f0/cfg_clock_default.h"
25 #include "cfg_timer_tim2.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 static const uart_conf_t uart_config[] = {
36  {
37  .dev = USART1,
38  .rcc_mask = RCC_APB2ENR_USART1EN,
39  .rx_pin = GPIO_PIN(PORT_A, 15),
40  .tx_pin = GPIO_PIN(PORT_A, 2),
41  .rx_af = GPIO_AF1,
42  .tx_af = GPIO_AF1,
43  .bus = APB2,
44  .irqn = USART1_IRQn
45  }
46 };
47 
48 #define UART_0_ISR (isr_usart1)
49 
50 #define UART_NUMOF ARRAY_SIZE(uart_config)
51 
57 static const pwm_conf_t pwm_config[] = {
58  {
59  .dev = TIM1,
60  .rcc_mask = RCC_APB2ENR_TIM1EN,
61  .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
62  { .pin = GPIO_UNDEF, .cc_chan = 0 },
63  { .pin = GPIO_UNDEF, .cc_chan = 0 },
64  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
65  .af = GPIO_AF2,
66  .bus = APB2
67  },
68  {
69  .dev = TIM14,
70  .rcc_mask = RCC_APB1ENR_TIM14EN,
71  .chan = { { .pin = GPIO_PIN(PORT_B, 1) /* D6 */, .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_AF0,
76  .bus = APB1
77  },
78  {
79  .dev = TIM3,
80  .rcc_mask = RCC_APB1ENR_TIM3EN,
81  .chan = { { .pin = GPIO_PIN(PORT_B, 0) /* D3 */, .cc_chan = 2 },
82  { .pin = GPIO_UNDEF, .cc_chan = 0 },
83  { .pin = GPIO_UNDEF, .cc_chan = 0 },
84  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
85  .af = GPIO_AF1,
86  .bus = APB1
87  },
88 };
89 
90 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
91 
97 static const spi_conf_t spi_config[] = {
98  {
99  .dev = SPI1,
100  .mosi_pin = GPIO_PIN(PORT_B, 5),
101  .miso_pin = GPIO_PIN(PORT_B, 4),
102  .sclk_pin = GPIO_PIN(PORT_B, 3),
103  .cs_pin = GPIO_UNDEF,
104  .mosi_af = GPIO_AF0,
105  .miso_af = GPIO_AF0,
106  .sclk_af = GPIO_AF0,
107  .cs_af = GPIO_AF0,
108  .rccmask = RCC_APB2ENR_SPI1EN,
109  .apbbus = APB2
110  }
111 };
112 
113 #define SPI_NUMOF ARRAY_SIZE(spi_config)
114 
120 static const adc_conf_t adc_config[] = {
121  { GPIO_PIN(PORT_A, 0), 0 },
122  { GPIO_PIN(PORT_A, 1), 1 },
123  { GPIO_PIN(PORT_A, 3), 3 },
124  { GPIO_PIN(PORT_A, 4), 4 },
125  { GPIO_PIN(PORT_A, 7), 7 }
126 };
127 
128 #define ADC_NUMOF ARRAY_SIZE(adc_config)
129 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* PERIPH_CONF_H */
136 
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