1import os
2from building import *
3
4cwd = GetCurrentDir()
5
6# add general drivers
7src = Split('''
8board.c
9CubeMX_Config/Src/stm32l4xx_hal_msp.c
10''')
11
12path =  [cwd]
13path += [os.path.join(cwd, 'CubeMX_Config', 'Inc')]
14
15if not GetDepend(['RT_USING_NANO']):
16    if GetDepend(['BSP_USING_KEY']):
17        src += [os.path.join('ports', 'drv_key.c')]
18
19    if GetDepend(['BSP_USING_QSPI_FLASH']):
20        src += [os.path.join('ports', 'drv_qspi_flash.c')]
21
22    if GetDepend(['BSP_USING_FS']):
23        src += [os.path.join('ports', 'drv_filesystem.c')]
24        if GetDepend(['BSP_USING_SPI_FLASH_LITTLEFS']):
25            src += [os.path.join('ports', 'fal', 'fal_spi_flash_sfud_port.c')]
26            path += [os.path.join(cwd, 'ports', 'fal')]
27
28    if GetDepend(['RT_USING_SENSOR']):
29        src += [os.path.join('ports', 'drv_sensors.c')]
30
31    if GetDepend(['BSP_USING_AUDIO']):
32        src += [os.path.join('ports', 'audio', 'drv_es8388.c')]
33        src += [os.path.join('ports', 'audio', 'drv_sound.c')]
34
35    if GetDepend(['BSP_USING_AUDIO_RECORD']):
36        src += [os.path.join('ports', 'audio', 'drv_mic.c')]
37
38    if GetDepend(['BSP_USING_STM32_SDIO']):
39        src += [os.path.join('ports', 'drv_sdio_adapter.c')]
40
41    if GetDepend(['BSP_USING_AUDIO']):
42        path += [os.path.join(cwd, 'ports', 'audio')]
43
44group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
45
46Return('group')
47