1Import('RTT_ROOT')
2Import('rtconfig')
3from building import *
4
5cwd = GetCurrentDir()
6
7# add the general drivers.
8src = Split("""
9""")
10
11if GetDepend(['RT_USING_PIN']):
12    src += ['drv_gpio.c']
13
14if GetDepend(['RT_USING_SERIAL']):
15    src += ['drv_usart.c']
16
17if GetDepend(['RT_USING_HWTIMER']):
18    src += ['drv_hwtimer.c']
19
20if GetDepend(['RT_USING_PWM']):
21    src += ['drv_pwm.c']
22
23if GetDepend(['RT_USING_SPI']):
24    src += ['drv_spi.c']
25
26if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
27    if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3') or GetDepend('BSP_USING_I2C4'):
28        src += ['drv_soft_i2c.c']
29
30if GetDepend(['RT_USING_ADC']):
31    src += Glob('drv_adc.c')
32
33if GetDepend(['RT_USING_DAC']):
34    src += Glob('drv_dac.c')
35
36if GetDepend(['RT_USING_CAN']):
37    src += ['drv_can.c']
38
39if GetDepend(['RT_USING_PM']):
40    src += ['drv_pm.c']
41    src += ['drv_lptim.c']
42
43if GetDepend('BSP_USING_ONCHIP_RTC'):
44    src += ['drv_rtc.c']
45
46if GetDepend('BSP_USING_ON_CHIP_FLASH'):
47    src += ['drv_flash.c']
48
49if GetDepend(['BSP_USING_WDT']):
50    src += ['drv_wdt.c']
51
52src += ['drv_common.c']
53
54path =  [cwd]
55path += [cwd + '/config']
56
57if GetDepend('BSP_USING_ON_CHIP_FLASH'):
58    path += [cwd + '/drv_flash']
59
60group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
61
62Return('group')
63