Add diagnostic screens to colorlcd radios (#7140)
[opentx.git] / radio / src / targets / horus / CMakeLists.txt
blob987e4e81fc77fb1a08c287a29c247db3394f3aeb
1 option(DISK_CACHE "Enable SD card disk cache" ON)
2 option(UNEXPECTED_SHUTDOWN "Enable the Unexpected Shutdown screen" ON)
3 option(PXX1 "PXX1 protocol support" ON)
4 option(PXX2 "PXX2 protocol support" OFF)
5 option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" ON)
7 set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)")
8 set(CPU_TYPE STM32F4)
9 set(HSE_VALUE 12000000)
10 set(SDCARD YES)
11 set(EEPROM SDCARD)
12 set(HAPTIC YES)
13 set(GUI_DIR 480x272)
14 set(NAVIGATION_TYPE horus)
15 set(TARGET_DIR horus)
16 set(LINKER_SCRIPT targets/horus/stm32f4_flash.ld)
17 set(RTC_BACKUP_RAM YES)
18 set(LUA YES)
19 set(PPM_LIMITS_SYMETRICAL YES)
20 set(USB_SERIAL ON CACHE BOOL "Enable USB serial (CDC)")
22 # for size report script
23 set(CPU_TYPE_FULL STM32F429xI)
24 set(SIZE_TARGET_MEM_DEFINE "MEM_SIZE_SDRAM2=8192")
26 if(SPLASH STREQUAL OFF)
27   message(FATAL_ERROR "Option SPLASH=OFF not supported on Horus")
28 endif()
30 if (PCB STREQUAL X10)
31   set(PCBREV "STD" CACHE STRING "PCB Revision")
32   add_definitions(-DPCBX10)
33   add_definitions(-DSOFTWARE_VOLUME)
34   set(TARGET_SRC
35     ${TARGET_SRC}
36     ../common/arm/stm32/audio_dac_driver.cpp
37     ../common/arm/stm32/adc_driver.cpp
38     ../common/arm/stm32/sticks_pwm_driver.cpp
39     )
40   set(BITMAPS_TARGET x10_bitmaps)
41   set(FONTS_TARGET x10_fonts)
42   set(LCD_DRIVER lcd_driver.cpp)
43   set(LUA_EXPORT lua_export_x10)
44   set(INTERNAL_GPS OFF)
45   if (PCBREV STREQUAL EXPRESS)
46     set(FLAVOUR x10express)
47     option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF)
48     option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON)
49     set(BLUETOOTH ON)
50     add_definitions(-DHARDWARE_POWER_MANAGEMENT_UNIT)
51   elseif (PCBREV STREQUAL T16)
52     set(FLAVOUR t16)
53     set(LUA_EXPORT lua_export_t16)
54     add_definitions(-DRADIO_T16)
55     option(INTERNAL_MODULE_MULTI "Support for MULTI internal module" OFF)
56     option(BLUETOOTH "Support for bluetooth module" OFF)
57   else()
58     set(FLAVOUR x10)
59     option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" ON)
60     option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" OFF)
61     set(BLUETOOTH ON)
62   endif()
63 elseif (PCB STREQUAL X12S)
64   option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" ON)
65   option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" OFF)
66   set(FLAVOUR x12s)
67   set(BLUETOOTH ON)
68   set(PCBREV "13" CACHE STRING "PCB Revision")
69   if(${PCBREV} GREATER 10)
70     option(INTERNAL_GPS "Internal GPS installed" YES)
71   else()
72     option(INTERNAL_GPS "Internal GPS installed" NO)
73     if(NOT INTERNAL_GPS)
74       message("Horus: Internal GPS is optional, use INTERNAL_GPS=YES option to enable it")
75     endif()
76   endif()
77   set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
78   add_definitions(-DPCBX12S)
79   set(TARGET_SRC
80     ${TARGET_SRC}
81     audio_spi_driver.cpp
82     x12s_adc_driver.cpp
83     gps_driver.cpp
84     )
85   set(BITMAPS_TARGET x12s_bitmaps)
86   set(FONTS_TARGET x12s_fonts)
87   set(LCD_DRIVER lcd_driver.cpp)
88   set(LUA_EXPORT lua_export_x12s)
89 endif()
91 add_definitions(-DPCBREV=${PCBREV})
92 add_definitions(-DPCBREV_${PCBREV})
94 set(RADIO_DEPENDENCIES
95   ${RADIO_DEPENDENCIES}
96   ${BITMAPS_TARGET}
97   )
99 set(FIRMWARE_DEPENDENCIES datacopy)
101 add_definitions(-DPCBHORUS -DSTM32F429_439xx -DSDRAM -DCOLORLCD)
102 add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
103 add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
104 add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
106 if(NOT UNEXPECTED_SHUTDOWN)
107   add_definitions(-DNO_UNEXPECTED_SHUTDOWN)
108 endif()
110 if(INTERNAL_MODULE_PXX1)
111   add_definitions(-DHARDWARE_INTERNAL_MODULE)
112   add_definitions(-DINTERNAL_MODULE_PXX1)
113 endif()
115 if(INTERNAL_MODULE_PXX2)
116   set(PXX2 ON)
117   add_definitions(-DHARDWARE_INTERNAL_MODULE)
118   add_definitions(-DINTERNAL_MODULE_PXX2)
119   if (NOT PCBREV STREQUAL EXPRESS)
120     set(ACCESS_LIB ON)
121     add_definitions(-DACCESS_LIB)
122   endif()
123 endif()
125 if(INTERNAL_MODULE_MULTI)
126   add_definitions(-DHARDWARE_INTERNAL_MODULE)
127   add_definitions(-DINTERNAL_MODULE_MULTI)
128 endif()
130 include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
132 file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/themes/*.cpp)
133 file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/layouts/*.cpp)
134 file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/widgets/*.cpp)
135 set(GUI_SRC
136   ${GUI_SRC}
137   bitmapbuffer.cpp
138   curves.cpp
139   bitmaps.cpp
140   radio_sdmanager.cpp
141   radio_hardware.cpp
142   radio_diagkeys.cpp
143   radio_diaganas.cpp
144   model_inputs.cpp
145   model_mixes.cpp
146   model_curves.cpp
147   view_channels.cpp
148   view_logical_switches.cpp
149   view_about.cpp
150   view_text.cpp
151   screens_setup.cpp
152   theme.cpp
153   topbar.cpp
154   layout.cpp
155   widget.cpp
156   menus.cpp
157   ${THEMES_SRC}
158   ${LAYOUTS_SRC}
159   ${WIDGETS_SRC}
160   rle.cpp
161   )
163 if(PXX2 OR LUA OR MULTIMODULE)
164   set(GUI_SRC ${GUI_SRC} radio_tools.cpp)
165 endif()
167 if(PXX2 OR MULTIMODULE)
168   set(GUI_SRC ${GUI_SRC} radio_spectrum_analyser.cpp)
169 endif()
171 if(PXX2)
172   set(GUI_SRC ${GUI_SRC} radio_power_meter.cpp)
173 endif()
175 if(DISK_CACHE)
176   set(SRC ${SRC} disk_cache.cpp)
177   add_definitions(-DDISK_CACHE)
178 endif()
180 if(INTERNAL_GPS)
181   set(SRC ${SRC} gps.cpp)
182   add_definitions(-DINTERNAL_GPS)
183   message("Horus: Internal GPS enabled")
184 endif()
186 set(GVAR_SCREEN model_gvars.cpp)
188 set(TARGET_SRC
189   ${TARGET_SRC}
190   led_driver.cpp
191   extmodule_driver.cpp
192   trainer_driver.cpp
193   ../common/arm/stm32/heartbeat_driver.cpp
194   ../common/arm/stm32/timers_driver.cpp
195   ../common/arm/stm32/intmodule_serial_driver.cpp
196   ../common/arm/stm32/rotary_encoder_driver.cpp
197   )
199 if(BLUETOOTH)
200   add_definitions(-DBLUETOOTH)
201   set(TARGET_SRC ${TARGET_SRC} ../common/arm/stm32/bluetooth_driver.cpp)
202   set(SRC ${SRC} bluetooth.cpp)
203 endif()
205 set(FIRMWARE_TARGET_SRC
206   ${FIRMWARE_TARGET_SRC}
207   ${LCD_DRIVER}
208   board.cpp
209   backlight_driver.cpp
210   pwr_driver.cpp
211   sdram_driver.c
212   startup_stm32f42_43xxx.s
213   ../common/arm/stm32/sdio_sd.c
214   ../common/arm/loadboot.cpp
215   )
217 set(SRC
218   ${SRC}
219   io/frsky_firmware_update.cpp
220   io/multi_firmware_update.cpp
221   )
223 set(STM32LIB_SRC
224   STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c
225   STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c
226   STM32F4xx_StdPeriph_Driver/src/stm32f4xx_ltdc.c
227   STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c
228   STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma2d.c
229   )
231 if(PYTHONINTERP_FOUND)
232   add_custom_command(
233     OUTPUT ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
234     WORKING_DIRECTORY ${RADIO_DIRECTORY}/src
235     COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DCOLORLCD -DBACKUP -Itargets/horus > ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
236     DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py
237     )
238   add_custom_target(datacopy
239     DEPENDS ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
240     )
241 endif()