blob: 38703d637207de6a84925b046ae892f3bd8b7b0c [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")
declare_args() {
# LCD width in pixels (ex. "320")
pw_lcd_width = ""
# LCD height in pixels (ex. "240")
pw_lcd_height = ""
# LCD backlight pin (ex "4", or "-1" if unused)
pw_lcd_backlight = "-1"
# LCD reset GPIO pin (ex "2", or "-1" if unused)
pw_lcd_rst_pin_num = "-1"
# GPIO Port of LCD CS pin (ex. "A")
pw_lcd_cs_port_char = ""
# GPIO Pin of LDD CS (ex. "10")
pw_lcd_cs_pin_num = ""
# GPIO Port of LCD DC pin (ex. "B")
pw_lcd_dc_port_char = ""
# GPIO Pin of LDD dc (ex. "11")
pw_lcd_dc_pin_num = ""
# SPI bus MISO pin (ex. "12", or "-1" if unusedsable)
pw_spi_miso_pin_num = "-1"
# SPI bus MOSI pin (ex. "13")
pw_spi_mosi_pin_num = ""
# SPI bus clock pin (ex. "14")
pw_spi_clock_pin_num = ""
# framebuffer width in pixels (ex. "320")
pw_nxp_buffer_width = ""
# framebuffer start pixel X coord (ex. "4")
pw_nxp_buffer_start_x = "0"
# framebuffer start pixel Y coord (ex. "4")
pw_nxp_buffer_start_y = "0"
}
config("common_standard_flags") {
cflags = [
"-DLCD_WIDTH=" + pw_lcd_width,
"-DLCD_HEIGHT=" + pw_lcd_height,
"-DTFT_BL=" + pw_lcd_backlight,
"-DTFT_CS=" + pw_lcd_cs_pin_num,
"-DTFT_DC=" + pw_lcd_dc_pin_num,
"-DTFT_RST=" + pw_lcd_rst_pin_num,
"-DTFT_MISO=" + pw_spi_miso_pin_num,
"-DTFT_MOSI=" + pw_spi_mosi_pin_num,
"-DTFT_SCLK=" + pw_spi_clock_pin_num,
]
}
config("common_stm32_flags") {
cflags = [
"-DLCD_WIDTH=" + pw_lcd_width,
"-DLCD_HEIGHT=" + pw_lcd_height,
"-DLCD_BL=" + pw_lcd_backlight,
"-DLCD_CS_PORT_CHAR=" + pw_lcd_cs_port_char,
"-DLCD_CS_PIN_NUM=" + pw_lcd_cs_pin_num,
"-DLCD_DC_PORT_CHAR=" + pw_lcd_dc_port_char,
"-DLCD_DC_PIN_NUM=" + pw_lcd_dc_pin_num,
"-DLCD_RST_PIN_NUM=" + pw_lcd_rst_pin_num,
]
}
config("common_mimxrt595_flags") {
cflags = [
"-DLCD_WIDTH=" + pw_lcd_width,
"-DLCD_HEIGHT=" + pw_lcd_height,
"-DFRAMEBUFFER_WIDTH=" + pw_nxp_buffer_width,
"-DFRAMEBUFFER_START_X=" + pw_nxp_buffer_start_x,
"-DFRAMEBUFFER_START_Y=" + pw_nxp_buffer_start_y,
]
}
config("common_host_flags") {
cflags = [
"-DLCD_WIDTH=" + pw_lcd_width,
"-DLCD_HEIGHT=" + pw_lcd_height,
]
}
pw_source_set("stm32cube") {
public_configs = [ ":common_stm32_flags" ]
deps = [
"$dir_pw_digital_io_stm32cube",
"$dir_pw_display",
"$dir_pw_display_driver_ili9341",
"$dir_pw_spi_stm32cube",
"$dir_pw_sync:borrow",
"$dir_pw_sync:mutex",
"//applications/app_common:app_common.facade",
]
sources = [ "common_stm32cube.cc" ]
}
pw_source_set("stm32") {
deps = [
"$dir_pw_display_driver_null",
"//applications/app_common:app_common.facade",
]
sources = [ "common_stm32.cc" ]
}
pw_source_set("arduino") {
public_configs = [ ":common_standard_flags" ]
deps = [
"$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",
"//applications/app_common:app_common.facade",
]
sources = [ "common_arduino.cc" ]
remove_configs = [ "$dir_pw_build:strict_warnings" ]
}
if (pw_third_party_mcuxpresso_SDK != "") {
pw_source_set("mimxrt595") {
public_configs = [ ":common_mimxrt595_flags" ]
deps = [
"$dir_pw_display",
"$dir_pw_display_driver_mipi_dsi",
"$dir_pw_framebuffer_pool",
"$dir_pw_mipi_dsi_mcuxpresso",
"$pw_third_party_mcuxpresso_SDK",
"//applications/app_common:app_common.facade",
]
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_pw_digital_io_pico",
"$dir_pw_display",
"$dir_pw_log",
"$dir_pw_spi_pico",
"$dir_pw_sync:borrow",
"$dir_pw_sync:mutex",
"//applications/app_common:app_common.facade",
]
pw_source_set("pico_ili9341") {
public_configs = [ ":common_standard_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_standard_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_standard_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_host_flags" ]
deps = [
"$dir_pw_display_driver_imgui",
"$dir_pw_display_imgui",
"//applications/app_common:app_common.facade",
]
sources = [ "common_host_imgui.cc" ]
}
pw_source_set("host_null") {
public_configs = [ ":common_host_flags" ]
deps = [
"$dir_pw_display",
"$dir_pw_display_driver_null",
"//applications/app_common:app_common.facade",
]
sources = [ "common_host_null.cc" ]
}