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_uart.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_QSPI']):
27    src += ['drv_qspi.c']
28
29if GetDepend(['RT_USING_I2C']):
30    if GetDepend('BSP_USING_I2C0') or GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3'):
31        src += ['drv_i2c.c']
32
33if GetDepend(['BSP_USING_ETH', 'RT_USING_LWIP']):
34    src += ['drv_eth.c']
35
36if GetDepend(['RT_USING_ADC']):
37    src += Glob('drv_adc.c')
38
39if GetDepend(['RT_USING_CAN']):
40    src += ['drv_can.c']
41
42if GetDepend(['RT_USING_PM', 'SOC_SERIES_STM32L4']):
43    src += ['drv_pm.c']
44    src += ['drv_lptim.c']
45
46if GetDepend('BSP_USING_SDRAM'):
47    src += ['drv_sdram.c']
48
49if GetDepend('BSP_USING_LCD'):
50    src += ['drv_lcd.c']
51
52if GetDepend('BSP_USING_LCD_MIPI'):
53    src += ['drv_lcd_mipi.c']
54
55if GetDepend('BSP_USING_ONCHIP_RTC'):
56    src += ['drv_rtc.c']
57
58if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F0']):
59    src += ['drv_flash/drv_flash_f0.c']
60
61if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F1']):
62    src += ['drv_flash/drv_flash_f1.c']
63
64if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F2']):
65    src += ['drv_flash/drv_flash_f2.c']
66
67if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F4']):
68    src += ['drv_flash/drv_flash_f4.c']
69
70if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F7']):
71    src += ['drv_flash/drv_flash_f7.c']
72
73if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32L4']):
74    src += ['drv_flash/drv_flash_l4.c']
75
76if GetDepend('RT_USING_HWCRYPTO'):
77    src += ['drv_crypto.c']
78
79if GetDepend(['BSP_USING_WDT']):
80    src += ['drv_wdt.c']
81
82if GetDepend(['BSP_USING_SDIO']):
83    src += ['drv_sdio.c']
84
85if GetDepend(['BSP_USING_USBD']):
86    src += ['drv_usbd.c']
87
88if GetDepend(['BSP_USING_PULSE_ENCODER']):
89    src += ['drv_pulse_encoder.c']
90
91#src += ['drv_common.c']
92
93path =  [cwd]
94path += [cwd + '/config']
95
96if GetDepend('BSP_USING_ON_CHIP_FLASH'):
97    path += [cwd + '/drv_flash']
98
99group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
100
101Return('group')
102