1# RT-Thread building script for component
2Import('RTT_ROOT')
3Import('rtconfig')
4from building import *
5
6cwd = GetCurrentDir()
7
8# add the general drivers.
9src = Split("""
10""")
11
12if GetDepend(['RT_USING_PIN']):
13    src += ['drv_gpio.c']
14
15if GetDepend(['RT_USING_SERIAL']):
16    src += ['drv_usart.c']
17
18if GetDepend(['BSP_USING_PWM']):
19    src += ['drv_pwm.c']
20
21if GetDepend(['BSP_USING_HWTIMER']):
22    src += ['drv_hwtimer.c']
23
24if GetDepend(['BSP_USING_SPI']):
25    src += ['drv_spi.c']
26
27if GetDepend(['BSP_USING_ETH', 'RT_USING_LWIP']):
28    src += ['drv_eth.c']
29
30if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
31    if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3') or GetDepend('BSP_USING_I2C4'):
32        src += ['drv_soft_i2c.c']
33
34if GetDepend(['BSP_USING_ADC']):
35    src += Glob('drv_adc.c')
36
37if GetDepend('BSP_USING_SRAM'):
38    src += ['drv_sram.c']
39
40if GetDepend('BSP_USING_RTC'):
41    src += ['drv_rtc.c']
42
43if GetDepend('BSP_USING_ON_CHIP_FLASH'):
44    src += ['drv_flash.c']
45
46if GetDepend(['BSP_USING_WDT']):
47    src += ['drv_wdt.c']
48
49if GetDepend(['BSP_USING_CAN']):
50    src += ['drv_can.c']
51
52if GetDepend(['BSP_USING_SDIO']):
53    src += ['drv_sdio.c']
54
55CPPPATH = [cwd]
56
57group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
58
59Return('group')
60