blob: f47e05d95b4b1716d9b1fc984660d588a2f9095a [file] [log] [blame]
# Copyright 2022 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pi_pico.gni")
import("//build_overrides/pigweed.gni")
import("$dir_pigweed_experimental/third_party/imgui/imgui.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")
import("app_common_vars.gni")
config("common_flags") {
cflags = [
"-DDISPLAY_WIDTH=" + pw_app_common_DISPLAY_WIDTH,
"-DDISPLAY_HEIGHT=" + pw_app_common_DISPLAY_HEIGHT,
"-DDISPLAY_RESET_GPIO=" + pw_app_common_DISPLAY_RESET_GPIO,
"-DBACKLIGHT_GPIO=" + pw_app_common_BACKLIGHT_GPIO,
"-DFRAMEBUFFER_WIDTH=" + pw_app_common_FRAMEBUFFER_WIDTH,
"-DFRAMEBUFFER_START_X=" + pw_app_common_FRAMEBUFFER_START_X,
"-DFRAMEBUFFER_START_Y=" + pw_app_common_FRAMEBUFFER_START_Y,
]
}
config("spi_flags") {
cflags = [
"-DDISPLAY_CS_GPIO=" + pw_app_common_DISPLAY_CS_GPIO,
"-DDISPLAY_DC_GPIO=" + pw_app_common_DISPLAY_DC_GPIO,
"-DSPI_MISO_GPIO=" + pw_app_common_SPI_MISO_GPIO,
"-DSPI_MOSI_GPIO=" + pw_app_common_SPI_MOSI_GPIO,
"-DSPI_CLOCK_GPIO=" + pw_app_common_SPI_CLOCK_GPIO,
]
}
# STM32 uses a macro to concatenate two strings to create a new constant that
# is from the SDK. These "LCD*" constants are substrings in those SDK constants
# and therefore must have specific names.
config("spi_stm32_flags") {
cflags = [
"-DSPI_MISO_GPIO=" + pw_app_common_SPI_MISO_GPIO,
"-DSPI_MOSI_GPIO=" + pw_app_common_SPI_MOSI_GPIO,
"-DSPI_CLOCK_GPIO=" + pw_app_common_SPI_CLOCK_GPIO,
"-DLCD_CS_PORT_CHAR=" + pw_app_common_STM32_DISPLAY_CS_PORT,
"-DLCD_CS_PIN_NUM=" + pw_app_common_DISPLAY_CS_GPIO,
"-DLCD_DC_PORT_CHAR=" + pw_app_common_STM32_DISPLAY_DC_PORT,
"-DLCD_DC_PIN_NUM=" + pw_app_common_DISPLAY_DC_GPIO,
"-DLCD_RST_PIN_NUM=" + pw_app_common_DISPLAY_RESET_GPIO,
]
}
pw_source_set("stm32cube") {
public_configs = [
":common_flags",
":spi_stm32_flags",
]
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_digital_io_stm32cube",
"$dir_pw_display",
"$dir_pw_display_driver_ili9341",
"$dir_pw_framebuffer_pool",
"$dir_pw_spi_stm32cube",
"$dir_pw_sync:borrow",
"$dir_pw_sync:mutex",
]
sources = [ "common_stm32cube.cc" ]
}
pw_source_set("stm32") {
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_display_driver_null",
]
sources = [ "common_stm32.cc" ]
}
pw_source_set("arduino") {
public_configs = [
":common_flags",
":spi_flags",
]
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_digital_io_arduino",
"$dir_pw_display",
"$dir_pw_display_driver_ili9341",
"$dir_pw_spi_arduino",
"$dir_pw_sync:borrow",
"$dir_pw_sync:mutex",
"$dir_pw_third_party/arduino:arduino_core_sources",
]
sources = [ "common_arduino.cc" ]
remove_configs = [ "$dir_pw_build:strict_warnings" ]
}
if (pw_third_party_mcuxpresso_SDK != "") {
pw_source_set("mimxrt595") {
public_configs = [ ":common_flags" ]
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_display",
"$dir_pw_display_driver_mipi_dsi",
"$dir_pw_framebuffer_pool_mcuxpresso",
"$dir_pw_mipi_dsi_mcuxpresso",
"$pw_third_party_mcuxpresso_SDK",
]
sources = [ "common_mimxrt595.cc" ]
}
}
_pico_common_deps = [
"$PICO_ROOT/src/common/pico_base",
"$PICO_ROOT/src/common/pico_stdlib",
"$PICO_ROOT/src/rp2_common/hardware_pwm",
"$PICO_ROOT/src/rp2_common/hardware_spi",
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_digital_io_pico",
"$dir_pw_display",
"$dir_pw_framebuffer_pool",
"$dir_pw_log",
"$dir_pw_spi_pico",
"$dir_pw_sync:borrow",
"$dir_pw_sync:mutex",
]
pw_source_set("pico_ili9341") {
public_configs = [
":common_flags",
":spi_flags",
]
cflags = [ "-DDISPLAY_TYPE_ILI9341" ]
deps = _pico_common_deps
deps += [ "$dir_pw_display_driver_ili9341" ]
sources = [ "common_pico.cc" ]
remove_configs = [ "$dir_pw_build:strict_warnings" ]
}
pw_source_set("pico_st7789") {
public_configs = [
":common_flags",
":spi_flags",
]
cflags = [ "-DDISPLAY_TYPE_ST7789" ]
deps = _pico_common_deps
deps += [ "$dir_pw_display_driver_st7789" ]
sources = [ "common_pico.cc" ]
remove_configs = [ "$dir_pw_build:strict_warnings" ]
}
pw_source_set("pico_st7735") {
public_configs = [
":common_flags",
":spi_flags",
]
cflags = [ "-DDISPLAY_TYPE_ST7735" ]
deps = _pico_common_deps
deps += [ "$dir_pw_display_driver_st7735" ]
sources = [ "common_pico.cc" ]
remove_configs = [ "$dir_pw_build:strict_warnings" ]
}
pw_source_set("host_imgui") {
public_configs = [ ":common_flags" ]
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_display_driver_imgui",
"$dir_pw_display_imgui",
"$dir_pw_framebuffer_pool",
]
sources = [ "common_host_imgui.cc" ]
remove_configs = []
if (host_os == "linux") {
remove_configs += [ "$dir_pw_toolchain/host_clang:linux_sysroot" ]
}
}
pw_source_set("host_null") {
public_configs = [ ":common_flags" ]
deps = [
"$dir_pigweed_experimental/applications/app_common:app_common.facade",
"$dir_pw_display",
"$dir_pw_display_driver_null",
]
sources = [ "common_host_null.cc" ]
}