Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
3 * 2023 Gunar Schorcht <gunar@schorcht.net>
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#include "macros/units.h"
25
26#ifndef CONFIG_BOARD_HAS_HXTAL
27#define CONFIG_BOARD_HAS_HXTAL 1
28#endif
29
30#ifndef CONFIG_BOARD_HAS_LXTAL
31#define CONFIG_BOARD_HAS_LXTAL 1
32#endif
33
34#ifndef CONFIG_CLOCK_HXTAL
35#define CONFIG_CLOCK_HXTAL MHZ(8)
36#endif
37
38#ifndef SPI_DEV_1_USED
39#define SPI_DEV_1_USED 1
40#endif
41
42#ifndef I2C_DEV_1_USED
43#define I2C_DEV_1_USED 1
44#endif
45
46#include "periph_cpu.h"
47#include "periph_common_conf.h"
48
49#include "cfg_i2c_default.h"
50#include "cfg_spi_default.h"
51#include "cfg_timer_default.h"
52#include "cfg_uart_default.h"
53#include "cfg_usbdev_default.h"
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
63static const adc_conf_t adc_config[] = {
64 { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 },
65 { .pin = GPIO_PIN(PORT_A, 2), .dev = 0, .chan = 2 },
66 { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 3 },
67 { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 10 },
68 { .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 11 },
69 { .pin = GPIO_PIN(PORT_C, 2), .dev = 0, .chan = 12 },
70 { .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 13 },
71 { .pin = GPIO_PIN(PORT_C, 4), .dev = 0, .chan = 14 },
72 { .pin = GPIO_PIN(PORT_C, 5), .dev = 0, .chan = 15 },
73 /* ADC Temperature channel */
74 { .pin = GPIO_UNDEF, .dev = 0, .chan = 16 },
75 /* ADC VREF channel */
76 { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 },
77};
78
79#define ADC_NUMOF ARRAY_SIZE(adc_config)
86static const pwm_conf_t pwm_config[] = {
87 {
88 .dev = TIMER2,
89 .rcu_mask = RCU_APB1EN_TIMER2EN_Msk,
90 .chan = {
91 { .pin = GPIO_PIN(PORT_B, 0), .cc_chan = 2 },
92 { .pin = GPIO_PIN(PORT_B, 1), .cc_chan = 3 },
93 /* unused channels have to be defined by GPIO_UNDEF */
94 { .pin = GPIO_UNDEF, .cc_chan = 0 },
95 { .pin = GPIO_UNDEF, .cc_chan = 1 },
96 },
97 .af = GPIO_AF_OUT_PP,
98 .bus = APB1,
99 },
100#if !defined(MODULE_PERIPH_CAN)
101 {
102 .dev = TIMER3,
103 .rcu_mask = RCU_APB1EN_TIMER3EN_Msk,
104 .chan = {
105 { .pin = GPIO_PIN(PORT_B, 8), .cc_chan = 2 },
106 { .pin = GPIO_PIN(PORT_B, 9), .cc_chan = 3 },
107 /* unused channels have to be defined by GPIO_UNDEF */
108 { .pin = GPIO_UNDEF, .cc_chan = 0 },
109 { .pin = GPIO_UNDEF, .cc_chan = 1 },
110 },
111 .af = GPIO_AF_OUT_PP,
112 .bus = APB1,
113 },
114#endif
115};
116
117#define PWM_NUMOF ARRAY_SIZE(pwm_config)
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_C
port C
Definition periph_cpu.h:49
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
@ GPIO_AF_OUT_PP
alternate function output - push-pull
Definition periph_cpu.h:167
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
Common peripheral configuration for GD32VF103 boards.
ADC device configuration.
Definition periph_cpu.h:379
gpio_t pin
pin connected to the channel
Definition periph_cpu.h:288
PWM device configuration.
mini_timer_t * dev
Timer used.
Unit helper macros.