from building import *

cwd = GetCurrentDir()
src = ['drv_common.c']
path =  [cwd]

if  GetDepend('SOC_RISCV_FAMILY_CH32'):

    if GetDepend('BSP_USING_GPIO'):
        src += ['drv_gpio.c']

    if GetDepend('BSP_USING_UART'):
        if GetDepend('RT_USING_SERIAL_V2'):
            src += ['drv_usart_v2.c']
        else:
            src += ['drv_usart.c']

    if GetDepend('BSP_USING_ADC'):
        src += ['drv_adc.c']

    if GetDepend('BSP_USING_DAC'):
        src += ['drv_dac.c']

    if GetDepend('BSP_USING_I2C'):
        src += ['drv_i2c.c']

    if GetDepend('BSP_USING_SPI'):
        src += ['drv_spi.c']

    if GetDepend('BSP_USING_RTC'):
        src += ['drv_rtc.c']

    if GetDepend('BSP_USING_USBH'):
        src += ['drv_usbh.c']

    if GetDepend('BSP_USING_USBD'):
        src += ['drv_usbd.c']

    if GetDepend('BSP_USING_ETH'):
        src += ['drv_eth.c']
        
    if GetDepend('BSP_USING_IWDT'):
        src += ['drv_iwdt.c']

    if GetDepend('BSP_USING_CAN'):
        src += ['drv_can.c']

    if GetDepend('BSP_USING_PWM'):
        src += ['drv_pwm.c']

    if GetDepend('BSP_USING_CLOCK_TIMER'):
        src += ['drv_timer.c']

    if GetDepend(['BSP_USING_ON_CHIP_FLASH']):
        src += ['drv_flash.c']

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)

Return('group')
