mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards/seeedstudio-gd32: add periph_pwm support
This commit is contained in:
parent
3bf303f9c6
commit
8ecc80a3ac
@ -14,6 +14,7 @@ config BOARD_SIPEED_LONGAN_NANO
|
||||
select CPU_MODEL_GD32VF103CBT6
|
||||
select BOARD_HAS_HXTAL
|
||||
select BOARD_HAS_LXTAL
|
||||
select HAS_PERIPH_PWM
|
||||
select HAS_PERIPH_TIMER
|
||||
select HAS_PERIPH_UART
|
||||
select HAVE_SAUL_GPIO
|
||||
|
@ -1,6 +1,7 @@
|
||||
CPU_MODEL = gd32vf103cbt6
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
|
||||
|
@ -39,7 +39,7 @@ on-board components:
|
||||
| I2C | 2 x Fast Mode 400 kHz | no |
|
||||
| I2S | 2 | no |
|
||||
| CAN | 2 x CAN 2.0B with up to 1 Mbps | no |
|
||||
| PWM | 6 Channels | no |
|
||||
| PWM | 6 Channels | yes |
|
||||
| USB | 1 x USB FS OTG | no |
|
||||
| Vcc | 3.0V - 3.6V | |
|
||||
| Datasheet | [Datasheet](https://gd32mcu.com/data/documents/datasheet/GD32VF103_Datasheet_Rev1.6.pdf) | |
|
||||
@ -56,13 +56,15 @@ The general pin layout is shown below.
|
||||
The following table shows the connection of the on-board components with the
|
||||
MCU pins and their configuration in RIOT.
|
||||
|
||||
| MCU Pin | MCU Peripheral | RIOT Peripheral | Board Function |
|
||||
|:--------|:---------------|:--------------------|:----------------------|
|
||||
| PA9 | USART0 TX | UART_DEV(0) TX | UART TX |
|
||||
| PA10 | USART0 RX | UART_DEV(0) RX | UART RX |
|
||||
| PB0 | | | LED1 |
|
||||
| PB1 | | | LED2 |
|
||||
| PB5 | | | LED0 |
|
||||
| MCU Pin | MCU Peripheral | RIOT Peripheral | Board Function | Remark |
|
||||
|:--------|:---------------|:-----------------|:---------------|:-----------------------------|
|
||||
| PA1 | | PWM_DEV(0) CH0 | LED1 green | |
|
||||
| PA2 | | PWM_DEV(0) CH1 | LED2 blue | |
|
||||
| PA9 | USART0 TX | UART_DEV(0) TX | UART TX | |
|
||||
| PA10 | USART0 RX | UART_DEV(0) RX | UART RX | |
|
||||
| PB8 | | PWM_DEV(1) CH0 | | N/A if CAN is used |
|
||||
| PB9 | | PWM_DEV(2) CH1 | | N/A if CAN is used |
|
||||
| PC13 | | | LED0 red | |
|
||||
|
||||
## Flashing the Device
|
||||
|
||||
|
@ -43,6 +43,44 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name PWM configuration
|
||||
* @{
|
||||
*/
|
||||
static const pwm_conf_t pwm_config[] = {
|
||||
{
|
||||
.dev = TIMER4,
|
||||
.rcu_mask = RCU_APB1EN_TIMER4EN_Msk,
|
||||
.chan = {
|
||||
{ .pin = GPIO_PIN(PORT_A, 1), .cc_chan = 1 },
|
||||
{ .pin = GPIO_PIN(PORT_A, 2), .cc_chan = 2 },
|
||||
/* unused channels have to be defined by GPIO_UNDEF */
|
||||
{ .pin = GPIO_UNDEF, .cc_chan = 0 },
|
||||
{ .pin = GPIO_UNDEF, .cc_chan = 3 },
|
||||
},
|
||||
.af = GPIO_AF_OUT_PP,
|
||||
.bus = APB1,
|
||||
},
|
||||
#if !defined(MODULE_PERIPH_CAN)
|
||||
{
|
||||
.dev = TIMER3,
|
||||
.rcu_mask = RCU_APB1EN_TIMER3EN_Msk,
|
||||
.chan = {
|
||||
{ .pin = GPIO_PIN(PORT_B, 8), .cc_chan = 2 },
|
||||
{ .pin = GPIO_PIN(PORT_B, 9), .cc_chan = 3 },
|
||||
/* unused channels have to be defined by GPIO_UNDEF */
|
||||
{ .pin = GPIO_UNDEF, .cc_chan = 0 },
|
||||
{ .pin = GPIO_UNDEF, .cc_chan = 1 },
|
||||
},
|
||||
.af = GPIO_AF_OUT_PP,
|
||||
.bus = APB1,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user