# 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,
    "-DDISPLAY_TE_GPIO=" + pw_app_common_DISPLAY_TE_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,
  ]
}

config("rp2040_pio_flags") {
  cflags = [
    "-DUSE_PIO=1",
    # Overclock the rp2040 in common_pico.cc
    # "-DOVERCLOCK_250=1",
  ]
}

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",
  "$PICO_ROOT/src/rp2_common/hardware_vreg",
  "$dir_pigweed_experimental/applications/app_common:app_common.facade",
  "$dir_pw_digital_io_rp2040",
  "$dir_pw_display",
  "$dir_pw_framebuffer_pool",
  "$dir_pw_i2c_rp2040",
  "$dir_pw_log",
  "$dir_pw_spi_rp2040",
  "$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_st7789_pio") {
  public_configs = [
    ":common_flags",
    ":spi_flags",
    ":rp2040_pio_flags",
  ]
  cflags = [ "-DDISPLAY_TYPE_ST7789_PIO" ]
  deps = _pico_common_deps
  deps += [
    "$dir_pw_display_driver_st7789",
    "$dir_pw_pixel_pusher_rp2040_pio",
  ]
  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" ]
}
