package platform.stm32.f7.stm32f769i_discovery

@Build(stage=1)
@BuildArtifactPath(cppflags="-DSTM32F769xx -DUSE_STM32F769I_DISCOVERY")
static module stm32f769i_conf extends third_party.bsp.stmf7cube.stm32f7_conf {
	@IncludeExport(path="", target_name="stm32f7xx_hal_conf.h")
	source "stm32f7xx_hal_conf_1.17.1.h"
}

@Build(stage=1)
@BuildArtifactPath(cppflags="-DSTM32F769xx -DUSE_STM32F769I_DISCOVERY -DUSE_STM32F769I_DISCO_REVB03")
static module stm32f769i_revb03_conf extends third_party.bsp.stmf7cube.stm32f7_conf {
	@IncludeExport(path="", target_name="stm32f7xx_hal_conf.h")
	source "stm32f7xx_hal_conf_1.17.1.h"
}

@DefaultImpl(lcd_mb1166_a03)
abstract module lcd {
}

@BuildDepends(stm32f769i_conf)
@BuildDepends(third_party.bsp.stmf7cube.cube)
module lcd_mb1166_a03 extends lcd {
	@NoRuntime depends stm32f769i_conf
}

@BuildDepends(stm32f769i_revb03_conf)
@BuildDepends(third_party.bsp.stmf7cube.cube)
module lcd_mb1166_a09 extends lcd {
	@AddPrefix("^BUILD/extbld/third_party/bsp/stmf7cube/cube/STM32CubeF7-1.17.1/Drivers/BSP/Components/nt35510")
	source "nt35510.c"

	@NoRuntime depends stm32f769i_revb03_conf
}

@Build(stage=1)
@BuildDepends(third_party.bsp.stmf7cube.cube)
@BuildArtifactPath(cppflags="$(addprefix -I$(EXTERNAL_BUILD_DIR)/third_party/bsp/stmf7cube/cube/STM32CubeF7-1.17.1/,Drivers/BSP/STM32F769I-Discovery)")
static module bsp extends third_party.bsp.st_bsp_api {
	source "clock_config.c"

	@AddPrefix("^BUILD/extbld/third_party/bsp/stmf7cube/cube")
	source "./STM32CubeF7-1.17.1/Projects/STM32F769I-Discovery/Templates/Src/system_stm32f7xx.c"

	/* Cubse LCD call SDRAM_Init, we don't wont that, so tell Cube's LCD do not init SDRAM */
	@DefineMacro("DATA_IN_ExtSDRAM")
	@AddPrefix("^BUILD/extbld/third_party/bsp/stmf7cube/cube/STM32CubeF7-1.17.1/Drivers/BSP/STM32F769I-Discovery")
	source "stm32f769i_discovery.c",
			"stm32f769i_discovery_sdram.c",
			"stm32f769i_discovery_lcd.c",
			"stm32f769i_discovery_audio.c",
			"stm32f769i_discovery_eeprom.c",
			"stm32f769i_discovery_qspi.c",
			"stm32f769i_discovery_sd.c",
			"stm32f769i_discovery_ts.c"

	@NoRuntime depends third_party.bsp.stmf7cube.cube
	@NoRuntime depends lcd
	@NoRuntime depends platform.stm32.stm32cube_compat
	/* OTM8009A is required by stm32f769i_discovery_lcd.c */
	@NoRuntime depends third_party.bsp.stmf7cube.stm32f7_discovery_components
}
