import osconfig
from build_tools import *

# get current directory
pwd = PresentDir()

# The set of source files associated with this SConscript file.

src = Split('''
hal/src/hal_io.c
hal/src/hal_delay.c
hpl/pm/hpl_pm.c
hpl/core/hpl_init.c
hpl/core/hpl_core_m0plus_base.c
hal/utils/src/utils_assert.c
hpl/dmac/hpl_dmac.c
hpl/sysctrl/hpl_sysctrl.c
hpl/gclk/hpl_gclk.c
hal/src/hal_init.c
hal/utils/src/utils_list.c
hal/src/hal_gpio.c
hal/utils/src/utils_event.c
hal/src/hal_sleep.c
hal/src/hal_atomic.c
''')
  

if IsDefined(['BSP_USING_UART']):
    src += ['hal/src/hal_usart_sync.c']
    src += ['hpl/sercom/hpl_sercom.c']
    
    src += ['hal/src/hal_usart_async.c']
    src += ['hal/utils/src/utils_ringbuffer.c']




path = [
    pwd + '/config',
    pwd + '/hal/include',
    pwd + '/hal/utils/include',
    pwd + '/hpl/core',
    pwd + '/hpl/dmac',
    pwd + '/hpl/gclk',
    pwd + '/hpl/pm',
    pwd + '/hpl/port',
    pwd + '/hpl/sysctrl',
    pwd + '/hpl/sercom',
    pwd + '/hri',
    pwd + '/cmsis/core/include'
    ]

CPPDEFINES = ['USE_HAL_DRIVER']
group = AddCodeGroup('hal/lowlevel', src, depend = ['SOC_SERIES_ATSAMD21'], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
