diff --git a/boards/sipeed-longan-nano/Kconfig b/boards/sipeed-longan-nano/Kconfig index c4bae61e5d..0dc33db387 100644 --- a/boards/sipeed-longan-nano/Kconfig +++ b/boards/sipeed-longan-nano/Kconfig @@ -15,6 +15,7 @@ config BOARD_SIPEED_LONGAN_NANO select BOARD_HAS_HXTAL select BOARD_HAS_LXTAL select HAS_PERIPH_ADC + select HAS_PERIPH_DAC select HAS_PERIPH_I2C select HAS_PERIPH_PWM select HAS_PERIPH_SPI diff --git a/boards/sipeed-longan-nano/Makefile.features b/boards/sipeed-longan-nano/Makefile.features index 0fc04f3271..739cdd9de0 100644 --- a/boards/sipeed-longan-nano/Makefile.features +++ b/boards/sipeed-longan-nano/Makefile.features @@ -2,6 +2,7 @@ CPU_MODEL = gd32vf103cbt6 # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_dac FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_spi diff --git a/boards/sipeed-longan-nano/doc.txt b/boards/sipeed-longan-nano/doc.txt index 0614e4d65e..01d87b335e 100644 --- a/boards/sipeed-longan-nano/doc.txt +++ b/boards/sipeed-longan-nano/doc.txt @@ -32,7 +32,7 @@ on-board components: | RTC | 1 x 32-bit counter, 20-bit prescaler | yes | | WDT | 2 x 12-bit counter, 3-bit prescaler | yes | | ADC | 2 x 12-bit units, 16 channels @ 1 Msps | yes | -| DAC | 2 x 12-bit channel | no | +| DAC | 2 x 12-bit channel | yes | | UART | - | yes | | USART | 3 | yes | | SPI | 3 | yes | diff --git a/boards/sipeed-longan-nano/include/periph_conf.h b/boards/sipeed-longan-nano/include/periph_conf.h index 6ae57edeb8..d1fd7780fc 100644 --- a/boards/sipeed-longan-nano/include/periph_conf.h +++ b/boards/sipeed-longan-nano/include/periph_conf.h @@ -77,6 +77,20 @@ static const adc_conf_t adc_config[] = { #define ADC_NUMOF ARRAY_SIZE(adc_config) /** @} */ +/** + * @name DAC configuration + * @{ + */ +static const dac_conf_t dac_config[] = { +#if !CONFIG_SIPEED_LONGAN_NANO_WITH_TFT + { .pin = GPIO_PIN(PORT_A, 4), .chan = 0 }, + { .pin = GPIO_PIN(PORT_A, 5), .chan = 1 }, +}; +#endif /* !CONFIG_SIPEED_LONGAN_NANO_WITH_TFT */ + +#define DAC_NUMOF ARRAY_SIZE(dac_config) +/** @} */ + /** * @name PWM configuration * @{