# Download BSP sources from GitHub
psoc4_load_bsp(
  NAME CY8CKIT-041S-MAX
  VERSION 2.0.0
)

# Set target MPN
psoc4_set_device(CY8C4149AZI-S598)

# Set target CPU core
psoc4_set_core(CM0P)

set(BSP_SOURCES
  ${BSP_DIR}/cybsp.h
  ${BSP_DIR}/cybsp.c
  ${BSP_DIR}/cybsp_types.h
)
set(BSP_LINK_LIBRARIES
  mtb-pdl-cat2
  mtb-hal-cat2
)

add_definitions(-DCY_USING_HAL)
psoc4_add_component(BSP_DESIGN_MODUS)
psoc4_add_component(CAT2)
psoc4_add_component(PSOC4HAL)
psoc4_add_bsp_startup(psoc4100smax cy8c4xx9)

# Define BSP library
add_library(bsp STATIC EXCLUDE_FROM_ALL ${BSP_SOURCES})
target_link_libraries(bsp PUBLIC ${BSP_LINK_LIBRARIES})

# Define custom recipes for BSP generated sources
psoc4_add_bsp_design_modus(${BSP_DIR}/COMPONENT_BSP_DESIGN_MODUS/design.modus)
psoc4_add_bsp_design_capsense(${BSP_DIR}/COMPONENT_BSP_DESIGN_MODUS/design.cycapsense)
