gd32固件库里这个文件把所有的外围设备驱动全部包含进来,原代码如下:
/**
******************************************************************************
* [url=home.php?mod=space&uid=288409]@file[/url] gd32f1x0_conf.h
* [url=home.php?mod=space&uid=187600]@author[/url] MCU SD
* [url=home.php?mod=space&uid=895143]@version[/url] V1.0
* [url=home.php?mod=space&uid=212281]@date[/url] 6-Sep-2014
* [url=home.php?mod=space&uid=247401]@brief[/url] Library configuration file.
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GD32F1X0_CONF_H
#define __GD32F1X0_CONF_H
/* Run Time Environment will set specific #define for each selected module below */
#include "RTE_Components.h"
#ifdef RTE_DEVICE_STDPERIPH_ADC
#include "gd32f1x0_adc.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_CMP
#include "gd32f1x0_cmp.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_SYSCFG
#include "gd32f1x0_syscfg.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_CEC
#include "gd32f1x0_cec.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_CRC
#include "gd32f1x0_crc.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_DAC
#include "gd32f1x0_dac.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_MCUDBG
#include "gd32f1x0_mcudbg.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_DMA
#include "gd32f1x0_dma.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_EXTI
#include "gd32f1x0_exti.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_TSI
#include "gd32f1x0_tsi.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_FMC
#include "gd32f1x0_fmc.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_GPIO
#include "gd32f1x0_gpio.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_I2C
#include "gd32f1x0_i2c.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_IWDG
#include "gd32f1x0_iwdg.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_PWR
#include "gd32f1x0_pwr.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_RCC
#include "gd32f1x0_rcc.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_RTC
#include "gd32f1x0_rtc.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_SDIO
#include "gd32f1x0_sdio.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_SPI
#include "gd32f1x0_spi.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_TIM
#include "gd32f1x0_timer.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_USART
#include "gd32f1x0_usart.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_WWDG
#include "gd32f1x0_wwdg.h"
#endif
#ifdef RTE_DEVICE_STDPERIPH_FRAMEWORK
#include "gd32f1x0_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
#endif
#endif /* __GD32F1X0_CONF_H */
/******************* (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
如果需要使用USART,那么就定义一个RTE_DEVICE_STDPERIPH_USART就可以了。
但是这样还是不太方便,那么就使用Keil.GD32F1xx_DFP.1.0.4 开发包,让软件来帮我们做这件事吧,只需要在Run-Time Environment选择相应的外设,其它的交给Keil去做吧。如图所示:
不再需要去注释不用的include,不再需要定义宏。
|