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