mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
board/sipeed-longan-nano: add periph_pwm support
This commit is contained in:
parent
e9be9b4e75
commit
3bf303f9c6
@ -14,6 +14,7 @@ config BOARD_SEEEDSTUDIO_GD32
|
||||
select CPU_MODEL_GD32VF103VBT6
|
||||
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 = gd32vf103vbt6
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
|
||||
|
@ -45,7 +45,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) | |
|
||||
@ -62,15 +62,17 @@ 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 |
|
||||
|:--------|:---------------|:--------------------|:----------------------|
|
||||
| PA0 | | | BTN0 |
|
||||
| PA9 | USART0 TX | UART_DEV(0) TX | UART TX |
|
||||
| PA10 | USART0 RX | UART_DEV(0) RX | UART RX |
|
||||
| PB0 | | | LED1 |
|
||||
| PB1 | | | LED2 |
|
||||
| PB5 | | | LED0 |
|
||||
| PC13 | | | BTN1 |
|
||||
| MCU Pin | MCU Peripheral | RIOT Peripheral | Board Function | Remark |
|
||||
|:--------|:---------------|:-----------------|:---------------|:-----------------------------|
|
||||
| PA0 | | | BTN0 | |
|
||||
| PA9 | USART0 TX | UART_DEV(0) TX | UART TX | |
|
||||
| PA10 | USART0 RX | UART_DEV(0) RX | UART RX | |
|
||||
| PB0 | | PWM_DEV(0) CH0 | LED1 green | |
|
||||
| PB1 | | PWM_DEV(0) CH1 | LED2 blue | |
|
||||
| PB5 | | | LED0 red | |
|
||||
| PB8 | | PWM_DEV(1) CH0 | | N/A if CAN is used |
|
||||
| PB9 | | PWM_DEV(2) CH1 | | N/A if CAN is used |
|
||||
| PC13 | | | BTN1 | |
|
||||
|
||||
## Flash the board
|
||||
|
||||
|
@ -43,6 +43,44 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name PWM configuration
|
||||
* @{
|
||||
*/
|
||||
static const pwm_conf_t pwm_config[] = {
|
||||
{
|
||||
.dev = TIMER2,
|
||||
.rcu_mask = RCU_APB1EN_TIMER2EN_Msk,
|
||||
.chan = {
|
||||
{ .pin = GPIO_PIN(PORT_B, 0), .cc_chan = 2 },
|
||||
{ .pin = GPIO_PIN(PORT_B, 1), .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,
|
||||
},
|
||||
#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