diff --git a/.travis.yml b/.travis.yml index 2a4d61081..f7e9021f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,4 +24,4 @@ install: - sudo dpkg --install gcc-avr_1%3a4.8-2.1_amd64.deb avr-libc_1%3a1.8.0-4.1_all.deb libmpfr4_3.1.2-1_amd64.deb binutils-avr_2.23.1-2.1_amd64.deb libmpc3_1.0.1-1ubuntu1_amd64.deb script: - - ./radio/util/commit-tests.sh . + - ./tools/commit-tests.sh . diff --git a/companion/src/firmwareinterface.cpp b/companion/src/firmwareinterface.cpp index 4f11fcbd4..889cd427a 100644 --- a/companion/src/firmwareinterface.cpp +++ b/companion/src/firmwareinterface.cpp @@ -130,10 +130,12 @@ QString FirmwareInterface::seekLabel(const QString & label) QString FirmwareInterface::getFlavour() const { - if (flavour == "opentx-x9dp") - return "opentx-taranis-plus"; - else if (flavour == "opentx-x9d") - return "opentx-taranis"; + if (flavour == "opentx-taranis-x9e") + return "opentx-x9e"; + else if (flavour == "opentx-x9dp" || flavour == "opentx-taranis-plus") + return "opentx-x9d+"; + else if (flavour == "opentx-taranis") + return "opentx-x9d"; else return flavour; } diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 824444f0c..e57a45373 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -1,7 +1,7 @@ include(CMakeForceCompiler) include(Bitmaps) -set(PCB "TARANIS" CACHE STRING "Radio type") +set(PCB "X9D+" CACHE STRING "Radio type") set(TRANSLATIONS "EN" CACHE STRING "Radio language") option(HELI "Heli menu" ON) option(FLIGHT_MODES "Flight Modes" ON) @@ -53,9 +53,9 @@ set(M128_VARIANT 32768) set(FIRMWARE_DEPENDENCIES firmware_translations) set(9X_GUI_SRC - menu_model_inputs_mixes.cpp - menu_general_diagkeys.cpp - menu_general_diaganas.cpp + model_inputs_mixes.cpp + radio_diagkeys.cpp + radio_diaganas.cpp ) set(FATFS_SRC @@ -66,7 +66,7 @@ set(FATFS_SRC if(PCB STREQUAL HORUS) include(targets/horus/CMakeLists.txt) -elseif(PCB STREQUAL TARANIS) +elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7D) include(targets/taranis/CMakeLists.txt) elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X) include(targets/sky9x/CMakeLists.txt) @@ -78,11 +78,11 @@ elseif(PCB STREQUAL 9X2561) string(TOLOWER ${PCB} FLAVOUR) set(EEPROM EEPROM_RLC) add_definitions(-DEEPROM_VARIANT=${M2561_VARIANT}) - set(GUI_DIR 9x) + set(GUI_DIR 128x64) set(TARGET_DIR 9x) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM2561) - set(TARGET_SRC ${TARGET_SRC} board_stock.cpp) + set(TARGET_SRC ${TARGET_SRC} board.cpp) set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC}) if(SP22) add_definitions(-DSP22) @@ -99,6 +99,8 @@ else() message(FATAL_ERROR "Unknown PCB '${PCB}'") endif() +include_directories(gui gui/${GUI_DIR}) + if(NOT PCB STREQUAL 9XR AND NOT PCB STREQUAL 9XRPRO) option(DBLKEYS "Double Keys" ON) if(DBLKEYS) @@ -124,6 +126,8 @@ else() include(targets/common/avr/CMakeLists.txt) endif() +include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR}) + foreach(LANGUAGE ${GUI_LANGUAGES}) string(TOUPPER ${LANGUAGE} LANGUAGE_CAPITALIZED) if(TRANSLATIONS STREQUAL ${LANGUAGE_CAPITALIZED}) @@ -158,7 +162,6 @@ set(GUI_SRC lcd.cpp splash.cpp fonts.cpp - helpers.cpp navigation.cpp popups.cpp widgets.cpp @@ -168,16 +171,16 @@ set(GUI_SRC set(GUI_SRC ${GUI_SRC} menu_model.cpp - menu_model_select.cpp - menu_model_setup.cpp - menu_model_limits.cpp - menu_model_logical_switches.cpp + model_select.cpp + model_setup.cpp + model_outputs.cpp + model_logical_switches.cpp model_special_functions.cpp - menu_model_telemetry.cpp - menu_general.cpp + model_telemetry.cpp + menu_radio.cpp radio_setup.cpp - menu_general_trainer.cpp - menu_general_version.cpp + radio_trainer.cpp + radio_version.cpp radio_calibration.cpp view_main.cpp view_statistics.cpp @@ -198,7 +201,7 @@ endif() if(TEMPLATES) add_definitions(-DTEMPLATES) set(SRC ${SRC} templates.cpp) - set(GUI_SRC ${GUI_SRC} menu_model_templates.cpp) + set(GUI_SRC ${GUI_SRC} model_templates.cpp) endif() if(NOT LUA STREQUAL NO) @@ -207,7 +210,7 @@ if(NOT LUA STREQUAL NO) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} ${LUA_EXPORT}) if(LUA STREQUAL YES) add_definitions(-DLUA_MODEL_SCRIPTS) - set(GUI_SRC ${GUI_SRC} menu_model_custom_scripts.cpp) + set(GUI_SRC ${GUI_SRC} model_custom_scripts.cpp) endif() set(SRC ${SRC} lua/interface.cpp lua/api_general.cpp lua/api_lcd.cpp lua/api_model.cpp) set(LUA_SRC lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c @@ -221,17 +224,17 @@ endif() if(HELI) add_definitions(-DHELI) - set(GUI_SRC ${GUI_SRC} menu_model_heli.cpp) + set(GUI_SRC ${GUI_SRC} model_heli.cpp) endif() if(FLIGHT_MODES) add_definitions(-DFLIGHT_MODES) - set(GUI_SRC ${GUI_SRC} menu_model_flightmodes.cpp) + set(GUI_SRC ${GUI_SRC} model_flightmodes.cpp) endif() if(CURVES) add_definitions(-DCURVES) - set(GUI_SRC ${GUI_SRC} menu_model_curves.cpp) + set(GUI_SRC ${GUI_SRC} model_curves.cpp) endif() if(GVARS) @@ -273,7 +276,7 @@ if(SDCARD) add_definitions(-DSDCARD) include_directories(${FATFS_DIR} ${FATFS_DIR}/option) set(SRC ${SRC} sdcard.cpp rtc.cpp logs.cpp) - set(GUI_SRC ${GUI_SRC} menu_general_sdmanager.cpp) + set(GUI_SRC ${GUI_SRC} radio_sdmanager.cpp) set(FIRMWARE_SRC ${FIRMWARE_SRC} ${FATFS_SRC}) endif() @@ -399,7 +402,7 @@ endif() set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CPP_FLAGS} -g") set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections") - if(PCB STREQUAL TARANIS) + if(PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E) add_subdirectory(targets/${TARGET_DIR}/bootloader) include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/${TARGET_DIR}/bootloader) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader) diff --git a/radio/src/bitmaps/9x/CMakeLists.txt b/radio/src/bitmaps/128x64/CMakeLists.txt similarity index 72% rename from radio/src/bitmaps/9x/CMakeLists.txt rename to radio/src/bitmaps/128x64/CMakeLists.txt index 6b8d854dd..2b5f7469b 100644 --- a/radio/src/bitmaps/9x/CMakeLists.txt +++ b/radio/src/bitmaps/128x64/CMakeLists.txt @@ -1,4 +1,4 @@ add_bitmaps_target(9x_xbm_1bit ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.xbm 128 1bit 4) add_bitmaps_target(9x_fonts_1bit ${RADIO_SRC_DIRECTORY}/fonts/std/*.png 128 "") -add_bitmaps_target(9x_bitmaps ${RADIO_SRC_DIRECTORY}/bitmaps/9x/*.png 128 1bit) +add_bitmaps_target(9x_bitmaps ${RADIO_SRC_DIRECTORY}/bitmaps/128x64/*.png 128 1bit) add_dependencies(9x_bitmaps 9x_fonts_1bit 9x_xbm_1bit) diff --git a/radio/src/bitmaps/9x/about.png b/radio/src/bitmaps/128x64/about.png similarity index 100% rename from radio/src/bitmaps/9x/about.png rename to radio/src/bitmaps/128x64/about.png diff --git a/radio/src/bitmaps/9x/asterisk.png b/radio/src/bitmaps/128x64/asterisk.png similarity index 100% rename from radio/src/bitmaps/9x/asterisk.png rename to radio/src/bitmaps/128x64/asterisk.png diff --git a/radio/src/bitmaps/9x/asterisk.xbm b/radio/src/bitmaps/128x64/asterisk.xbm similarity index 100% rename from radio/src/bitmaps/9x/asterisk.xbm rename to radio/src/bitmaps/128x64/asterisk.xbm diff --git a/radio/src/bitmaps/9x/splash.png b/radio/src/bitmaps/128x64/splash.png similarity index 100% rename from radio/src/bitmaps/9x/splash.png rename to radio/src/bitmaps/128x64/splash.png diff --git a/radio/src/bitmaps/9x/splash.xbm b/radio/src/bitmaps/128x64/splash.xbm similarity index 100% rename from radio/src/bitmaps/9x/splash.xbm rename to radio/src/bitmaps/128x64/splash.xbm diff --git a/radio/src/bitmaps/taranis/.gitignore b/radio/src/bitmaps/212x64/.gitignore similarity index 100% rename from radio/src/bitmaps/taranis/.gitignore rename to radio/src/bitmaps/212x64/.gitignore diff --git a/radio/src/bitmaps/taranis/CMakeLists.txt b/radio/src/bitmaps/212x64/CMakeLists.txt similarity index 72% rename from radio/src/bitmaps/taranis/CMakeLists.txt rename to radio/src/bitmaps/212x64/CMakeLists.txt index 3c03014b2..ade4b08dc 100644 --- a/radio/src/bitmaps/taranis/CMakeLists.txt +++ b/radio/src/bitmaps/212x64/CMakeLists.txt @@ -1,4 +1,4 @@ add_bitmaps_target(taranis_xbm ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.xbm 128 1bit 4) add_bitmaps_target(taranis_fonts ${RADIO_SRC_DIRECTORY}/fonts/std/*.png 128 "") -add_bitmaps_target(taranis_bitmaps ${RADIO_SRC_DIRECTORY}/bitmaps/taranis/*.png 212 4bits) -add_dependencies(taranis_bitmaps taranis_fonts taranis_xbm) \ No newline at end of file +add_bitmaps_target(taranis_bitmaps ${RADIO_SRC_DIRECTORY}/bitmaps/212x64/*.png 212 4bits) +add_dependencies(taranis_bitmaps taranis_fonts taranis_xbm) diff --git a/radio/src/bitmaps/taranis/about.png b/radio/src/bitmaps/212x64/about.png similarity index 100% rename from radio/src/bitmaps/taranis/about.png rename to radio/src/bitmaps/212x64/about.png diff --git a/radio/src/bitmaps/taranis/asterisk.png b/radio/src/bitmaps/212x64/asterisk.png similarity index 100% rename from radio/src/bitmaps/taranis/asterisk.png rename to radio/src/bitmaps/212x64/asterisk.png diff --git a/radio/src/bitmaps/taranis/icons.png b/radio/src/bitmaps/212x64/icons.png similarity index 100% rename from radio/src/bitmaps/taranis/icons.png rename to radio/src/bitmaps/212x64/icons.png diff --git a/radio/src/bitmaps/taranis/lock.png b/radio/src/bitmaps/212x64/lock.png similarity index 100% rename from radio/src/bitmaps/taranis/lock.png rename to radio/src/bitmaps/212x64/lock.png diff --git a/radio/src/bitmaps/taranis/logo.png b/radio/src/bitmaps/212x64/logo.png similarity index 100% rename from radio/src/bitmaps/taranis/logo.png rename to radio/src/bitmaps/212x64/logo.png diff --git a/radio/src/bitmaps/taranis/shutdown.png b/radio/src/bitmaps/212x64/shutdown.png similarity index 100% rename from radio/src/bitmaps/taranis/shutdown.png rename to radio/src/bitmaps/212x64/shutdown.png diff --git a/radio/src/bitmaps/taranis/sleep.png b/radio/src/bitmaps/212x64/sleep.png similarity index 100% rename from radio/src/bitmaps/taranis/sleep.png rename to radio/src/bitmaps/212x64/sleep.png diff --git a/radio/src/bitmaps/taranis/splash.png b/radio/src/bitmaps/212x64/splash.png similarity index 100% rename from radio/src/bitmaps/taranis/splash.png rename to radio/src/bitmaps/212x64/splash.png diff --git a/radio/src/bitmaps/taranis/startup.png b/radio/src/bitmaps/212x64/startup.png similarity index 100% rename from radio/src/bitmaps/taranis/startup.png rename to radio/src/bitmaps/212x64/startup.png diff --git a/radio/src/bitmaps/taranis/std/analog_inputs.png b/radio/src/bitmaps/212x64/std/analog_inputs.png similarity index 100% rename from radio/src/bitmaps/taranis/std/analog_inputs.png rename to radio/src/bitmaps/212x64/std/analog_inputs.png diff --git a/radio/src/bitmaps/taranis/std/calibration.png b/radio/src/bitmaps/212x64/std/calibration.png similarity index 100% rename from radio/src/bitmaps/taranis/std/calibration.png rename to radio/src/bitmaps/212x64/std/calibration.png diff --git a/radio/src/bitmaps/taranis/std/curves.png b/radio/src/bitmaps/212x64/std/curves.png similarity index 100% rename from radio/src/bitmaps/taranis/std/curves.png rename to radio/src/bitmaps/212x64/std/curves.png diff --git a/radio/src/bitmaps/taranis/std/files.png b/radio/src/bitmaps/212x64/std/files.png similarity index 100% rename from radio/src/bitmaps/taranis/std/files.png rename to radio/src/bitmaps/212x64/std/files.png diff --git a/radio/src/bitmaps/taranis/std/flight_modes.png b/radio/src/bitmaps/212x64/std/flight_modes.png similarity index 100% rename from radio/src/bitmaps/taranis/std/flight_modes.png rename to radio/src/bitmaps/212x64/std/flight_modes.png diff --git a/radio/src/bitmaps/taranis/std/global_functions.png b/radio/src/bitmaps/212x64/std/global_functions.png similarity index 100% rename from radio/src/bitmaps/taranis/std/global_functions.png rename to radio/src/bitmaps/212x64/std/global_functions.png diff --git a/radio/src/bitmaps/taranis/std/global_vars.png b/radio/src/bitmaps/212x64/std/global_vars.png similarity index 100% rename from radio/src/bitmaps/taranis/std/global_vars.png rename to radio/src/bitmaps/212x64/std/global_vars.png diff --git a/radio/src/bitmaps/taranis/std/hardware.png b/radio/src/bitmaps/212x64/std/hardware.png similarity index 100% rename from radio/src/bitmaps/taranis/std/hardware.png rename to radio/src/bitmaps/212x64/std/hardware.png diff --git a/radio/src/bitmaps/taranis/std/heli_setup.png b/radio/src/bitmaps/212x64/std/heli_setup.png similarity index 100% rename from radio/src/bitmaps/taranis/std/heli_setup.png rename to radio/src/bitmaps/212x64/std/heli_setup.png diff --git a/radio/src/bitmaps/taranis/std/inputs.png b/radio/src/bitmaps/212x64/std/inputs.png similarity index 100% rename from radio/src/bitmaps/taranis/std/inputs.png rename to radio/src/bitmaps/212x64/std/inputs.png diff --git a/radio/src/bitmaps/taranis/std/logical_sw.png b/radio/src/bitmaps/212x64/std/logical_sw.png similarity index 100% rename from radio/src/bitmaps/taranis/std/logical_sw.png rename to radio/src/bitmaps/212x64/std/logical_sw.png diff --git a/radio/src/bitmaps/taranis/std/lua_scripts.png b/radio/src/bitmaps/212x64/std/lua_scripts.png similarity index 100% rename from radio/src/bitmaps/taranis/std/lua_scripts.png rename to radio/src/bitmaps/212x64/std/lua_scripts.png diff --git a/radio/src/bitmaps/taranis/std/mainview_setup.png b/radio/src/bitmaps/212x64/std/mainview_setup.png similarity index 100% rename from radio/src/bitmaps/taranis/std/mainview_setup.png rename to radio/src/bitmaps/212x64/std/mainview_setup.png diff --git a/radio/src/bitmaps/taranis/std/mixer.png b/radio/src/bitmaps/212x64/std/mixer.png similarity index 100% rename from radio/src/bitmaps/taranis/std/mixer.png rename to radio/src/bitmaps/212x64/std/mixer.png diff --git a/radio/src/bitmaps/taranis/std/model_select.png b/radio/src/bitmaps/212x64/std/model_select.png similarity index 100% rename from radio/src/bitmaps/taranis/std/model_select.png rename to radio/src/bitmaps/212x64/std/model_select.png diff --git a/radio/src/bitmaps/taranis/std/model_settings.png b/radio/src/bitmaps/212x64/std/model_settings.png similarity index 100% rename from radio/src/bitmaps/taranis/std/model_settings.png rename to radio/src/bitmaps/212x64/std/model_settings.png diff --git a/radio/src/bitmaps/taranis/std/model_setup.png b/radio/src/bitmaps/212x64/std/model_setup.png similarity index 100% rename from radio/src/bitmaps/taranis/std/model_setup.png rename to radio/src/bitmaps/212x64/std/model_setup.png diff --git a/radio/src/bitmaps/taranis/std/radio_setup.png b/radio/src/bitmaps/212x64/std/radio_setup.png similarity index 100% rename from radio/src/bitmaps/taranis/std/radio_setup.png rename to radio/src/bitmaps/212x64/std/radio_setup.png diff --git a/radio/src/bitmaps/taranis/std/servos.png b/radio/src/bitmaps/212x64/std/servos.png similarity index 100% rename from radio/src/bitmaps/taranis/std/servos.png rename to radio/src/bitmaps/212x64/std/servos.png diff --git a/radio/src/bitmaps/taranis/std/special_functions.png b/radio/src/bitmaps/212x64/std/special_functions.png similarity index 100% rename from radio/src/bitmaps/taranis/std/special_functions.png rename to radio/src/bitmaps/212x64/std/special_functions.png diff --git a/radio/src/bitmaps/taranis/std/switch_test.png b/radio/src/bitmaps/212x64/std/switch_test.png similarity index 100% rename from radio/src/bitmaps/taranis/std/switch_test.png rename to radio/src/bitmaps/212x64/std/switch_test.png diff --git a/radio/src/bitmaps/taranis/std/telemetry.png b/radio/src/bitmaps/212x64/std/telemetry.png similarity index 100% rename from radio/src/bitmaps/taranis/std/telemetry.png rename to radio/src/bitmaps/212x64/std/telemetry.png diff --git a/radio/src/bitmaps/taranis/std/trainer.png b/radio/src/bitmaps/212x64/std/trainer.png similarity index 100% rename from radio/src/bitmaps/taranis/std/trainer.png rename to radio/src/bitmaps/212x64/std/trainer.png diff --git a/radio/src/bitmaps/taranis/std/version.png b/radio/src/bitmaps/212x64/std/version.png similarity index 100% rename from radio/src/bitmaps/taranis/std/version.png rename to radio/src/bitmaps/212x64/std/version.png diff --git a/radio/src/bitmaps/horus/CMakeLists.txt b/radio/src/bitmaps/480x272/CMakeLists.txt similarity index 58% rename from radio/src/bitmaps/horus/CMakeLists.txt rename to radio/src/bitmaps/480x272/CMakeLists.txt index 6ec6b1c59..a86089291 100644 --- a/radio/src/bitmaps/horus/CMakeLists.txt +++ b/radio/src/bitmaps/480x272/CMakeLists.txt @@ -1,12 +1,12 @@ -add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5) -add_bitmaps_target(horus_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/bmp_*.png" 480 5/6/5) -add_bitmaps_target(horus_button_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/button/alpha_*.png" 480 4/4/4/4) -add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 4/4/4/4) -add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/calibration/alpha_*.png" 480 4/4/4/4) -add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits) -add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits) -add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.png" 480 8bits) -add_bitmaps_target(horus_themes_bitmaps "${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.png" 480 5/6/5) -add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits) -add_bitmaps_target(horus_volume_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/volume/*.png 480 8bits) +add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/bmp_*.png" 480 5/6/5) +add_bitmaps_target(horus_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/calibration/bmp_*.png" 480 5/6/5) +add_bitmaps_target(horus_button_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/button/alpha_*.png" 480 4/4/4/4) +add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/alpha_*.png" 480 4/4/4/4) +add_bitmaps_target(horus_alpha_calibration_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/calibration/alpha_*.png" 480 4/4/4/4) +add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/480x272/mask_*.png 480 8bits) +add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/480x272/slider/*.png" 480 8bits) +add_bitmaps_target(horus_layouts_masks "${RADIO_SRC_DIRECTORY}/gui/480x272/layouts/*.png" 480 8bits) +add_bitmaps_target(horus_themes_bitmaps "${RADIO_SRC_DIRECTORY}/gui/480x272/themes/*.png" 480 5/6/5) +add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/480x272/*.png 480 8bits) +add_bitmaps_target(horus_volume_masks ${RADIO_SRC_DIRECTORY}/bitmaps/480x272/volume/*.png 480 8bits) add_dependencies(horus_bitmaps horus_calibration_bitmaps horus_button_bitmaps horus_alpha_bitmaps horus_alpha_calibration_bitmaps horus_masks horus_slider_masks horus_layouts_masks horus_themes_bitmaps horus_fonts horus_volume_masks) diff --git a/radio/src/bitmaps/horus/bmp_splash.png b/radio/src/bitmaps/480x272/bmp_splash.png similarity index 100% rename from radio/src/bitmaps/horus/bmp_splash.png rename to radio/src/bitmaps/480x272/bmp_splash.png diff --git a/radio/src/bitmaps/horus/button/alpha_button_off.png b/radio/src/bitmaps/480x272/button/alpha_button_off.png similarity index 100% rename from radio/src/bitmaps/horus/button/alpha_button_off.png rename to radio/src/bitmaps/480x272/button/alpha_button_off.png diff --git a/radio/src/bitmaps/horus/button/alpha_button_on.png b/radio/src/bitmaps/480x272/button/alpha_button_on.png similarity index 100% rename from radio/src/bitmaps/horus/button/alpha_button_on.png rename to radio/src/bitmaps/480x272/button/alpha_button_on.png diff --git a/radio/src/bitmaps/horus/mask_about_headico.png b/radio/src/bitmaps/480x272/mask_about_headico.png similarity index 100% rename from radio/src/bitmaps/horus/mask_about_headico.png rename to radio/src/bitmaps/480x272/mask_about_headico.png diff --git a/radio/src/bitmaps/horus/mask_carroussel_left.png b/radio/src/bitmaps/480x272/mask_carroussel_left.png similarity index 100% rename from radio/src/bitmaps/horus/mask_carroussel_left.png rename to radio/src/bitmaps/480x272/mask_carroussel_left.png diff --git a/radio/src/bitmaps/horus/mask_carroussel_right.png b/radio/src/bitmaps/480x272/mask_carroussel_right.png similarity index 100% rename from radio/src/bitmaps/horus/mask_carroussel_right.png rename to radio/src/bitmaps/480x272/mask_carroussel_right.png diff --git a/radio/src/bitmaps/horus/mask_coord_shadow.png b/radio/src/bitmaps/480x272/mask_coord_shadow.png similarity index 100% rename from radio/src/bitmaps/horus/mask_coord_shadow.png rename to radio/src/bitmaps/480x272/mask_coord_shadow.png diff --git a/radio/src/bitmaps/horus/mask_cvpoint.png b/radio/src/bitmaps/480x272/mask_cvpoint.png similarity index 100% rename from radio/src/bitmaps/horus/mask_cvpoint.png rename to radio/src/bitmaps/480x272/mask_cvpoint.png diff --git a/radio/src/bitmaps/horus/mask_cvpoint_center.png b/radio/src/bitmaps/480x272/mask_cvpoint_center.png similarity index 100% rename from radio/src/bitmaps/horus/mask_cvpoint_center.png rename to radio/src/bitmaps/480x272/mask_cvpoint_center.png diff --git a/radio/src/bitmaps/horus/mask_dot.png b/radio/src/bitmaps/480x272/mask_dot.png similarity index 100% rename from radio/src/bitmaps/horus/mask_dot.png rename to radio/src/bitmaps/480x272/mask_dot.png diff --git a/radio/src/bitmaps/horus/mask_htrim_frame.png b/radio/src/bitmaps/480x272/mask_htrim_frame.png similarity index 100% rename from radio/src/bitmaps/horus/mask_htrim_frame.png rename to radio/src/bitmaps/480x272/mask_htrim_frame.png diff --git a/radio/src/bitmaps/horus/mask_library_active_model.png b/radio/src/bitmaps/480x272/mask_library_active_model.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_active_model.png rename to radio/src/bitmaps/480x272/mask_library_active_model.png diff --git a/radio/src/bitmaps/horus/mask_library_score_0.png b/radio/src/bitmaps/480x272/mask_library_score_0.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_score_0.png rename to radio/src/bitmaps/480x272/mask_library_score_0.png diff --git a/radio/src/bitmaps/horus/mask_library_score_1.png b/radio/src/bitmaps/480x272/mask_library_score_1.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_score_1.png rename to radio/src/bitmaps/480x272/mask_library_score_1.png diff --git a/radio/src/bitmaps/horus/mask_library_slot.png b/radio/src/bitmaps/480x272/mask_library_slot.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_slot.png rename to radio/src/bitmaps/480x272/mask_library_slot.png diff --git a/radio/src/bitmaps/horus/mask_library_star_0.png b/radio/src/bitmaps/480x272/mask_library_star_0.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_star_0.png rename to radio/src/bitmaps/480x272/mask_library_star_0.png diff --git a/radio/src/bitmaps/horus/mask_library_star_1.png b/radio/src/bitmaps/480x272/mask_library_star_1.png similarity index 100% rename from radio/src/bitmaps/horus/mask_library_star_1.png rename to radio/src/bitmaps/480x272/mask_library_star_1.png diff --git a/radio/src/bitmaps/horus/mask_mainviews_item_in.png b/radio/src/bitmaps/480x272/mask_mainviews_item_in.png similarity index 100% rename from radio/src/bitmaps/horus/mask_mainviews_item_in.png rename to radio/src/bitmaps/480x272/mask_mainviews_item_in.png diff --git a/radio/src/bitmaps/horus/mask_mainviews_item_out.png b/radio/src/bitmaps/480x272/mask_mainviews_item_out.png similarity index 100% rename from radio/src/bitmaps/horus/mask_mainviews_item_out.png rename to radio/src/bitmaps/480x272/mask_mainviews_item_out.png diff --git a/radio/src/bitmaps/horus/mask_point.png b/radio/src/bitmaps/480x272/mask_point.png similarity index 100% rename from radio/src/bitmaps/horus/mask_point.png rename to radio/src/bitmaps/480x272/mask_point.png diff --git a/radio/src/bitmaps/horus/mask_rscale.png b/radio/src/bitmaps/480x272/mask_rscale.png similarity index 100% rename from radio/src/bitmaps/horus/mask_rscale.png rename to radio/src/bitmaps/480x272/mask_rscale.png diff --git a/radio/src/bitmaps/horus/mask_shutdown_circle.png b/radio/src/bitmaps/480x272/mask_shutdown_circle.png similarity index 100% rename from radio/src/bitmaps/horus/mask_shutdown_circle.png rename to radio/src/bitmaps/480x272/mask_shutdown_circle.png diff --git a/radio/src/bitmaps/horus/mask_swipe_circle.png b/radio/src/bitmaps/480x272/mask_swipe_circle.png similarity index 100% rename from radio/src/bitmaps/horus/mask_swipe_circle.png rename to radio/src/bitmaps/480x272/mask_swipe_circle.png diff --git a/radio/src/bitmaps/horus/mask_swipe_left.png b/radio/src/bitmaps/480x272/mask_swipe_left.png similarity index 100% rename from radio/src/bitmaps/horus/mask_swipe_left.png rename to radio/src/bitmaps/480x272/mask_swipe_left.png diff --git a/radio/src/bitmaps/horus/mask_swipe_right.png b/radio/src/bitmaps/480x272/mask_swipe_right.png similarity index 100% rename from radio/src/bitmaps/horus/mask_swipe_right.png rename to radio/src/bitmaps/480x272/mask_swipe_right.png diff --git a/radio/src/bitmaps/horus/mask_timer.png b/radio/src/bitmaps/480x272/mask_timer.png similarity index 100% rename from radio/src/bitmaps/horus/mask_timer.png rename to radio/src/bitmaps/480x272/mask_timer.png diff --git a/radio/src/bitmaps/horus/mask_timer_bg.png b/radio/src/bitmaps/480x272/mask_timer_bg.png similarity index 100% rename from radio/src/bitmaps/horus/mask_timer_bg.png rename to radio/src/bitmaps/480x272/mask_timer_bg.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_altitude_ico.png b/radio/src/bitmaps/480x272/mask_topmenu_altitude_ico.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_altitude_ico.png rename to radio/src/bitmaps/480x272/mask_topmenu_altitude_ico.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_masterpart_ico.png b/radio/src/bitmaps/480x272/mask_topmenu_masterpart_ico.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_masterpart_ico.png rename to radio/src/bitmaps/480x272/mask_topmenu_masterpart_ico.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_sdcard.png b/radio/src/bitmaps/480x272/mask_topmenu_sdcard.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_sdcard.png rename to radio/src/bitmaps/480x272/mask_topmenu_sdcard.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_slavepart_ico.png b/radio/src/bitmaps/480x272/mask_topmenu_slavepart_ico.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_slavepart_ico.png rename to radio/src/bitmaps/480x272/mask_topmenu_slavepart_ico.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_usb.png b/radio/src/bitmaps/480x272/mask_topmenu_usb.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_usb.png rename to radio/src/bitmaps/480x272/mask_topmenu_usb.png diff --git a/radio/src/bitmaps/horus/mask_topmenu_volume_ico.png b/radio/src/bitmaps/480x272/mask_topmenu_volume_ico.png similarity index 100% rename from radio/src/bitmaps/horus/mask_topmenu_volume_ico.png rename to radio/src/bitmaps/480x272/mask_topmenu_volume_ico.png diff --git a/radio/src/bitmaps/horus/mask_trim_shadow.png b/radio/src/bitmaps/480x272/mask_trim_shadow.png similarity index 100% rename from radio/src/bitmaps/horus/mask_trim_shadow.png rename to radio/src/bitmaps/480x272/mask_trim_shadow.png diff --git a/radio/src/bitmaps/horus/mask_txbat.png b/radio/src/bitmaps/480x272/mask_txbat.png similarity index 100% rename from radio/src/bitmaps/horus/mask_txbat.png rename to radio/src/bitmaps/480x272/mask_txbat.png diff --git a/radio/src/bitmaps/horus/mask_vtrim_frame.png b/radio/src/bitmaps/480x272/mask_vtrim_frame.png similarity index 100% rename from radio/src/bitmaps/horus/mask_vtrim_frame.png rename to radio/src/bitmaps/480x272/mask_vtrim_frame.png diff --git a/radio/src/bitmaps/horus/slider/bar_left.png b/radio/src/bitmaps/480x272/slider/bar_left.png similarity index 100% rename from radio/src/bitmaps/horus/slider/bar_left.png rename to radio/src/bitmaps/480x272/slider/bar_left.png diff --git a/radio/src/bitmaps/horus/slider/bar_right.png b/radio/src/bitmaps/480x272/slider/bar_right.png similarity index 100% rename from radio/src/bitmaps/horus/slider/bar_right.png rename to radio/src/bitmaps/480x272/slider/bar_right.png diff --git a/radio/src/bitmaps/horus/slider/point_in.png b/radio/src/bitmaps/480x272/slider/point_in.png similarity index 100% rename from radio/src/bitmaps/horus/slider/point_in.png rename to radio/src/bitmaps/480x272/slider/point_in.png diff --git a/radio/src/bitmaps/horus/slider/point_mid.png b/radio/src/bitmaps/480x272/slider/point_mid.png similarity index 100% rename from radio/src/bitmaps/horus/slider/point_mid.png rename to radio/src/bitmaps/480x272/slider/point_mid.png diff --git a/radio/src/bitmaps/horus/slider/point_out.png b/radio/src/bitmaps/480x272/slider/point_out.png similarity index 100% rename from radio/src/bitmaps/horus/slider/point_out.png rename to radio/src/bitmaps/480x272/slider/point_out.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_0.png b/radio/src/bitmaps/480x272/volume/mask_volume_0.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_0.png rename to radio/src/bitmaps/480x272/volume/mask_volume_0.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_1.png b/radio/src/bitmaps/480x272/volume/mask_volume_1.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_1.png rename to radio/src/bitmaps/480x272/volume/mask_volume_1.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_2.png b/radio/src/bitmaps/480x272/volume/mask_volume_2.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_2.png rename to radio/src/bitmaps/480x272/volume/mask_volume_2.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_3.png b/radio/src/bitmaps/480x272/volume/mask_volume_3.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_3.png rename to radio/src/bitmaps/480x272/volume/mask_volume_3.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_4.png b/radio/src/bitmaps/480x272/volume/mask_volume_4.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_4.png rename to radio/src/bitmaps/480x272/volume/mask_volume_4.png diff --git a/radio/src/bitmaps/horus/volume/mask_volume_scale.png b/radio/src/bitmaps/480x272/volume/mask_volume_scale.png similarity index 100% rename from radio/src/bitmaps/horus/volume/mask_volume_scale.png rename to radio/src/bitmaps/480x272/volume/mask_volume_scale.png diff --git a/radio/src/bitmaps/CMakeLists.txt b/radio/src/bitmaps/CMakeLists.txt index 1105a3e15..e723cf313 100644 --- a/radio/src/bitmaps/CMakeLists.txt +++ b/radio/src/bitmaps/CMakeLists.txt @@ -1,3 +1,3 @@ -add_subdirectory(9x) -add_subdirectory(taranis) -add_subdirectory(horus) +add_subdirectory(128x64) +add_subdirectory(212x64) +add_subdirectory(480x272) diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 585823496..a68accfd8 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -767,8 +767,8 @@ typedef uint8_t swarnenable_t; #endif #if defined(PCBHORUS) -#include "gui/horus/layout.h" -#include "gui/horus/topbar.h" +#include "gui/480x272/layout.h" +#include "gui/480x272/topbar.h" PACK(struct CustomScreenData { char layoutName[10]; Layout::PersistentData layoutData; @@ -967,7 +967,7 @@ PACK(struct TrainerData { #endif #if defined(PCBHORUS) - #include "gui/horus/theme.h" + #include "gui/480x272/theme.h" #define THEME_DATA \ NOBACKUP(char themeName[8]); \ NOBACKUP(Theme::PersistentData themeData); diff --git a/radio/src/fonts/horus/CMakeLists.txt b/radio/src/fonts/480x272/CMakeLists.txt similarity index 100% rename from radio/src/fonts/horus/CMakeLists.txt rename to radio/src/fonts/480x272/CMakeLists.txt diff --git a/radio/src/fonts/horus/font_dblsize.png b/radio/src/fonts/480x272/font_dblsize.png similarity index 100% rename from radio/src/fonts/horus/font_dblsize.png rename to radio/src/fonts/480x272/font_dblsize.png diff --git a/radio/src/fonts/horus/font_dblsize.specs b/radio/src/fonts/480x272/font_dblsize.specs similarity index 100% rename from radio/src/fonts/horus/font_dblsize.specs rename to radio/src/fonts/480x272/font_dblsize.specs diff --git a/radio/src/fonts/horus/font_midsize.png b/radio/src/fonts/480x272/font_midsize.png similarity index 100% rename from radio/src/fonts/horus/font_midsize.png rename to radio/src/fonts/480x272/font_midsize.png diff --git a/radio/src/fonts/horus/font_midsize.specs b/radio/src/fonts/480x272/font_midsize.specs similarity index 100% rename from radio/src/fonts/horus/font_midsize.specs rename to radio/src/fonts/480x272/font_midsize.specs diff --git a/radio/src/fonts/horus/font_smlsize.png b/radio/src/fonts/480x272/font_smlsize.png similarity index 100% rename from radio/src/fonts/horus/font_smlsize.png rename to radio/src/fonts/480x272/font_smlsize.png diff --git a/radio/src/fonts/horus/font_smlsize.specs b/radio/src/fonts/480x272/font_smlsize.specs similarity index 100% rename from radio/src/fonts/horus/font_smlsize.specs rename to radio/src/fonts/480x272/font_smlsize.specs diff --git a/radio/src/fonts/horus/font_stdsize.png b/radio/src/fonts/480x272/font_stdsize.png similarity index 100% rename from radio/src/fonts/horus/font_stdsize.png rename to radio/src/fonts/480x272/font_stdsize.png diff --git a/radio/src/fonts/horus/font_stdsize.specs b/radio/src/fonts/480x272/font_stdsize.specs similarity index 100% rename from radio/src/fonts/horus/font_stdsize.specs rename to radio/src/fonts/480x272/font_stdsize.specs diff --git a/radio/src/fonts/horus/font_stdsizebold.png b/radio/src/fonts/480x272/font_stdsizebold.png similarity index 100% rename from radio/src/fonts/horus/font_stdsizebold.png rename to radio/src/fonts/480x272/font_stdsizebold.png diff --git a/radio/src/fonts/horus/font_stdsizebold.specs b/radio/src/fonts/480x272/font_stdsizebold.specs similarity index 100% rename from radio/src/fonts/horus/font_stdsizebold.specs rename to radio/src/fonts/480x272/font_stdsizebold.specs diff --git a/radio/src/fonts/horus/font_tinsize.png b/radio/src/fonts/480x272/font_tinsize.png similarity index 100% rename from radio/src/fonts/horus/font_tinsize.png rename to radio/src/fonts/480x272/font_tinsize.png diff --git a/radio/src/fonts/horus/font_tinsize.specs b/radio/src/fonts/480x272/font_tinsize.specs similarity index 100% rename from radio/src/fonts/horus/font_tinsize.specs rename to radio/src/fonts/480x272/font_tinsize.specs diff --git a/radio/src/fonts/horus/font_xxlsize.png b/radio/src/fonts/480x272/font_xxlsize.png similarity index 100% rename from radio/src/fonts/horus/font_xxlsize.png rename to radio/src/fonts/480x272/font_xxlsize.png diff --git a/radio/src/fonts/horus/font_xxlsize.specs b/radio/src/fonts/480x272/font_xxlsize.specs similarity index 100% rename from radio/src/fonts/horus/font_xxlsize.specs rename to radio/src/fonts/480x272/font_xxlsize.specs diff --git a/radio/src/fonts/CMakeLists.txt b/radio/src/fonts/CMakeLists.txt index f238820be..4f9b537cf 100644 --- a/radio/src/fonts/CMakeLists.txt +++ b/radio/src/fonts/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(horus) \ No newline at end of file +add_subdirectory(480x272) diff --git a/radio/src/gui/9x/fonts.cpp b/radio/src/gui/128x64/fonts.cpp similarity index 96% rename from radio/src/gui/9x/fonts.cpp rename to radio/src/gui/128x64/fonts.cpp index 2fcbee63d..3fd937a1c 100644 --- a/radio/src/gui/9x/fonts.cpp +++ b/radio/src/gui/128x64/fonts.cpp @@ -18,132 +18,132 @@ * GNU General Public License for more details. */ -#include "opentx.h" - -const pm_uchar font_5x7[] PROGMEM = { -#if defined (CPUARM) -#include "font_05x07.lbm" -#else -#include "font_05x07_avr.lbm" -#endif -#if defined(TRANSLATIONS_DE) -#include "font_de_05x07.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_05x07.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_05x07.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_05x07.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_05x07.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_05x07.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_05x07.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_05x07.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_05x07.lbm" -#endif -}; - -#if defined(BOLD_SPECIFIC_FONT) -const pm_uchar font_5x7_B[] PROGMEM = { -#include "font_05x07_B_compressed.lbm" -}; -#endif - -#if !defined(BOOT) -const pm_uchar font_10x14[] PROGMEM = { -#include "font_10x14_compressed.lbm" -#if defined(CPUARM) - #if defined(TRANSLATIONS_DE) - #include "font_de_10x14.lbm" - #elif defined(TRANSLATIONS_CZ) - #include "font_cz_10x14.lbm" - #elif defined(TRANSLATIONS_ES) - #include "font_es_10x14.lbm" - #elif defined(TRANSLATIONS_FI) - #include "font_fi_10x14.lbm" - #elif defined(TRANSLATIONS_FR) - #include "font_fr_10x14.lbm" - #elif defined(TRANSLATIONS_IT) - #include "font_it_10x14.lbm" - #elif defined(TRANSLATIONS_PL) - #include "font_pl_10x14.lbm" - #elif defined(TRANSLATIONS_PT) - #include "font_pt_10x14.lbm" - #elif defined(TRANSLATIONS_SE) - #include "font_se_10x14.lbm" - #endif -#endif -}; -#endif - -#if defined(CPUARM) && !defined(BOOT) -const pm_uchar font_3x5[] PROGMEM = { -#include "font_03x05.lbm" -}; -const pm_uchar font_4x6[] PROGMEM = { -#include "font_04x06.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_04x06.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_04x06.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_04x06.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_04x06.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_04x06.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_04x06.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_04x06.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_04x06.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_04x06.lbm" -#endif -}; - -const pm_uchar font_8x10[] PROGMEM = { -#include "font_08x10.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_08x10.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_08x10.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_08x10.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_08x10.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_08x10.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_08x10.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_08x10.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_08x10.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_08x10.lbm" -#endif -}; - -const pm_uchar font_22x38_num[] PROGMEM = { -#include "font_22x38_num.lbm" -}; - -const pm_uchar font_4x6_extra[] PROGMEM = { -#include "font_04x06_extra.lbm" -}; - -const pm_uchar font_5x7_extra[] PROGMEM = { -#include "font_05x07_extra.lbm" -}; - -const pm_uchar font_10x14_extra[] PROGMEM = { -#include "font_10x14_extra.lbm" -}; - -#endif // defined(CPUARM) && !defined(BOOT) +#include "opentx.h" + +const pm_uchar font_5x7[] PROGMEM = { +#if defined (CPUARM) +#include "font_05x07.lbm" +#else +#include "font_05x07_avr.lbm" +#endif +#if defined(TRANSLATIONS_DE) +#include "font_de_05x07.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_05x07.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_05x07.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_05x07.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_05x07.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_05x07.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_05x07.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_05x07.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_05x07.lbm" +#endif +}; + +#if defined(BOLD_SPECIFIC_FONT) +const pm_uchar font_5x7_B[] PROGMEM = { +#include "font_05x07_B_compressed.lbm" +}; +#endif + +#if !defined(BOOT) +const pm_uchar font_10x14[] PROGMEM = { +#include "font_10x14_compressed.lbm" +#if defined(CPUARM) + #if defined(TRANSLATIONS_DE) + #include "font_de_10x14.lbm" + #elif defined(TRANSLATIONS_CZ) + #include "font_cz_10x14.lbm" + #elif defined(TRANSLATIONS_ES) + #include "font_es_10x14.lbm" + #elif defined(TRANSLATIONS_FI) + #include "font_fi_10x14.lbm" + #elif defined(TRANSLATIONS_FR) + #include "font_fr_10x14.lbm" + #elif defined(TRANSLATIONS_IT) + #include "font_it_10x14.lbm" + #elif defined(TRANSLATIONS_PL) + #include "font_pl_10x14.lbm" + #elif defined(TRANSLATIONS_PT) + #include "font_pt_10x14.lbm" + #elif defined(TRANSLATIONS_SE) + #include "font_se_10x14.lbm" + #endif +#endif +}; +#endif + +#if defined(CPUARM) && !defined(BOOT) +const pm_uchar font_3x5[] PROGMEM = { +#include "font_03x05.lbm" +}; +const pm_uchar font_4x6[] PROGMEM = { +#include "font_04x06.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_04x06.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_04x06.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_04x06.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_04x06.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_04x06.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_04x06.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_04x06.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_04x06.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_04x06.lbm" +#endif +}; + +const pm_uchar font_8x10[] PROGMEM = { +#include "font_08x10.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_08x10.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_08x10.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_08x10.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_08x10.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_08x10.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_08x10.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_08x10.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_08x10.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_08x10.lbm" +#endif +}; + +const pm_uchar font_22x38_num[] PROGMEM = { +#include "font_22x38_num.lbm" +}; + +const pm_uchar font_4x6_extra[] PROGMEM = { +#include "font_04x06_extra.lbm" +}; + +const pm_uchar font_5x7_extra[] PROGMEM = { +#include "font_05x07_extra.lbm" +}; + +const pm_uchar font_10x14_extra[] PROGMEM = { +#include "font_10x14_extra.lbm" +}; + +#endif // defined(CPUARM) && !defined(BOOT) diff --git a/radio/src/gui/9x/gui.h b/radio/src/gui/128x64/gui.h similarity index 93% rename from radio/src/gui/9x/gui.h rename to radio/src/gui/128x64/gui.h index d92323ad1..657dc48a4 100644 --- a/radio/src/gui/9x/gui.h +++ b/radio/src/gui/128x64/gui.h @@ -18,6 +18,13 @@ * GNU General Public License for more details. */ +#ifndef _GUI_H_ +#define _GUI_H_ + +#if defined(CPUARM) +#include "gui_helpers.h" +#endif + #include "lcd.h" #include "menus.h" @@ -48,3 +55,5 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval); #define SET_SCROLLBAR_X(x) #define LOAD_MODEL_BITMAP() + +#endif // _GUI_H_ \ No newline at end of file diff --git a/radio/src/gui/9x/lcd.cpp b/radio/src/gui/128x64/lcd.cpp similarity index 100% rename from radio/src/gui/9x/lcd.cpp rename to radio/src/gui/128x64/lcd.cpp diff --git a/radio/src/gui/9x/lcd.h b/radio/src/gui/128x64/lcd.h similarity index 100% rename from radio/src/gui/9x/lcd.h rename to radio/src/gui/128x64/lcd.h diff --git a/radio/src/gui/9x/menu_model.cpp b/radio/src/gui/128x64/menu_model.cpp similarity index 98% rename from radio/src/gui/9x/menu_model.cpp rename to radio/src/gui/128x64/menu_model.cpp index 4dc83e890..f47a79bd3 100644 --- a/radio/src/gui/9x/menu_model.cpp +++ b/radio/src/gui/128x64/menu_model.cpp @@ -18,10 +18,10 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" +#include "opentx.h" #if defined(MAVLINK) -#include "gui/9x/view_mavlink.h" +#include "view_mavlink.h" #endif uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) diff --git a/radio/src/gui/9x/menu_general.cpp b/radio/src/gui/128x64/menu_radio.cpp similarity index 99% rename from radio/src/gui/9x/menu_general.cpp rename to radio/src/gui/128x64/menu_radio.cpp index dfb6ab2d9..7e52f98d7 100644 --- a/radio/src/gui/9x/menu_general.cpp +++ b/radio/src/gui/128x64/menu_radio.cpp @@ -18,12 +18,12 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" - -#if defined(CPUARM) -void menuGeneralCustomFunctions(uint8_t event) -{ - MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); - return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); -} -#endif +#include "../../opentx.h" + +#if defined(CPUARM) +void menuGeneralCustomFunctions(uint8_t event) +{ + MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); + return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext); +} +#endif diff --git a/radio/src/gui/9x/menus.cpp b/radio/src/gui/128x64/menus.cpp similarity index 100% rename from radio/src/gui/9x/menus.cpp rename to radio/src/gui/128x64/menus.cpp diff --git a/radio/src/gui/9x/menus.h b/radio/src/gui/128x64/menus.h similarity index 100% rename from radio/src/gui/9x/menus.h rename to radio/src/gui/128x64/menus.h diff --git a/radio/src/gui/9x/menu_model_curves.cpp b/radio/src/gui/128x64/model_curves.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_curves.cpp rename to radio/src/gui/128x64/model_curves.cpp diff --git a/radio/src/gui/9x/menu_model_flightmodes.cpp b/radio/src/gui/128x64/model_flightmodes.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_flightmodes.cpp rename to radio/src/gui/128x64/model_flightmodes.cpp diff --git a/radio/src/gui/9x/menu_model_heli.cpp b/radio/src/gui/128x64/model_heli.cpp similarity index 98% rename from radio/src/gui/9x/menu_model_heli.cpp rename to radio/src/gui/128x64/model_heli.cpp index 6d6fbfa01..2494cd9db 100644 --- a/radio/src/gui/9x/menu_model_heli.cpp +++ b/radio/src/gui/128x64/model_heli.cpp @@ -18,7 +18,7 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" +#include "opentx.h" enum menuModelHeliItems { ITEM_HELI_SWASHTYPE, diff --git a/radio/src/gui/9x/menu_model_inputs_mixes.cpp b/radio/src/gui/128x64/model_inputs_mixes.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_inputs_mixes.cpp rename to radio/src/gui/128x64/model_inputs_mixes.cpp diff --git a/radio/src/gui/9x/menu_model_logical_switches.cpp b/radio/src/gui/128x64/model_logical_switches.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_logical_switches.cpp rename to radio/src/gui/128x64/model_logical_switches.cpp diff --git a/radio/src/gui/9x/menu_model_limits.cpp b/radio/src/gui/128x64/model_outputs.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_limits.cpp rename to radio/src/gui/128x64/model_outputs.cpp diff --git a/radio/src/gui/9x/menu_model_select.cpp b/radio/src/gui/128x64/model_select.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_select.cpp rename to radio/src/gui/128x64/model_select.cpp diff --git a/radio/src/gui/9x/menu_model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_setup.cpp rename to radio/src/gui/128x64/model_setup.cpp diff --git a/radio/src/gui/9x/model_special_functions.cpp b/radio/src/gui/128x64/model_special_functions.cpp similarity index 100% rename from radio/src/gui/9x/model_special_functions.cpp rename to radio/src/gui/128x64/model_special_functions.cpp diff --git a/radio/src/gui/9x/menu_model_telemetry.cpp b/radio/src/gui/128x64/model_telemetry.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_telemetry.cpp rename to radio/src/gui/128x64/model_telemetry.cpp diff --git a/radio/src/gui/9x/menu_model_templates.cpp b/radio/src/gui/128x64/model_templates.cpp similarity index 100% rename from radio/src/gui/9x/menu_model_templates.cpp rename to radio/src/gui/128x64/model_templates.cpp diff --git a/radio/src/gui/9x/navigation.cpp b/radio/src/gui/128x64/navigation.cpp similarity index 100% rename from radio/src/gui/9x/navigation.cpp rename to radio/src/gui/128x64/navigation.cpp diff --git a/radio/src/gui/9x/popups.cpp b/radio/src/gui/128x64/popups.cpp similarity index 100% rename from radio/src/gui/9x/popups.cpp rename to radio/src/gui/128x64/popups.cpp diff --git a/radio/src/gui/9x/radio_calibration.cpp b/radio/src/gui/128x64/radio_calibration.cpp similarity index 100% rename from radio/src/gui/9x/radio_calibration.cpp rename to radio/src/gui/128x64/radio_calibration.cpp diff --git a/radio/src/gui/9x/menu_general_diaganas.cpp b/radio/src/gui/128x64/radio_diaganas.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_diaganas.cpp rename to radio/src/gui/128x64/radio_diaganas.cpp diff --git a/radio/src/gui/9x/menu_general_diagkeys.cpp b/radio/src/gui/128x64/radio_diagkeys.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_diagkeys.cpp rename to radio/src/gui/128x64/radio_diagkeys.cpp diff --git a/radio/src/gui/9x/menu_general_hardware.cpp b/radio/src/gui/128x64/radio_hardware.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_hardware.cpp rename to radio/src/gui/128x64/radio_hardware.cpp diff --git a/radio/src/gui/9x/menu_general_sdmanager.cpp b/radio/src/gui/128x64/radio_sdmanager.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_sdmanager.cpp rename to radio/src/gui/128x64/radio_sdmanager.cpp diff --git a/radio/src/gui/9x/radio_setup.cpp b/radio/src/gui/128x64/radio_setup.cpp similarity index 100% rename from radio/src/gui/9x/radio_setup.cpp rename to radio/src/gui/128x64/radio_setup.cpp diff --git a/radio/src/gui/9x/menu_general_trainer.cpp b/radio/src/gui/128x64/radio_trainer.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_trainer.cpp rename to radio/src/gui/128x64/radio_trainer.cpp diff --git a/radio/src/gui/9x/menu_general_version.cpp b/radio/src/gui/128x64/radio_version.cpp similarity index 100% rename from radio/src/gui/9x/menu_general_version.cpp rename to radio/src/gui/128x64/radio_version.cpp diff --git a/radio/src/gui/9x/splash.cpp b/radio/src/gui/128x64/splash.cpp similarity index 98% rename from radio/src/gui/9x/splash.cpp rename to radio/src/gui/128x64/splash.cpp index fd542d974..25123da70 100644 --- a/radio/src/gui/9x/splash.cpp +++ b/radio/src/gui/128x64/splash.cpp @@ -43,7 +43,7 @@ #if defined(SPLASH) const pm_uchar splashdata[] PROGMEM = { 'S','P','S',0, - #include "bitmaps/9x/splash.lbm" + #include "bitmaps/128x64/splash.lbm" 'S','P','E',0 }; const pm_uchar * const splash_lbm = splashdata+4; diff --git a/radio/src/gui/9x/view_about.cpp b/radio/src/gui/128x64/view_about.cpp similarity index 96% rename from radio/src/gui/9x/view_about.cpp rename to radio/src/gui/128x64/view_about.cpp index 2fb972833..73ec9abdb 100644 --- a/radio/src/gui/9x/view_about.cpp +++ b/radio/src/gui/128x64/view_about.cpp @@ -18,133 +18,133 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" - -const pm_uchar about_bmp[] PROGMEM = { -#include "../../bitmaps/9x/about.lbm" -}; - -enum AboutScreens { - ABOUT_OPENTX, - ABOUT_BERTRAND, - ABOUT_ANDRE, - ABOUT_MIKE, - ABOUT_KJELL, - ABOUT_MARTIN, - ABOUT_ROMOLO, - ABOUT_ROB, - ABOUT_HARDWARE, - ABOUT_PARENTS, - ABOUT_END, - ABOUT_COUNT, -}; - -#define ABOUT_X 2 -#define ABOUT_INDENT 4 - -void menuAboutView(uint8_t event) -{ - static uint8_t screenIndex; - static uint8_t greyIndex; - - switch(event) - { - case EVT_ENTRY: - screenIndex = 0; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_DOWN): - screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_UP): - screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - - lcdDrawText(17, 0, STR_ABOUTUS, DBLSIZE|INVERS); - lcdDrawSolidHorizontalLine(17, 16, LCD_W-17); - lcd_img(8, 0, about_bmp, 0); - LcdFlags att = 0; - - uint8_t screenDuration = 150; - - switch (screenIndex) { - case ABOUT_OPENTX: - case ABOUT_END: - lcdDrawText(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE); - lcdDrawText(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE); - lcdDrawText(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE); - lcdDrawText(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE); - lcdDrawText(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE); - screenDuration = 255; - break; - - case ABOUT_BERTRAND: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE); - break; - - case ABOUT_ANDRE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE); - break; - - case ABOUT_MIKE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_MIKE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_MIKE_4, att|SMLSIZE); - break; - - case ABOUT_KJELL: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_KJELL_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_KJELL_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_KJELL_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_KJELL_4, att|SMLSIZE); - break; - - case ABOUT_MARTIN: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE); - break; - - case ABOUT_ROMOLO: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE); - break; - - case ABOUT_ROB: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROB_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE); - break; - - case ABOUT_HARDWARE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE); - break; - - case ABOUT_PARENTS: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE); - screenDuration = 255; - break; - } - - if (++greyIndex == screenDuration) { - greyIndex = 0; - if (++screenIndex == ABOUT_COUNT) { - chainMenu(menuMainView); - } - } -} +#include "opentx.h" + +const pm_uchar about_bmp[] PROGMEM = { +#include "about.lbm" +}; + +enum AboutScreens { + ABOUT_OPENTX, + ABOUT_BERTRAND, + ABOUT_ANDRE, + ABOUT_MIKE, + ABOUT_KJELL, + ABOUT_MARTIN, + ABOUT_ROMOLO, + ABOUT_ROB, + ABOUT_HARDWARE, + ABOUT_PARENTS, + ABOUT_END, + ABOUT_COUNT, +}; + +#define ABOUT_X 2 +#define ABOUT_INDENT 4 + +void menuAboutView(uint8_t event) +{ + static uint8_t screenIndex; + static uint8_t greyIndex; + + switch(event) + { + case EVT_ENTRY: + screenIndex = 0; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_DOWN): + screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_UP): + screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_EXIT): + chainMenu(menuMainView); + break; + } + + lcdDrawText(17, 0, STR_ABOUTUS, DBLSIZE|INVERS); + lcdDrawSolidHorizontalLine(17, 16, LCD_W-17); + lcd_img(8, 0, about_bmp, 0); + LcdFlags att = 0; + + uint8_t screenDuration = 150; + + switch (screenIndex) { + case ABOUT_OPENTX: + case ABOUT_END: + lcdDrawText(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE); + lcdDrawText(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE); + lcdDrawText(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE); + lcdDrawText(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE); + lcdDrawText(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE); + screenDuration = 255; + break; + + case ABOUT_BERTRAND: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE); + break; + + case ABOUT_ANDRE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE); + break; + + case ABOUT_MIKE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_MIKE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_MIKE_4, att|SMLSIZE); + break; + + case ABOUT_KJELL: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_KJELL_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_KJELL_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_KJELL_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_KJELL_4, att|SMLSIZE); + break; + + case ABOUT_MARTIN: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE); + break; + + case ABOUT_ROMOLO: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE); + break; + + case ABOUT_ROB: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROB_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE); + break; + + case ABOUT_HARDWARE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE); + break; + + case ABOUT_PARENTS: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE); + screenDuration = 255; + break; + } + + if (++greyIndex == screenDuration) { + greyIndex = 0; + if (++screenIndex == ABOUT_COUNT) { + chainMenu(menuMainView); + } + } +} diff --git a/radio/src/gui/9x/view_main.cpp b/radio/src/gui/128x64/view_main.cpp similarity index 100% rename from radio/src/gui/9x/view_main.cpp rename to radio/src/gui/128x64/view_main.cpp diff --git a/radio/src/gui/9x/view_mavlink.cpp b/radio/src/gui/128x64/view_mavlink.cpp similarity index 100% rename from radio/src/gui/9x/view_mavlink.cpp rename to radio/src/gui/128x64/view_mavlink.cpp diff --git a/radio/src/gui/9x/view_mavlink.h b/radio/src/gui/128x64/view_mavlink.h similarity index 100% rename from radio/src/gui/9x/view_mavlink.h rename to radio/src/gui/128x64/view_mavlink.h diff --git a/radio/src/gui/9x/view_statistics.cpp b/radio/src/gui/128x64/view_statistics.cpp similarity index 97% rename from radio/src/gui/9x/view_statistics.cpp rename to radio/src/gui/128x64/view_statistics.cpp index fa6b841a3..10c3efc7e 100644 --- a/radio/src/gui/9x/view_statistics.cpp +++ b/radio/src/gui/128x64/view_statistics.cpp @@ -1,200 +1,200 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -void menuStatisticsView(uint8_t event) -{ - TITLE(STR_MENUSTAT); - - switch(event) - { - case EVT_KEY_FIRST(KEY_UP): - chainMenu(menuStatisticsDebug); - break; - -#if defined(CPUARM) - case EVT_KEY_LONG(KEY_MENU): - g_eeGeneral.globalTimer = 0; - storageDirty(EE_GENERAL); - sessionTimer = 0; - break; -#endif - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - - lcdDrawText( 1*FW, FH*0, STR_TOTTM1TM2THRTHP); - putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); - - putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); - - putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0); - -#if defined(THRTRACE) - const coord_t x = 5; - const coord_t y = 60; - lcdDrawSolidHorizontalLine(x-3, y, MAXTRACE+3+3); - lcdDrawSolidVerticalLine(x, y-32, 32+3); - for (coord_t i=0; i MAXTRACE ? s_traceWr - MAXTRACE : 0; - for (coord_t i=1; i<=MAXTRACE && traceRd'); - putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT); - // consumption - lcd_putsLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH); - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); -#endif - -#if defined(PCBSKY9X) - lcd_putsLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP); - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT); - lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>'); - putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT); -#endif - -#if defined(COPROCESSOR) - lcd_putsLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP); - - if (Coproc_read==0) { - lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS); - } - else if (Coproc_read==0x81) { - lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Inst.TinyApp"),INVERS); - } - else if (Coproc_read<3) { - lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Upgr.TinyApp"),INVERS); - } - else { - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT); - putsValueWithUnit(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_COPROC, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT); - } -#endif - -#if defined(CPUARM) - lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); - lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); - lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); -#endif - -#if defined(CPUARM) - lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); - lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE); - lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); - lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE); - lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); - lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE); -#endif - -#if !defined(CPUARM) - lcd_putsLeft(1*FH, STR_TMR1LATMAXUS); - lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 ); - lcd_putsLeft(2*FH, STR_TMR1LATMINUS); - lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 ); - lcd_putsLeft(3*FH, STR_TMR1JITTERUS); - lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); - lcd_putsLeft(4*FH, STR_TMIXMAXMS); - lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2); - lcd_putsLeft(5*FH, STR_FREESTACKMINB); - lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ; -#endif - - lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET); - lcdInvertLastLine(); -} +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +void menuStatisticsView(uint8_t event) +{ + TITLE(STR_MENUSTAT); + + switch(event) + { + case EVT_KEY_FIRST(KEY_UP): + chainMenu(menuStatisticsDebug); + break; + +#if defined(CPUARM) + case EVT_KEY_LONG(KEY_MENU): + g_eeGeneral.globalTimer = 0; + storageDirty(EE_GENERAL); + sessionTimer = 0; + break; +#endif + case EVT_KEY_FIRST(KEY_EXIT): + chainMenu(menuMainView); + break; + } + + lcdDrawText( 1*FW, FH*0, STR_TOTTM1TM2THRTHP); + putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); + putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); + + putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); + putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); + + putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0); + +#if defined(THRTRACE) + const coord_t x = 5; + const coord_t y = 60; + lcdDrawSolidHorizontalLine(x-3, y, MAXTRACE+3+3); + lcdDrawSolidVerticalLine(x, y-32, 32+3); + for (coord_t i=0; i MAXTRACE ? s_traceWr - MAXTRACE : 0; + for (coord_t i=1; i<=MAXTRACE && traceRd'); + putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT); + // consumption + lcd_putsLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH); + putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); +#endif + +#if defined(PCBSKY9X) + lcd_putsLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP); + putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT); + lcdDrawChar(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>'); + putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT); +#endif + +#if defined(COPROCESSOR) + lcd_putsLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP); + + if (Coproc_read==0) { + lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS); + } + else if (Coproc_read==0x81) { + lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Inst.TinyApp"),INVERS); + } + else if (Coproc_read<3) { + lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Upgr.TinyApp"),INVERS); + } + else { + putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT); + putsValueWithUnit(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_COPROC, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT); + } +#endif + +#if defined(CPUARM) + lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); + lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); + lcdDrawText(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); +#endif + +#if defined(CPUARM) + lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); + lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE); + lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); + lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE); + lcdDrawText(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); + lcdDrawNumber(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE); +#endif + +#if !defined(CPUARM) + lcd_putsLeft(1*FH, STR_TMR1LATMAXUS); + lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 ); + lcd_putsLeft(2*FH, STR_TMR1LATMINUS); + lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 ); + lcd_putsLeft(3*FH, STR_TMR1JITTERUS); + lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); + lcd_putsLeft(4*FH, STR_TMIXMAXMS); + lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2); + lcd_putsLeft(5*FH, STR_FREESTACKMINB); + lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ; +#endif + + lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET); + lcdInvertLastLine(); +} diff --git a/radio/src/gui/9x/view_telemetry.cpp b/radio/src/gui/128x64/view_telemetry.cpp similarity index 100% rename from radio/src/gui/9x/view_telemetry.cpp rename to radio/src/gui/128x64/view_telemetry.cpp diff --git a/radio/src/gui/9x/view_text.cpp b/radio/src/gui/128x64/view_text.cpp similarity index 100% rename from radio/src/gui/9x/view_text.cpp rename to radio/src/gui/128x64/view_text.cpp diff --git a/radio/src/gui/9x/widgets.cpp b/radio/src/gui/128x64/widgets.cpp similarity index 100% rename from radio/src/gui/9x/widgets.cpp rename to radio/src/gui/128x64/widgets.cpp diff --git a/radio/src/gui/taranis/bmp.cpp b/radio/src/gui/212x64/bmp.cpp similarity index 100% rename from radio/src/gui/taranis/bmp.cpp rename to radio/src/gui/212x64/bmp.cpp diff --git a/radio/src/gui/taranis/fonts.cpp b/radio/src/gui/212x64/fonts.cpp similarity index 95% rename from radio/src/gui/taranis/fonts.cpp rename to radio/src/gui/212x64/fonts.cpp index f46c820c2..94197cfcd 100644 --- a/radio/src/gui/taranis/fonts.cpp +++ b/radio/src/gui/212x64/fonts.cpp @@ -1,140 +1,140 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "../../opentx.h" - -const pm_uchar font_5x7[] PROGMEM = { -#include "font_05x07.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_05x07.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_05x07.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_05x07.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_05x07.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_05x07.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_05x07.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_05x07.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_05x07.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_05x07.lbm" -#endif -}; - -const pm_uchar font_5x7_B[] PROGMEM = { -#include "font_05x07_B_compressed.lbm" -}; - -#if !defined(BOOT) -const pm_uchar font_10x14[] PROGMEM = { -#include "font_10x14_compressed.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_10x14.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_10x14.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_10x14.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_10x14.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_10x14.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_10x14.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_10x14.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_10x14.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_10x14.lbm" -#endif -}; - -const pm_uchar font_3x5[] PROGMEM = { -#include "font_03x05.lbm" -}; - -const pm_uchar font_4x6[] PROGMEM = { -#include "font_04x06.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_04x06.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_04x06.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_04x06.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_04x06.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_04x06.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_04x06.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_04x06.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_04x06.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_04x06.lbm" -#endif -}; - -const pm_uchar font_8x10[] PROGMEM = { -#include "font_08x10.lbm" -#if defined(TRANSLATIONS_DE) -#include "font_de_08x10.lbm" -#elif defined(TRANSLATIONS_CZ) -#include "font_cz_08x10.lbm" -#elif defined(TRANSLATIONS_ES) -#include "font_es_08x10.lbm" -#elif defined(TRANSLATIONS_FI) -#include "font_fi_08x10.lbm" -#elif defined(TRANSLATIONS_FR) -#include "font_fr_08x10.lbm" -#elif defined(TRANSLATIONS_IT) -#include "font_it_08x10.lbm" -#elif defined(TRANSLATIONS_PL) -#include "font_pl_08x10.lbm" -#elif defined(TRANSLATIONS_PT) -#include "font_pt_08x10.lbm" -#elif defined(TRANSLATIONS_SE) -#include "font_se_08x10.lbm" -#endif -}; - -const pm_uchar font_22x38_num[] PROGMEM = { -#include "font_22x38_num.lbm" -}; - -const pm_uchar font_4x6_extra[] PROGMEM = { -#include "font_04x06_extra.lbm" -}; - -const pm_uchar font_5x7_extra[] PROGMEM = { -#include "font_05x07_extra.lbm" -}; - -const pm_uchar font_10x14_extra[] PROGMEM = { -#include "font_10x14_extra.lbm" -}; - -#endif // !defined(BOOT) +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +const pm_uchar font_5x7[] PROGMEM = { +#include "font_05x07.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_05x07.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_05x07.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_05x07.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_05x07.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_05x07.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_05x07.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_05x07.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_05x07.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_05x07.lbm" +#endif +}; + +const pm_uchar font_5x7_B[] PROGMEM = { +#include "font_05x07_B_compressed.lbm" +}; + +#if !defined(BOOT) +const pm_uchar font_10x14[] PROGMEM = { +#include "font_10x14_compressed.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_10x14.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_10x14.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_10x14.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_10x14.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_10x14.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_10x14.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_10x14.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_10x14.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_10x14.lbm" +#endif +}; + +const pm_uchar font_3x5[] PROGMEM = { +#include "font_03x05.lbm" +}; + +const pm_uchar font_4x6[] PROGMEM = { +#include "font_04x06.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_04x06.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_04x06.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_04x06.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_04x06.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_04x06.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_04x06.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_04x06.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_04x06.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_04x06.lbm" +#endif +}; + +const pm_uchar font_8x10[] PROGMEM = { +#include "font_08x10.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_08x10.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_08x10.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_08x10.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_08x10.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_08x10.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_08x10.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_08x10.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_08x10.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_08x10.lbm" +#endif +}; + +const pm_uchar font_22x38_num[] PROGMEM = { +#include "font_22x38_num.lbm" +}; + +const pm_uchar font_4x6_extra[] PROGMEM = { +#include "font_04x06_extra.lbm" +}; + +const pm_uchar font_5x7_extra[] PROGMEM = { +#include "font_05x07_extra.lbm" +}; + +const pm_uchar font_10x14_extra[] PROGMEM = { +#include "font_10x14_extra.lbm" +}; + +#endif // !defined(BOOT) diff --git a/radio/src/gui/taranis/gui.h b/radio/src/gui/212x64/gui.h similarity index 97% rename from radio/src/gui/taranis/gui.h rename to radio/src/gui/212x64/gui.h index f7a540617..5f6ed2749 100644 --- a/radio/src/gui/taranis/gui.h +++ b/radio/src/gui/212x64/gui.h @@ -18,6 +18,10 @@ * GNU General Public License for more details. */ +#ifndef _GUI_H_ +#define _GUI_H_ + +#include "gui_helpers.h" #include "lcd.h" #include "menus.h" @@ -76,3 +80,4 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes #define displayFlightModes(...) #endif +#endif // _GUI_H_ \ No newline at end of file diff --git a/radio/src/gui/taranis/lcd.cpp b/radio/src/gui/212x64/lcd.cpp similarity index 100% rename from radio/src/gui/taranis/lcd.cpp rename to radio/src/gui/212x64/lcd.cpp diff --git a/radio/src/gui/taranis/lcd.h b/radio/src/gui/212x64/lcd.h similarity index 100% rename from radio/src/gui/taranis/lcd.h rename to radio/src/gui/212x64/lcd.h diff --git a/radio/src/gui/taranis/menu_model.cpp b/radio/src/gui/212x64/menu_model.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model.cpp rename to radio/src/gui/212x64/menu_model.cpp diff --git a/radio/src/gui/taranis/menu_general.cpp b/radio/src/gui/212x64/menu_radio.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general.cpp rename to radio/src/gui/212x64/menu_radio.cpp diff --git a/radio/src/gui/taranis/menus.cpp b/radio/src/gui/212x64/menus.cpp similarity index 100% rename from radio/src/gui/taranis/menus.cpp rename to radio/src/gui/212x64/menus.cpp diff --git a/radio/src/gui/taranis/menus.h b/radio/src/gui/212x64/menus.h similarity index 100% rename from radio/src/gui/taranis/menus.h rename to radio/src/gui/212x64/menus.h diff --git a/radio/src/gui/taranis/menu_model_curves.cpp b/radio/src/gui/212x64/model_curves.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_curves.cpp rename to radio/src/gui/212x64/model_curves.cpp diff --git a/radio/src/gui/taranis/menu_model_custom_scripts.cpp b/radio/src/gui/212x64/model_custom_scripts.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_custom_scripts.cpp rename to radio/src/gui/212x64/model_custom_scripts.cpp diff --git a/radio/src/gui/taranis/menu_model_display.cpp b/radio/src/gui/212x64/model_display.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_display.cpp rename to radio/src/gui/212x64/model_display.cpp diff --git a/radio/src/gui/taranis/menu_model_flightmodes.cpp b/radio/src/gui/212x64/model_flightmodes.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_flightmodes.cpp rename to radio/src/gui/212x64/model_flightmodes.cpp diff --git a/radio/src/gui/taranis/menu_model_gvars.cpp b/radio/src/gui/212x64/model_gvars.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_gvars.cpp rename to radio/src/gui/212x64/model_gvars.cpp diff --git a/radio/src/gui/taranis/menu_model_heli.cpp b/radio/src/gui/212x64/model_heli.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_heli.cpp rename to radio/src/gui/212x64/model_heli.cpp diff --git a/radio/src/gui/taranis/menu_model_inputs.cpp b/radio/src/gui/212x64/model_inputs.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_inputs.cpp rename to radio/src/gui/212x64/model_inputs.cpp diff --git a/radio/src/gui/taranis/menu_model_logical_switches.cpp b/radio/src/gui/212x64/model_logical_switches.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_logical_switches.cpp rename to radio/src/gui/212x64/model_logical_switches.cpp diff --git a/radio/src/gui/taranis/menu_model_mixes.cpp b/radio/src/gui/212x64/model_mixes.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_mixes.cpp rename to radio/src/gui/212x64/model_mixes.cpp diff --git a/radio/src/gui/taranis/menu_model_limits.cpp b/radio/src/gui/212x64/model_outputs.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_limits.cpp rename to radio/src/gui/212x64/model_outputs.cpp diff --git a/radio/src/gui/taranis/menu_model_select.cpp b/radio/src/gui/212x64/model_select.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_select.cpp rename to radio/src/gui/212x64/model_select.cpp diff --git a/radio/src/gui/taranis/menu_model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_setup.cpp rename to radio/src/gui/212x64/model_setup.cpp diff --git a/radio/src/gui/taranis/model_special_functions.cpp b/radio/src/gui/212x64/model_special_functions.cpp similarity index 100% rename from radio/src/gui/taranis/model_special_functions.cpp rename to radio/src/gui/212x64/model_special_functions.cpp diff --git a/radio/src/gui/taranis/menu_model_telemetry.cpp b/radio/src/gui/212x64/model_telemetry.cpp similarity index 100% rename from radio/src/gui/taranis/menu_model_telemetry.cpp rename to radio/src/gui/212x64/model_telemetry.cpp diff --git a/radio/src/gui/taranis/navigation.cpp b/radio/src/gui/212x64/navigation.cpp similarity index 100% rename from radio/src/gui/taranis/navigation.cpp rename to radio/src/gui/212x64/navigation.cpp diff --git a/radio/src/gui/taranis/popups.cpp b/radio/src/gui/212x64/popups.cpp similarity index 100% rename from radio/src/gui/taranis/popups.cpp rename to radio/src/gui/212x64/popups.cpp diff --git a/radio/src/gui/taranis/radio_calibration.cpp b/radio/src/gui/212x64/radio_calibration.cpp similarity index 100% rename from radio/src/gui/taranis/radio_calibration.cpp rename to radio/src/gui/212x64/radio_calibration.cpp diff --git a/radio/src/gui/taranis/menu_general_diaganas.cpp b/radio/src/gui/212x64/radio_diaganas.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_diaganas.cpp rename to radio/src/gui/212x64/radio_diaganas.cpp diff --git a/radio/src/gui/taranis/menu_general_diagkeys.cpp b/radio/src/gui/212x64/radio_diagkeys.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_diagkeys.cpp rename to radio/src/gui/212x64/radio_diagkeys.cpp diff --git a/radio/src/gui/taranis/menu_general_hardware.cpp b/radio/src/gui/212x64/radio_hardware.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_hardware.cpp rename to radio/src/gui/212x64/radio_hardware.cpp diff --git a/radio/src/gui/taranis/menu_general_sdmanager.cpp b/radio/src/gui/212x64/radio_sdmanager.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_sdmanager.cpp rename to radio/src/gui/212x64/radio_sdmanager.cpp diff --git a/radio/src/gui/taranis/radio_setup.cpp b/radio/src/gui/212x64/radio_setup.cpp similarity index 100% rename from radio/src/gui/taranis/radio_setup.cpp rename to radio/src/gui/212x64/radio_setup.cpp diff --git a/radio/src/gui/taranis/menu_general_trainer.cpp b/radio/src/gui/212x64/radio_trainer.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_trainer.cpp rename to radio/src/gui/212x64/radio_trainer.cpp diff --git a/radio/src/gui/taranis/menu_general_version.cpp b/radio/src/gui/212x64/radio_version.cpp similarity index 100% rename from radio/src/gui/taranis/menu_general_version.cpp rename to radio/src/gui/212x64/radio_version.cpp diff --git a/radio/src/gui/taranis/splash.cpp b/radio/src/gui/212x64/splash.cpp similarity index 96% rename from radio/src/gui/taranis/splash.cpp rename to radio/src/gui/212x64/splash.cpp index 0a5ce7990..00d9cf7e9 100644 --- a/radio/src/gui/taranis/splash.cpp +++ b/radio/src/gui/212x64/splash.cpp @@ -23,7 +23,7 @@ #if defined(SPLASH) const pm_uchar splashdata[] PROGMEM = { 'S','P','S',0, - #include "bitmaps/taranis/splash.lbm" + #include "bitmaps/212x64/splash.lbm" 'S','P','E',0 }; const pm_uchar * const splash_lbm = splashdata+4; diff --git a/radio/src/gui/taranis/view_about.cpp b/radio/src/gui/212x64/view_about.cpp similarity index 96% rename from radio/src/gui/taranis/view_about.cpp rename to radio/src/gui/212x64/view_about.cpp index e2224ff94..cc71062d4 100644 --- a/radio/src/gui/taranis/view_about.cpp +++ b/radio/src/gui/212x64/view_about.cpp @@ -1,151 +1,151 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -const pm_uchar about_bmp[] PROGMEM = { -#include "../../bitmaps/taranis/about.lbm" -}; - -enum AboutScreens { - ABOUT_OPENTX, - ABOUT_BERTRAND, - ABOUT_ANDRE, - ABOUT_MIKE, - ABOUT_KJELL, - ABOUT_MARTIN, - ABOUT_ROMOLO, - ABOUT_ROB, - ABOUT_HARDWARE, - ABOUT_PARENTS, - ABOUT_END, - ABOUT_COUNT, -}; - -#define ABOUT_X 62 -#define ABOUT_INDENT 6 - -void menuAboutView(uint8_t event) -{ - static uint8_t screenIndex; - static uint8_t greyIndex; - - switch(event) - { - case EVT_ENTRY: - screenIndex = 0; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_DOWN): - screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_UP): - screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS; - greyIndex = 0; - break; - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - - lcdDrawBitmap(0, 0, about_bmp); - lcdDrawText(64, 0, STR_ABOUTUS, DBLSIZE); - lcdDrawSolidHorizontalLine(ABOUT_X, 18, 120); - lcdDrawSolidHorizontalLine(ABOUT_X, 19, 130, GREY_DEFAULT); - LcdFlags att = GREY(max(0, 15-greyIndex/2)); - - uint8_t screenDuration = 150; - - switch (screenIndex) { - case ABOUT_OPENTX: - case ABOUT_END: - lcdDrawText(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE); - lcdDrawText(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE); - lcdDrawText(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE); - lcdDrawText(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE); - lcdDrawText(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE); - screenDuration = 255; - break; - - case ABOUT_BERTRAND: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE); - break; - - case ABOUT_ANDRE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE); - break; - - case ABOUT_MIKE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_MIKE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_MIKE_4, att|SMLSIZE); - break; - - case ABOUT_KJELL: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_KJELL_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_KJELL_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_KJELL_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_KJELL_4, att|SMLSIZE); - break; - - case ABOUT_MARTIN: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE); - break; - - case ABOUT_ROMOLO: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE); - break; - - case ABOUT_ROB: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROB_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE); - break; - - case ABOUT_HARDWARE: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE); - break; - - case ABOUT_PARENTS: - lcdDrawText(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE); - lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE); - screenDuration = 255; - break; - } - - if (++greyIndex == screenDuration) { - greyIndex = 0; - if (++screenIndex == ABOUT_COUNT) { - chainMenu(menuMainView); - } - } -} +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +const pm_uchar about_bmp[] PROGMEM = { +#include "about.lbm" +}; + +enum AboutScreens { + ABOUT_OPENTX, + ABOUT_BERTRAND, + ABOUT_ANDRE, + ABOUT_MIKE, + ABOUT_KJELL, + ABOUT_MARTIN, + ABOUT_ROMOLO, + ABOUT_ROB, + ABOUT_HARDWARE, + ABOUT_PARENTS, + ABOUT_END, + ABOUT_COUNT, +}; + +#define ABOUT_X 62 +#define ABOUT_INDENT 6 + +void menuAboutView(uint8_t event) +{ + static uint8_t screenIndex; + static uint8_t greyIndex; + + switch(event) + { + case EVT_ENTRY: + screenIndex = 0; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_DOWN): + screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_UP): + screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_EXIT): + chainMenu(menuMainView); + break; + } + + lcdDrawBitmap(0, 0, about_bmp); + lcdDrawText(64, 0, STR_ABOUTUS, DBLSIZE); + lcdDrawSolidHorizontalLine(ABOUT_X, 18, 120); + lcdDrawSolidHorizontalLine(ABOUT_X, 19, 130, GREY_DEFAULT); + LcdFlags att = GREY(max(0, 15-greyIndex/2)); + + uint8_t screenDuration = 150; + + switch (screenIndex) { + case ABOUT_OPENTX: + case ABOUT_END: + lcdDrawText(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE); + lcdDrawText(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE); + lcdDrawText(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE); + lcdDrawText(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE); + lcdDrawText(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE); + screenDuration = 255; + break; + + case ABOUT_BERTRAND: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE); + break; + + case ABOUT_ANDRE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE); + break; + + case ABOUT_MIKE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_MIKE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_MIKE_4, att|SMLSIZE); + break; + + case ABOUT_KJELL: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_KJELL_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_KJELL_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_KJELL_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_KJELL_4, att|SMLSIZE); + break; + + case ABOUT_MARTIN: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE); + break; + + case ABOUT_ROMOLO: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE); + break; + + case ABOUT_ROB: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_ROB_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE); + break; + + case ABOUT_HARDWARE: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE); + break; + + case ABOUT_PARENTS: + lcdDrawText(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE); + lcdDrawText(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE); + screenDuration = 255; + break; + } + + if (++greyIndex == screenDuration) { + greyIndex = 0; + if (++screenIndex == ABOUT_COUNT) { + chainMenu(menuMainView); + } + } +} diff --git a/radio/src/gui/taranis/view_channels.cpp b/radio/src/gui/212x64/view_channels.cpp similarity index 96% rename from radio/src/gui/taranis/view_channels.cpp rename to radio/src/gui/212x64/view_channels.cpp index 777de1448..ef88610b3 100644 --- a/radio/src/gui/taranis/view_channels.cpp +++ b/radio/src/gui/212x64/view_channels.cpp @@ -1,116 +1,116 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -void menuChannelsView(uint8_t event) -{ - static bool longNames = false; - bool newLongNames = false; - static bool secondPage = false; -#ifdef MIXERS_MONITOR - static bool mixersView = false; -#endif - uint8_t ch; - - switch(event) - { - case EVT_KEY_BREAK(KEY_EXIT): - popMenu(); - break; - case EVT_KEY_FIRST(KEY_RIGHT): - case EVT_KEY_FIRST(KEY_LEFT): - secondPage = !secondPage; - break; -#ifdef MIXERS_MONITOR - case EVT_KEY_FIRST(KEY_ENTER): - mixersView = !mixersView; - break; -#endif - } - - if (secondPage) - ch = 16; - else - ch = 0; - -#ifdef MIXERS_MONITOR - if (mixersView) - lcd_putsCenter(0*FH, MIXERS_MONITOR); - else -#endif - lcd_putsCenter(0*FH, CHANNELS_MONITOR); - - lcdInvertLine(0); - - // Column separator - lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH); - - for (uint8_t col=0; col<2; col++) { - - uint8_t x = col*LCD_W/2+1; - - // Channels - for (uint8_t line=0; line<8; line++) { - uint8_t y = 9+line*7; -#ifdef MIXERS_MONITOR - int32_t val = (mixersView) ? ex_chans[ch] : channelOutputs[ch]; -#else - int32_t val = channelOutputs[ch]; -#endif - uint8_t ofs = (col ? 0 : 1); - - // Channel name if present, number if not - uint8_t lenLabel = ZLEN(g_model.limitData[ch].name); - if (lenLabel > 4) { - newLongNames = longNames = true; - } - - if (lenLabel > 0) - lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE); - else - putsChn(x+1-ofs, y, ch+1, SMLSIZE); - - // Value -#if defined(PPM_UNIT_US) - uint8_t wbar = (longNames ? 54 : 64); - lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE|RIGHT); -#elif defined(PPM_UNIT_PERCENT_PREC1) - uint8_t wbar = (longNames ? 48 : 58); - lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT); -#else - uint8_t wbar = (longNames ? 54 : 64); - lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT); -#endif - - // Gauge -#ifdef MIXERS_MONITOR - uint16_t lim = mixersView ? 512*2*2 : (g_model.extendedLimits ? 640*2 : 512*2); -#else - uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; -#endif - drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim); - - ch++; - } - } - - longNames = newLongNames; -} +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +void menuChannelsView(uint8_t event) +{ + static bool longNames = false; + bool newLongNames = false; + static bool secondPage = false; +#ifdef MIXERS_MONITOR + static bool mixersView = false; +#endif + uint8_t ch; + + switch(event) + { + case EVT_KEY_BREAK(KEY_EXIT): + popMenu(); + break; + case EVT_KEY_FIRST(KEY_RIGHT): + case EVT_KEY_FIRST(KEY_LEFT): + secondPage = !secondPage; + break; +#ifdef MIXERS_MONITOR + case EVT_KEY_FIRST(KEY_ENTER): + mixersView = !mixersView; + break; +#endif + } + + if (secondPage) + ch = 16; + else + ch = 0; + +#ifdef MIXERS_MONITOR + if (mixersView) + lcd_putsCenter(0*FH, MIXERS_MONITOR); + else +#endif + lcd_putsCenter(0*FH, CHANNELS_MONITOR); + + lcdInvertLine(0); + + // Column separator + lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH); + + for (uint8_t col=0; col<2; col++) { + + uint8_t x = col*LCD_W/2+1; + + // Channels + for (uint8_t line=0; line<8; line++) { + uint8_t y = 9+line*7; +#ifdef MIXERS_MONITOR + int32_t val = (mixersView) ? ex_chans[ch] : channelOutputs[ch]; +#else + int32_t val = channelOutputs[ch]; +#endif + uint8_t ofs = (col ? 0 : 1); + + // Channel name if present, number if not + uint8_t lenLabel = ZLEN(g_model.limitData[ch].name); + if (lenLabel > 4) { + newLongNames = longNames = true; + } + + if (lenLabel > 0) + lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE); + else + putsChn(x+1-ofs, y, ch+1, SMLSIZE); + + // Value +#if defined(PPM_UNIT_US) + uint8_t wbar = (longNames ? 54 : 64); + lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE|RIGHT); +#elif defined(PPM_UNIT_PERCENT_PREC1) + uint8_t wbar = (longNames ? 48 : 58); + lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT); +#else + uint8_t wbar = (longNames ? 54 : 64); + lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT); +#endif + + // Gauge +#ifdef MIXERS_MONITOR + uint16_t lim = mixersView ? 512*2*2 : (g_model.extendedLimits ? 640*2 : 512*2); +#else + uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; +#endif + drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim); + + ch++; + } + } + + longNames = newLongNames; +} diff --git a/radio/src/gui/taranis/view_main.cpp b/radio/src/gui/212x64/view_main.cpp similarity index 96% rename from radio/src/gui/taranis/view_main.cpp rename to radio/src/gui/212x64/view_main.cpp index cf0cbcf34..c963ae80b 100644 --- a/radio/src/gui/taranis/view_main.cpp +++ b/radio/src/gui/212x64/view_main.cpp @@ -1,591 +1,591 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -#define BIGSIZE MIDSIZE -#define LBOX_CENTERX (BOX_WIDTH/2 + 16) -#define RBOX_CENTERX (LCD_W-LBOX_CENTERX-1) -#define MODELNAME_X (15) -#define MODELNAME_Y (11) -#define VBATT_X (MODELNAME_X+26) -#define VBATT_Y (FH+3) -#define VBATTUNIT_X (VBATT_X-2) -#define VBATTUNIT_Y VBATT_Y -#define BITMAP_X ((LCD_W-64)/2) -#define BITMAP_Y (LCD_H/2) -#define PHASE_X BITMAP_X -#define PHASE_Y (3*FH) -#define PHASE_FLAGS (0) -#define TIMERS_X 145 -#define TIMERS_Y 20 -#define TIMERS_H 25 -#define TIMERS_R 193 -#define REBOOT_X (LCD_W-FW) -#define VSWITCH_X(i) (((i>=NUM_LOGICAL_SWITCH*3/4) ? BITMAP_X+28 : ((i>=NUM_LOGICAL_SWITCH/2) ? BITMAP_X+25 : ((i>=NUM_LOGICAL_SWITCH/4) ? 21 : 18))) + 3*i) -#define VSWITCH_Y (LCD_H-9) -#define TRIM_LH_X (32+9) -#define TRIM_LV_X 10 -#define TRIM_RV_X (LCD_W-11) -#define TRIM_RH_X (LCD_W-32-9) - -#define TRIM_LEN 27 -#define MARKER_WIDTH 5 - -const pm_uchar logo_taranis[] PROGMEM = { -#include "../../bitmaps/taranis/logo.lbm" -}; - -const pm_uchar icons[] PROGMEM = { -#include "../../bitmaps/taranis/icons.lbm" -}; - -#define ICON_RSSI 0, 9 -#define ICON_SPEAKER0 9, 8 -#define ICON_SPEAKER1 17, 8 -#define ICON_SPEAKER2 25, 8 -#define ICON_SPEAKER3 33, 8 -#define ICON_SD 41, 11 -#define ICON_LOGS 51, 11 -#define ICON_TRAINER 61, 11 -#define ICON_TRAINEE 71, 11 -#define ICON_USB 81, 11 -#define ICON_REBOOT 91, 11 -#define ICON_ALTITUDE 102, 9 - -void doMainScreenGraphics() -{ - int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)]; - if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK) - calibStickVert = -calibStickVert; - drawStick(LBOX_CENTERX, calibratedStick[CONVERT_MODE(0)], calibStickVert); - - calibStickVert = calibratedStick[CONVERT_MODE(2)]; - if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK) - calibStickVert = -calibStickVert; - drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert); -} - -void displayTrims(uint8_t phase) -{ - for (unsigned int i=0; i TRIM_MAX) { - exttrim = true; - } - if (val < -(TRIM_LEN+1)*4) { - val = -(TRIM_LEN+1); - } - else if (val > (TRIM_LEN+1)*4) { - val = TRIM_LEN+1; - } - else { - val /= 4; - } - - if (vert[i]) { - ym = 31; - lcdDrawSolidVerticalLine(xm, ym-TRIM_LEN, TRIM_LEN*2); - if (i!=2 || !g_model.thrTrim) { - lcdDrawSolidVerticalLine(xm-1, ym-1, 3); - lcdDrawSolidVerticalLine(xm+1, ym-1, 3); - } - ym -= val; - lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); - if (trim >= 0) { - lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); - } - if (trim <= 0) { - lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); - } - if (exttrim) { - lcdDrawSolidHorizontalLine(xm-1, ym, 3); - } - if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { - if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<0 ? 22 : 54, xm-2, -abs(trim), RIGHT|TINSIZE|VERTICAL); - } - } - } - else { - ym = 60; - lcdDrawSolidHorizontalLine(xm-TRIM_LEN, ym, TRIM_LEN*2); - lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); - lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); - xm += val; - lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); - if (trim >= 0) { - lcdDrawSolidVerticalLine(xm+1, ym-1, 3); - } - if (trim <= 0) { - lcdDrawSolidVerticalLine(xm-1, ym-1, 3); - } - if (exttrim) { - lcdDrawSolidVerticalLine(xm, ym-1, 3); - } - if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { - if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<0 ? -11 : 20), ym-2, -abs(trim), RIGHT|TINSIZE); - } - } - } - lcdDrawSquare(xm-3, ym-3, 7, att); - } -} - -void drawSliders() -{ - for (uint8_t i=NUM_STICKS; i=SLIDER1 ? LCD_H/2+1 : 1); -#endif - lcdDrawSolidVerticalLine(x, y, LCD_H/2-2); - lcdDrawSolidVerticalLine(x+1, y, LCD_H/2-2); - y += LCD_H/2-4; - y -= ((calibratedStick[i]+RESX)*(LCD_H/2-4)/(RESX*2)); // calculate once per loop - lcdDrawSolidVerticalLine(x-1, y, 2); - lcdDrawSolidVerticalLine(x+2, y, 2); - } -} - -#define BAR_X 14 -#define BAR_Y 1 -#define BAR_W 184 -#define BAR_H 9 -#define BAR_NOTIFS_X BAR_X+133 -#define BAR_VOLUME_X BAR_X+147 -#define BAR_TIME_X BAR_X+159 - -void displayTopBarGauge(coord_t x, int count, bool blinking=false) -{ - if (!blinking || BLINK_ON_PHASE) - lcdDrawFilledRect(x+1, BAR_Y+2, 11, 5, SOLID, ERASE); - for (int i=0; i 0) { - displayTopBarGauge(batt_icon_x+5*FW, TELEMETRY_RSSI() / 10, TELEMETRY_RSSI() < getRssiAlarmValue(0)); - } -} - -void displayTimers() -{ - // Main and Second timer - for (unsigned int i=0; i<2; i++) { - if (g_model.timers[i].mode) { - TimerState & timerState = timersStates[i]; - TimerData & timerData = g_model.timers[i]; - uint8_t y = TIMERS_Y + i*TIMERS_H; - if (ZLEN(timerData.name) > 0) { - lcdDrawSizedText(TIMERS_X, y-7, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE); - } - else { - putsTimerMode(TIMERS_X, y-7, timerData.mode, SMLSIZE); - } - putsTimer(TIMERS_X, y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT); - if (timerData.persistent) { - lcdDrawChar(TIMERS_R, y+1, 'P', SMLSIZE); - } - if (timerState.val < 0) { - if (BLINK_ON_PHASE) { - lcdDrawFilledRect(TIMERS_X-7, y-8, 60, 20); - } - } - } - } -} - -void menuMainViewChannelsMonitor(uint8_t event) -{ - switch(event) { - case EVT_KEY_BREAK(KEY_PAGE): - case EVT_KEY_BREAK(KEY_EXIT): - chainMenu(menuMainView); - event = 0; - break; - } - - return menuChannelsView(event); -} - -void onMainViewMenu(const char *result) -{ - if (result == STR_RESET_TIMER1) { - timerReset(0); - } - else if (result == STR_RESET_TIMER2) { - timerReset(1); - } -#if TIMERS > 2 - else if (result == STR_RESET_TIMER3) { - timerReset(2); - } -#endif - else if (result == STR_VIEW_NOTES) { - pushModelNotes(); - } - else if (result == STR_RESET_SUBMENU) { - POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT); - POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1); - POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2); - POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3); - POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY); - } - else if (result == STR_RESET_TELEMETRY) { - telemetryReset(); - } - else if (result == STR_RESET_FLIGHT) { - flightReset(); - } - else if (result == STR_STATISTICS) { - chainMenu(menuStatisticsView); - } - else if (result == STR_ABOUT_US) { - chainMenu(menuAboutView); - } -} - -void displaySwitch(coord_t x, coord_t y, int width, unsigned int index) -{ - if (SWITCH_EXISTS(index)) { - int val = getValue(MIXSRC_FIRST_SWITCH+index); - - if (val >= 0) { - lcdDrawSolidHorizontalLine(x, y, width); - lcdDrawSolidHorizontalLine(x, y+2, width); - y += 4; - if (val > 0) { - lcdDrawSolidHorizontalLine(x, y, width); - lcdDrawSolidHorizontalLine(x, y+2, width); - y += 4; - } - } - - lcdDrawChar(width==5 ? x+1 : x, y, 'A'+index, TINSIZE); - y += 6; - - if (val <= 0) { - lcdDrawSolidHorizontalLine(x, y, width); - lcdDrawSolidHorizontalLine(x, y+2, width); - if (val < 0) { - lcdDrawSolidHorizontalLine(x, y+4, width); - lcdDrawSolidHorizontalLine(x, y+6, width); - } - } - } -} - -const MenuItem MAIN_MENU[] = { - { "RADIO SETTINGS", menuGeneralSetup }, - { "MODEL SELECT", menuModelSelect }, - { "MODEL SETTINGS", menuModelSetup }, - { "CHECKLIST", menuModelNotes }, - { "SD MANAGER", menuGeneralSdManager }, - { "VERSION", menuGeneralVersion } -}; - -bool isMenuAvailable(int index) -{ - if (index == 4) { - return modelHasNotes(); - } - else { - return true; - } -} - -int getSwitchCount() -{ - int count = 0; - for (int i=0; i= VIEW_COUNT) { - g_model.view = 0; - chainMenu(menuMainViewChannelsMonitor); - } - break; - - case EVT_KEY_LONG(KEY_PAGE): - if (!IS_FAI_ENABLED()) - chainMenu(menuTelemetryFrsky); - killEvents(event); - break; - - case EVT_KEY_FIRST(KEY_EXIT): -#if defined(GVARS) - if (gvarDisplayTimer > 0) { - gvarDisplayTimer = 0; - } -#endif - break; - } - - // Flight Mode Name - int mode = mixerCurrentFlightMode; - lcdDrawSizedText(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|PHASE_FLAGS); - - // Model Name - putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE); - - // Trims sliders - displayTrims(mode); - - // Top bar - displayTopBar(); - - // Sliders (Pots / Sliders) - drawSliders(); - - lcdDrawBitmap(BITMAP_X, BITMAP_Y, modelBitmap); - - // Switches - if (getSwitchCount() > 8) { - for (int i=0; i= 14) qr2.rem += 1; - const coord_t x[4] = { 50, 142 }; - const coord_t y[4] = { 25, 42, 25, 42 }; - displaySwitch(x[qr.quot]+qr2.rem*4, y[qr2.quot], 3, i); - } - else { - displaySwitch(17+qr.rem*6, 25+qr.quot*17, 5, i); - } - } - } - else { - int index = 0; - for (int i=0; i= 5 ? 3 : 0); - LogicalSwitchData * cs = lswAddress(sw); - if (cs->func == LS_FUNC_NONE) { - lcdDrawSolidHorizontalLine(x, y+6, 4); - lcdDrawSolidHorizontalLine(x, y+7, 4); - } - else if (getSwitch(SWSRC_SW1+sw)) { - lcdDrawFilledRect(x, y, 4, 8); - } - else { - lcdDrawRect(x, y, 4, 8); - } - } - } - -#if defined(GVARS) - if (gvarDisplayTimer > 0) { - gvarDisplayTimer--; - lcdDrawFilledRect(BITMAP_X, BITMAP_Y, 64, 32, SOLID, ERASE); - lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32); - drawStringWithIndex(BITMAP_X+FW, BITMAP_Y+FH-1, STR_GV, gvarLastChanged+1); - lcdDrawSizedText(BITMAP_X+4*FW+FW/2, BITMAP_Y+FH-1, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); - lcdDrawText(BITMAP_X+FW, BITMAP_Y+2*FH+3, PSTR("["), BOLD); - drawGVarValue(BITMAP_X+2*FW, BITMAP_Y+2*FH+3, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); - lcdDrawText(lcdLastPos, BITMAP_Y+2*FH+3, PSTR("]"), BOLD); - } -#endif -} +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +#define BIGSIZE MIDSIZE +#define LBOX_CENTERX (BOX_WIDTH/2 + 16) +#define RBOX_CENTERX (LCD_W-LBOX_CENTERX-1) +#define MODELNAME_X (15) +#define MODELNAME_Y (11) +#define VBATT_X (MODELNAME_X+26) +#define VBATT_Y (FH+3) +#define VBATTUNIT_X (VBATT_X-2) +#define VBATTUNIT_Y VBATT_Y +#define BITMAP_X ((LCD_W-64)/2) +#define BITMAP_Y (LCD_H/2) +#define PHASE_X BITMAP_X +#define PHASE_Y (3*FH) +#define PHASE_FLAGS (0) +#define TIMERS_X 145 +#define TIMERS_Y 20 +#define TIMERS_H 25 +#define TIMERS_R 193 +#define REBOOT_X (LCD_W-FW) +#define VSWITCH_X(i) (((i>=NUM_LOGICAL_SWITCH*3/4) ? BITMAP_X+28 : ((i>=NUM_LOGICAL_SWITCH/2) ? BITMAP_X+25 : ((i>=NUM_LOGICAL_SWITCH/4) ? 21 : 18))) + 3*i) +#define VSWITCH_Y (LCD_H-9) +#define TRIM_LH_X (32+9) +#define TRIM_LV_X 10 +#define TRIM_RV_X (LCD_W-11) +#define TRIM_RH_X (LCD_W-32-9) + +#define TRIM_LEN 27 +#define MARKER_WIDTH 5 + +const pm_uchar logo_taranis[] PROGMEM = { +#include "../../bitmaps/212x64/logo.lbm" +}; + +const pm_uchar icons[] PROGMEM = { +#include "../../bitmaps/212x64/icons.lbm" +}; + +#define ICON_RSSI 0, 9 +#define ICON_SPEAKER0 9, 8 +#define ICON_SPEAKER1 17, 8 +#define ICON_SPEAKER2 25, 8 +#define ICON_SPEAKER3 33, 8 +#define ICON_SD 41, 11 +#define ICON_LOGS 51, 11 +#define ICON_TRAINER 61, 11 +#define ICON_TRAINEE 71, 11 +#define ICON_USB 81, 11 +#define ICON_REBOOT 91, 11 +#define ICON_ALTITUDE 102, 9 + +void doMainScreenGraphics() +{ + int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)]; + if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK) + calibStickVert = -calibStickVert; + drawStick(LBOX_CENTERX, calibratedStick[CONVERT_MODE(0)], calibStickVert); + + calibStickVert = calibratedStick[CONVERT_MODE(2)]; + if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK) + calibStickVert = -calibStickVert; + drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert); +} + +void displayTrims(uint8_t phase) +{ + for (unsigned int i=0; i TRIM_MAX) { + exttrim = true; + } + if (val < -(TRIM_LEN+1)*4) { + val = -(TRIM_LEN+1); + } + else if (val > (TRIM_LEN+1)*4) { + val = TRIM_LEN+1; + } + else { + val /= 4; + } + + if (vert[i]) { + ym = 31; + lcdDrawSolidVerticalLine(xm, ym-TRIM_LEN, TRIM_LEN*2); + if (i!=2 || !g_model.thrTrim) { + lcdDrawSolidVerticalLine(xm-1, ym-1, 3); + lcdDrawSolidVerticalLine(xm+1, ym-1, 3); + } + ym -= val; + lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); + if (trim >= 0) { + lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); + } + if (trim <= 0) { + lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); + } + if (exttrim) { + lcdDrawSolidHorizontalLine(xm-1, ym, 3); + } + if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { + if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<0 ? 22 : 54, xm-2, -abs(trim), RIGHT|TINSIZE|VERTICAL); + } + } + } + else { + ym = 60; + lcdDrawSolidHorizontalLine(xm-TRIM_LEN, ym, TRIM_LEN*2); + lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); + lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); + xm += val; + lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); + if (trim >= 0) { + lcdDrawSolidVerticalLine(xm+1, ym-1, 3); + } + if (trim <= 0) { + lcdDrawSolidVerticalLine(xm-1, ym-1, 3); + } + if (exttrim) { + lcdDrawSolidVerticalLine(xm, ym-1, 3); + } + if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { + if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<0 ? -11 : 20), ym-2, -abs(trim), RIGHT|TINSIZE); + } + } + } + lcdDrawSquare(xm-3, ym-3, 7, att); + } +} + +void drawSliders() +{ + for (uint8_t i=NUM_STICKS; i=SLIDER1 ? LCD_H/2+1 : 1); +#endif + lcdDrawSolidVerticalLine(x, y, LCD_H/2-2); + lcdDrawSolidVerticalLine(x+1, y, LCD_H/2-2); + y += LCD_H/2-4; + y -= ((calibratedStick[i]+RESX)*(LCD_H/2-4)/(RESX*2)); // calculate once per loop + lcdDrawSolidVerticalLine(x-1, y, 2); + lcdDrawSolidVerticalLine(x+2, y, 2); + } +} + +#define BAR_X 14 +#define BAR_Y 1 +#define BAR_W 184 +#define BAR_H 9 +#define BAR_NOTIFS_X BAR_X+133 +#define BAR_VOLUME_X BAR_X+147 +#define BAR_TIME_X BAR_X+159 + +void displayTopBarGauge(coord_t x, int count, bool blinking=false) +{ + if (!blinking || BLINK_ON_PHASE) + lcdDrawFilledRect(x+1, BAR_Y+2, 11, 5, SOLID, ERASE); + for (int i=0; i 0) { + displayTopBarGauge(batt_icon_x+5*FW, TELEMETRY_RSSI() / 10, TELEMETRY_RSSI() < getRssiAlarmValue(0)); + } +} + +void displayTimers() +{ + // Main and Second timer + for (unsigned int i=0; i<2; i++) { + if (g_model.timers[i].mode) { + TimerState & timerState = timersStates[i]; + TimerData & timerData = g_model.timers[i]; + uint8_t y = TIMERS_Y + i*TIMERS_H; + if (ZLEN(timerData.name) > 0) { + lcdDrawSizedText(TIMERS_X, y-7, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE); + } + else { + putsTimerMode(TIMERS_X, y-7, timerData.mode, SMLSIZE); + } + putsTimer(TIMERS_X, y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT); + if (timerData.persistent) { + lcdDrawChar(TIMERS_R, y+1, 'P', SMLSIZE); + } + if (timerState.val < 0) { + if (BLINK_ON_PHASE) { + lcdDrawFilledRect(TIMERS_X-7, y-8, 60, 20); + } + } + } + } +} + +void menuMainViewChannelsMonitor(uint8_t event) +{ + switch(event) { + case EVT_KEY_BREAK(KEY_PAGE): + case EVT_KEY_BREAK(KEY_EXIT): + chainMenu(menuMainView); + event = 0; + break; + } + + return menuChannelsView(event); +} + +void onMainViewMenu(const char *result) +{ + if (result == STR_RESET_TIMER1) { + timerReset(0); + } + else if (result == STR_RESET_TIMER2) { + timerReset(1); + } +#if TIMERS > 2 + else if (result == STR_RESET_TIMER3) { + timerReset(2); + } +#endif + else if (result == STR_VIEW_NOTES) { + pushModelNotes(); + } + else if (result == STR_RESET_SUBMENU) { + POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT); + POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1); + POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2); + POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3); + POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY); + } + else if (result == STR_RESET_TELEMETRY) { + telemetryReset(); + } + else if (result == STR_RESET_FLIGHT) { + flightReset(); + } + else if (result == STR_STATISTICS) { + chainMenu(menuStatisticsView); + } + else if (result == STR_ABOUT_US) { + chainMenu(menuAboutView); + } +} + +void displaySwitch(coord_t x, coord_t y, int width, unsigned int index) +{ + if (SWITCH_EXISTS(index)) { + int val = getValue(MIXSRC_FIRST_SWITCH+index); + + if (val >= 0) { + lcdDrawSolidHorizontalLine(x, y, width); + lcdDrawSolidHorizontalLine(x, y+2, width); + y += 4; + if (val > 0) { + lcdDrawSolidHorizontalLine(x, y, width); + lcdDrawSolidHorizontalLine(x, y+2, width); + y += 4; + } + } + + lcdDrawChar(width==5 ? x+1 : x, y, 'A'+index, TINSIZE); + y += 6; + + if (val <= 0) { + lcdDrawSolidHorizontalLine(x, y, width); + lcdDrawSolidHorizontalLine(x, y+2, width); + if (val < 0) { + lcdDrawSolidHorizontalLine(x, y+4, width); + lcdDrawSolidHorizontalLine(x, y+6, width); + } + } + } +} + +const MenuItem MAIN_MENU[] = { + { "RADIO SETTINGS", menuGeneralSetup }, + { "MODEL SELECT", menuModelSelect }, + { "MODEL SETTINGS", menuModelSetup }, + { "CHECKLIST", menuModelNotes }, + { "SD MANAGER", menuGeneralSdManager }, + { "VERSION", menuGeneralVersion } +}; + +bool isMenuAvailable(int index) +{ + if (index == 4) { + return modelHasNotes(); + } + else { + return true; + } +} + +int getSwitchCount() +{ + int count = 0; + for (int i=0; i= VIEW_COUNT) { + g_model.view = 0; + chainMenu(menuMainViewChannelsMonitor); + } + break; + + case EVT_KEY_LONG(KEY_PAGE): + if (!IS_FAI_ENABLED()) + chainMenu(menuTelemetryFrsky); + killEvents(event); + break; + + case EVT_KEY_FIRST(KEY_EXIT): +#if defined(GVARS) + if (gvarDisplayTimer > 0) { + gvarDisplayTimer = 0; + } +#endif + break; + } + + // Flight Mode Name + int mode = mixerCurrentFlightMode; + lcdDrawSizedText(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|PHASE_FLAGS); + + // Model Name + putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE); + + // Trims sliders + displayTrims(mode); + + // Top bar + displayTopBar(); + + // Sliders (Pots / Sliders) + drawSliders(); + + lcdDrawBitmap(BITMAP_X, BITMAP_Y, modelBitmap); + + // Switches + if (getSwitchCount() > 8) { + for (int i=0; i= 14) qr2.rem += 1; + const coord_t x[4] = { 50, 142 }; + const coord_t y[4] = { 25, 42, 25, 42 }; + displaySwitch(x[qr.quot]+qr2.rem*4, y[qr2.quot], 3, i); + } + else { + displaySwitch(17+qr.rem*6, 25+qr.quot*17, 5, i); + } + } + } + else { + int index = 0; + for (int i=0; i= 5 ? 3 : 0); + LogicalSwitchData * cs = lswAddress(sw); + if (cs->func == LS_FUNC_NONE) { + lcdDrawSolidHorizontalLine(x, y+6, 4); + lcdDrawSolidHorizontalLine(x, y+7, 4); + } + else if (getSwitch(SWSRC_SW1+sw)) { + lcdDrawFilledRect(x, y, 4, 8); + } + else { + lcdDrawRect(x, y, 4, 8); + } + } + } + +#if defined(GVARS) + if (gvarDisplayTimer > 0) { + gvarDisplayTimer--; + lcdDrawFilledRect(BITMAP_X, BITMAP_Y, 64, 32, SOLID, ERASE); + lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32); + drawStringWithIndex(BITMAP_X+FW, BITMAP_Y+FH-1, STR_GV, gvarLastChanged+1); + lcdDrawSizedText(BITMAP_X+4*FW+FW/2, BITMAP_Y+FH-1, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); + lcdDrawText(BITMAP_X+FW, BITMAP_Y+2*FH+3, PSTR("["), BOLD); + drawGVarValue(BITMAP_X+2*FW, BITMAP_Y+2*FH+3, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); + lcdDrawText(lcdLastPos, BITMAP_Y+2*FH+3, PSTR("]"), BOLD); + } +#endif +} diff --git a/radio/src/gui/taranis/view_statistics.cpp b/radio/src/gui/212x64/view_statistics.cpp similarity index 96% rename from radio/src/gui/taranis/view_statistics.cpp rename to radio/src/gui/212x64/view_statistics.cpp index ee48641ec..b20ecd31d 100644 --- a/radio/src/gui/taranis/view_statistics.cpp +++ b/radio/src/gui/212x64/view_statistics.cpp @@ -1,244 +1,244 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -#define STATS_1ST_COLUMN FW/2 -#define STATS_2ND_COLUMN 12*FW+FW/2 -#define STATS_3RD_COLUMN 24*FW+FW/2 -#define STATS_LABEL_WIDTH 4*FW - -void menuStatisticsView(uint8_t event) -{ - TITLE(STR_MENUSTAT); - - switch(event) - { - case EVT_KEY_FIRST(KEY_UP): - chainMenu(menuStatisticsDebug); - break; - - case EVT_KEY_LONG(KEY_MENU): - g_eeGeneral.globalTimer = 0; - storageDirty(EE_GENERAL); - sessionTimer = 0; - break; - - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - - // Session and Total timers - lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD); - putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0); - lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD); - putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); - - // Throttle special timers - lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD); - putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0); - lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD); - putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0); - - // Timers - for (int i=0; i 3600) - putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0); - else - putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0); - } - -#if defined(THRTRACE) - const coord_t x = 5; - const coord_t y = 60; - lcdDrawSolidHorizontalLine(x-3, y, MAXTRACE+3+3); - lcdDrawSolidVerticalLine(x, y-32, 32+3); - for (coord_t i=0; i MAXTRACE ? s_traceWr - MAXTRACE : 0; - for (coord_t i=1; i<=MAXTRACE && traceRdtime % SECS_PER_DAY; - putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT); - //event - lcdDrawNumber(14*FW, y, te->event, LEADING0|LEFT, 3); - //data - lcdDrawSizedText (20*FW, y, "0x", 2); - lcdDrawHexNumber(22*FW-2, y, (uint16_t)(te->data >> 16)); - lcdDrawHexNumber(25*FW, y, (uint16_t)(te->data & 0xFFFF)); - } - - } - - -} -#endif //#if defined(DEBUG_TRACE_BUFFER) +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "opentx.h" + +#define STATS_1ST_COLUMN FW/2 +#define STATS_2ND_COLUMN 12*FW+FW/2 +#define STATS_3RD_COLUMN 24*FW+FW/2 +#define STATS_LABEL_WIDTH 4*FW + +void menuStatisticsView(uint8_t event) +{ + TITLE(STR_MENUSTAT); + + switch(event) + { + case EVT_KEY_FIRST(KEY_UP): + chainMenu(menuStatisticsDebug); + break; + + case EVT_KEY_LONG(KEY_MENU): + g_eeGeneral.globalTimer = 0; + storageDirty(EE_GENERAL); + sessionTimer = 0; + break; + + case EVT_KEY_FIRST(KEY_EXIT): + chainMenu(menuMainView); + break; + } + + // Session and Total timers + lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD); + putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0); + lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD); + putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); + + // Throttle special timers + lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD); + putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0); + lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD); + putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0); + + // Timers + for (int i=0; i 3600) + putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0); + else + putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0); + } + +#if defined(THRTRACE) + const coord_t x = 5; + const coord_t y = 60; + lcdDrawSolidHorizontalLine(x-3, y, MAXTRACE+3+3); + lcdDrawSolidVerticalLine(x, y-32, 32+3); + for (coord_t i=0; i MAXTRACE ? s_traceWr - MAXTRACE : 0; + for (coord_t i=1; i<=MAXTRACE && traceRdtime % SECS_PER_DAY; + putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT); + //event + lcdDrawNumber(14*FW, y, te->event, LEADING0|LEFT, 3); + //data + lcdDrawSizedText (20*FW, y, "0x", 2); + lcdDrawHexNumber(22*FW-2, y, (uint16_t)(te->data >> 16)); + lcdDrawHexNumber(25*FW, y, (uint16_t)(te->data & 0xFFFF)); + } + + } + + +} +#endif //#if defined(DEBUG_TRACE_BUFFER) diff --git a/radio/src/gui/taranis/view_telemetry.cpp b/radio/src/gui/212x64/view_telemetry.cpp similarity index 100% rename from radio/src/gui/taranis/view_telemetry.cpp rename to radio/src/gui/212x64/view_telemetry.cpp diff --git a/radio/src/gui/taranis/view_text.cpp b/radio/src/gui/212x64/view_text.cpp similarity index 100% rename from radio/src/gui/taranis/view_text.cpp rename to radio/src/gui/212x64/view_text.cpp diff --git a/radio/src/gui/taranis/widgets.cpp b/radio/src/gui/212x64/widgets.cpp similarity index 98% rename from radio/src/gui/taranis/widgets.cpp rename to radio/src/gui/212x64/widgets.cpp index 348b321a7..37e2ec0cc 100644 --- a/radio/src/gui/taranis/widgets.cpp +++ b/radio/src/gui/212x64/widgets.cpp @@ -21,7 +21,7 @@ #include "opentx.h" const pm_uchar bmp_sleep[] PROGMEM = { - #include "../../bitmaps/taranis/sleep.lbm" + #include "../../bitmaps/212x64/sleep.lbm" }; #define SLEEP_BITMAP_WIDTH 60 @@ -35,7 +35,7 @@ void drawSleepBitmap() #if defined(PWR_BUTTON_DELAY) const pm_uchar bmp_shutdown[] PROGMEM = { - #include "../../bitmaps/taranis/shutdown.lbm" + #include "../../bitmaps/212x64/shutdown.lbm" }; #define SHUTDOWN_BITMAP_WIDTH 60 diff --git a/radio/src/gui/horus/bitmapbuffer.cpp b/radio/src/gui/480x272/bitmapbuffer.cpp similarity index 100% rename from radio/src/gui/horus/bitmapbuffer.cpp rename to radio/src/gui/480x272/bitmapbuffer.cpp diff --git a/radio/src/gui/horus/bitmapbuffer.h b/radio/src/gui/480x272/bitmapbuffer.h similarity index 100% rename from radio/src/gui/horus/bitmapbuffer.h rename to radio/src/gui/480x272/bitmapbuffer.h diff --git a/radio/src/gui/horus/bitmaps.cpp b/radio/src/gui/480x272/bitmaps.cpp similarity index 100% rename from radio/src/gui/horus/bitmaps.cpp rename to radio/src/gui/480x272/bitmaps.cpp diff --git a/radio/src/gui/horus/bitmaps.h b/radio/src/gui/480x272/bitmaps.h similarity index 100% rename from radio/src/gui/horus/bitmaps.h rename to radio/src/gui/480x272/bitmaps.h diff --git a/radio/src/gui/horus/colors.h b/radio/src/gui/480x272/colors.h similarity index 100% rename from radio/src/gui/horus/colors.h rename to radio/src/gui/480x272/colors.h diff --git a/radio/src/gui/horus/curves.cpp b/radio/src/gui/480x272/curves.cpp similarity index 100% rename from radio/src/gui/horus/curves.cpp rename to radio/src/gui/480x272/curves.cpp diff --git a/radio/src/gui/horus/fonts.cpp b/radio/src/gui/480x272/fonts.cpp similarity index 100% rename from radio/src/gui/horus/fonts.cpp rename to radio/src/gui/480x272/fonts.cpp diff --git a/radio/src/gui/horus/gui.h b/radio/src/gui/480x272/gui.h similarity index 97% rename from radio/src/gui/horus/gui.h rename to radio/src/gui/480x272/gui.h index 15a49646f..326c5a892 100644 --- a/radio/src/gui/horus/gui.h +++ b/radio/src/gui/480x272/gui.h @@ -18,6 +18,10 @@ * GNU General Public License for more details. */ +#ifndef _GUI_H_ +#define _GUI_H_ + +#include "gui_helpers.h" #include "lcd.h" #include "menus.h" #include "widgets.h" @@ -86,3 +90,5 @@ void drawCurvePoint(int x, int y, LcdFlags color); extern Layout * customScreens[MAX_CUSTOM_SCREENS]; extern Topbar * topbar; + +#endif // _GUI_H_ diff --git a/radio/src/gui/horus/layout.cpp b/radio/src/gui/480x272/layout.cpp similarity index 100% rename from radio/src/gui/horus/layout.cpp rename to radio/src/gui/480x272/layout.cpp diff --git a/radio/src/gui/horus/layout.h b/radio/src/gui/480x272/layout.h similarity index 100% rename from radio/src/gui/horus/layout.h rename to radio/src/gui/480x272/layout.h diff --git a/radio/src/gui/horus/layouts/layout1x1.cpp b/radio/src/gui/480x272/layouts/layout1x1.cpp similarity index 100% rename from radio/src/gui/horus/layouts/layout1x1.cpp rename to radio/src/gui/480x272/layouts/layout1x1.cpp diff --git a/radio/src/gui/horus/layouts/layout2+1.cpp b/radio/src/gui/480x272/layouts/layout2+1.cpp similarity index 100% rename from radio/src/gui/horus/layouts/layout2+1.cpp rename to radio/src/gui/480x272/layouts/layout2+1.cpp diff --git a/radio/src/gui/horus/layouts/layout2x1.cpp b/radio/src/gui/480x272/layouts/layout2x1.cpp similarity index 100% rename from radio/src/gui/horus/layouts/layout2x1.cpp rename to radio/src/gui/480x272/layouts/layout2x1.cpp diff --git a/radio/src/gui/horus/layouts/layout2x2.cpp b/radio/src/gui/480x272/layouts/layout2x2.cpp similarity index 100% rename from radio/src/gui/horus/layouts/layout2x2.cpp rename to radio/src/gui/480x272/layouts/layout2x2.cpp diff --git a/radio/src/gui/horus/layouts/layout2x4.cpp b/radio/src/gui/480x272/layouts/layout2x4.cpp similarity index 100% rename from radio/src/gui/horus/layouts/layout2x4.cpp rename to radio/src/gui/480x272/layouts/layout2x4.cpp diff --git a/radio/src/gui/horus/layouts/mask_layout1x1.png b/radio/src/gui/480x272/layouts/mask_layout1x1.png similarity index 100% rename from radio/src/gui/horus/layouts/mask_layout1x1.png rename to radio/src/gui/480x272/layouts/mask_layout1x1.png diff --git a/radio/src/gui/horus/layouts/mask_layout2+1.png b/radio/src/gui/480x272/layouts/mask_layout2+1.png similarity index 100% rename from radio/src/gui/horus/layouts/mask_layout2+1.png rename to radio/src/gui/480x272/layouts/mask_layout2+1.png diff --git a/radio/src/gui/horus/layouts/mask_layout2x1.png b/radio/src/gui/480x272/layouts/mask_layout2x1.png similarity index 100% rename from radio/src/gui/horus/layouts/mask_layout2x1.png rename to radio/src/gui/480x272/layouts/mask_layout2x1.png diff --git a/radio/src/gui/horus/layouts/mask_layout2x2.png b/radio/src/gui/480x272/layouts/mask_layout2x2.png similarity index 100% rename from radio/src/gui/horus/layouts/mask_layout2x2.png rename to radio/src/gui/480x272/layouts/mask_layout2x2.png diff --git a/radio/src/gui/horus/layouts/mask_layout2x4.png b/radio/src/gui/480x272/layouts/mask_layout2x4.png similarity index 100% rename from radio/src/gui/horus/layouts/mask_layout2x4.png rename to radio/src/gui/480x272/layouts/mask_layout2x4.png diff --git a/radio/src/gui/horus/lcd.cpp b/radio/src/gui/480x272/lcd.cpp similarity index 100% rename from radio/src/gui/horus/lcd.cpp rename to radio/src/gui/480x272/lcd.cpp diff --git a/radio/src/gui/horus/lcd.h b/radio/src/gui/480x272/lcd.h similarity index 100% rename from radio/src/gui/horus/lcd.h rename to radio/src/gui/480x272/lcd.h diff --git a/radio/src/gui/horus/menu_model.cpp b/radio/src/gui/480x272/menu_model.cpp similarity index 100% rename from radio/src/gui/horus/menu_model.cpp rename to radio/src/gui/480x272/menu_model.cpp diff --git a/radio/src/gui/horus/menu_general.cpp b/radio/src/gui/480x272/menu_radio.cpp similarity index 100% rename from radio/src/gui/horus/menu_general.cpp rename to radio/src/gui/480x272/menu_radio.cpp diff --git a/radio/src/gui/horus/menus.cpp b/radio/src/gui/480x272/menus.cpp similarity index 100% rename from radio/src/gui/horus/menus.cpp rename to radio/src/gui/480x272/menus.cpp diff --git a/radio/src/gui/horus/menus.h b/radio/src/gui/480x272/menus.h similarity index 100% rename from radio/src/gui/horus/menus.h rename to radio/src/gui/480x272/menus.h diff --git a/radio/src/gui/horus/menu_model_curves.cpp b/radio/src/gui/480x272/model_curves.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_curves.cpp rename to radio/src/gui/480x272/model_curves.cpp diff --git a/radio/src/gui/horus/menu_model_custom_scripts.cpp b/radio/src/gui/480x272/model_custom_scripts.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_custom_scripts.cpp rename to radio/src/gui/480x272/model_custom_scripts.cpp diff --git a/radio/src/gui/horus/menu_model_flightmodes.cpp b/radio/src/gui/480x272/model_flightmodes.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_flightmodes.cpp rename to radio/src/gui/480x272/model_flightmodes.cpp diff --git a/radio/src/gui/horus/menu_model_gvars.cpp b/radio/src/gui/480x272/model_gvars.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_gvars.cpp rename to radio/src/gui/480x272/model_gvars.cpp diff --git a/radio/src/gui/horus/menu_model_heli.cpp b/radio/src/gui/480x272/model_heli.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_heli.cpp rename to radio/src/gui/480x272/model_heli.cpp diff --git a/radio/src/gui/horus/menu_model_inputs.cpp b/radio/src/gui/480x272/model_inputs.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_inputs.cpp rename to radio/src/gui/480x272/model_inputs.cpp diff --git a/radio/src/gui/horus/menu_model_logical_switches.cpp b/radio/src/gui/480x272/model_logical_switches.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_logical_switches.cpp rename to radio/src/gui/480x272/model_logical_switches.cpp diff --git a/radio/src/gui/horus/menu_model_mixes.cpp b/radio/src/gui/480x272/model_mixes.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_mixes.cpp rename to radio/src/gui/480x272/model_mixes.cpp diff --git a/radio/src/gui/horus/menu_model_limits.cpp b/radio/src/gui/480x272/model_outputs.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_limits.cpp rename to radio/src/gui/480x272/model_outputs.cpp diff --git a/radio/src/gui/horus/menu_model_select.cpp b/radio/src/gui/480x272/model_select.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_select.cpp rename to radio/src/gui/480x272/model_select.cpp diff --git a/radio/src/gui/horus/menu_model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_setup.cpp rename to radio/src/gui/480x272/model_setup.cpp diff --git a/radio/src/gui/horus/model_special_functions.cpp b/radio/src/gui/480x272/model_special_functions.cpp similarity index 100% rename from radio/src/gui/horus/model_special_functions.cpp rename to radio/src/gui/480x272/model_special_functions.cpp diff --git a/radio/src/gui/horus/menu_model_telemetry.cpp b/radio/src/gui/480x272/model_telemetry.cpp similarity index 100% rename from radio/src/gui/horus/menu_model_telemetry.cpp rename to radio/src/gui/480x272/model_telemetry.cpp diff --git a/radio/src/gui/horus/navigation.cpp b/radio/src/gui/480x272/navigation.cpp similarity index 100% rename from radio/src/gui/horus/navigation.cpp rename to radio/src/gui/480x272/navigation.cpp diff --git a/radio/src/gui/horus/popups.cpp b/radio/src/gui/480x272/popups.cpp similarity index 100% rename from radio/src/gui/horus/popups.cpp rename to radio/src/gui/480x272/popups.cpp diff --git a/radio/src/gui/horus/radio_calibration.cpp b/radio/src/gui/480x272/radio_calibration.cpp similarity index 100% rename from radio/src/gui/horus/radio_calibration.cpp rename to radio/src/gui/480x272/radio_calibration.cpp diff --git a/radio/src/gui/horus/menu_general_hardware.cpp b/radio/src/gui/480x272/radio_hardware.cpp similarity index 100% rename from radio/src/gui/horus/menu_general_hardware.cpp rename to radio/src/gui/480x272/radio_hardware.cpp diff --git a/radio/src/gui/horus/menu_general_sdmanager.cpp b/radio/src/gui/480x272/radio_sdmanager.cpp similarity index 100% rename from radio/src/gui/horus/menu_general_sdmanager.cpp rename to radio/src/gui/480x272/radio_sdmanager.cpp diff --git a/radio/src/gui/horus/radio_setup.cpp b/radio/src/gui/480x272/radio_setup.cpp similarity index 100% rename from radio/src/gui/horus/radio_setup.cpp rename to radio/src/gui/480x272/radio_setup.cpp diff --git a/radio/src/gui/horus/menu_general_trainer.cpp b/radio/src/gui/480x272/radio_trainer.cpp similarity index 100% rename from radio/src/gui/horus/menu_general_trainer.cpp rename to radio/src/gui/480x272/radio_trainer.cpp diff --git a/radio/src/gui/horus/menu_general_version.cpp b/radio/src/gui/480x272/radio_version.cpp similarity index 100% rename from radio/src/gui/horus/menu_general_version.cpp rename to radio/src/gui/480x272/radio_version.cpp diff --git a/radio/src/gui/horus/screens_setup.cpp b/radio/src/gui/480x272/screens_setup.cpp similarity index 100% rename from radio/src/gui/horus/screens_setup.cpp rename to radio/src/gui/480x272/screens_setup.cpp diff --git a/radio/src/gui/horus/splash.cpp b/radio/src/gui/480x272/splash.cpp similarity index 100% rename from radio/src/gui/horus/splash.cpp rename to radio/src/gui/480x272/splash.cpp diff --git a/radio/src/gui/horus/theme.cpp b/radio/src/gui/480x272/theme.cpp similarity index 100% rename from radio/src/gui/horus/theme.cpp rename to radio/src/gui/480x272/theme.cpp diff --git a/radio/src/gui/horus/theme.h b/radio/src/gui/480x272/theme.h similarity index 100% rename from radio/src/gui/horus/theme.h rename to radio/src/gui/480x272/theme.h diff --git a/radio/src/gui/horus/themes/darkblue.cpp b/radio/src/gui/480x272/themes/darkblue.cpp similarity index 100% rename from radio/src/gui/horus/themes/darkblue.cpp rename to radio/src/gui/480x272/themes/darkblue.cpp diff --git a/radio/src/gui/horus/themes/default.cpp b/radio/src/gui/480x272/themes/default.cpp similarity index 100% rename from radio/src/gui/horus/themes/default.cpp rename to radio/src/gui/480x272/themes/default.cpp diff --git a/radio/src/gui/horus/topbar.cpp b/radio/src/gui/480x272/topbar.cpp similarity index 100% rename from radio/src/gui/horus/topbar.cpp rename to radio/src/gui/480x272/topbar.cpp diff --git a/radio/src/gui/horus/topbar.h b/radio/src/gui/480x272/topbar.h similarity index 100% rename from radio/src/gui/horus/topbar.h rename to radio/src/gui/480x272/topbar.h diff --git a/radio/src/gui/horus/view_about.cpp b/radio/src/gui/480x272/view_about.cpp similarity index 100% rename from radio/src/gui/horus/view_about.cpp rename to radio/src/gui/480x272/view_about.cpp diff --git a/radio/src/gui/horus/view_channels.cpp b/radio/src/gui/480x272/view_channels.cpp similarity index 100% rename from radio/src/gui/horus/view_channels.cpp rename to radio/src/gui/480x272/view_channels.cpp diff --git a/radio/src/gui/horus/view_logical_switches.cpp b/radio/src/gui/480x272/view_logical_switches.cpp similarity index 100% rename from radio/src/gui/horus/view_logical_switches.cpp rename to radio/src/gui/480x272/view_logical_switches.cpp diff --git a/radio/src/gui/horus/view_main.cpp b/radio/src/gui/480x272/view_main.cpp similarity index 100% rename from radio/src/gui/horus/view_main.cpp rename to radio/src/gui/480x272/view_main.cpp diff --git a/radio/src/gui/horus/view_statistics.cpp b/radio/src/gui/480x272/view_statistics.cpp similarity index 100% rename from radio/src/gui/horus/view_statistics.cpp rename to radio/src/gui/480x272/view_statistics.cpp diff --git a/radio/src/gui/horus/view_text.cpp b/radio/src/gui/480x272/view_text.cpp similarity index 100% rename from radio/src/gui/horus/view_text.cpp rename to radio/src/gui/480x272/view_text.cpp diff --git a/radio/src/gui/horus/widget.cpp b/radio/src/gui/480x272/widget.cpp similarity index 100% rename from radio/src/gui/horus/widget.cpp rename to radio/src/gui/480x272/widget.cpp diff --git a/radio/src/gui/horus/widget.h b/radio/src/gui/480x272/widget.h similarity index 100% rename from radio/src/gui/horus/widget.h rename to radio/src/gui/480x272/widget.h diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/480x272/widgets.cpp similarity index 100% rename from radio/src/gui/horus/widgets.cpp rename to radio/src/gui/480x272/widgets.cpp diff --git a/radio/src/gui/horus/widgets.h b/radio/src/gui/480x272/widgets.h similarity index 100% rename from radio/src/gui/horus/widgets.h rename to radio/src/gui/480x272/widgets.h diff --git a/radio/src/gui/horus/widgets/gauge.cpp b/radio/src/gui/480x272/widgets/gauge.cpp similarity index 100% rename from radio/src/gui/horus/widgets/gauge.cpp rename to radio/src/gui/480x272/widgets/gauge.cpp diff --git a/radio/src/gui/horus/widgets/modelbmp.cpp b/radio/src/gui/480x272/widgets/modelbmp.cpp similarity index 100% rename from radio/src/gui/horus/widgets/modelbmp.cpp rename to radio/src/gui/480x272/widgets/modelbmp.cpp diff --git a/radio/src/gui/horus/widgets/outputs.cpp b/radio/src/gui/480x272/widgets/outputs.cpp similarity index 100% rename from radio/src/gui/horus/widgets/outputs.cpp rename to radio/src/gui/480x272/widgets/outputs.cpp diff --git a/radio/src/gui/horus/widgets/text.cpp b/radio/src/gui/480x272/widgets/text.cpp similarity index 100% rename from radio/src/gui/horus/widgets/text.cpp rename to radio/src/gui/480x272/widgets/text.cpp diff --git a/radio/src/gui/horus/widgets/timer.cpp b/radio/src/gui/480x272/widgets/timer.cpp similarity index 100% rename from radio/src/gui/horus/widgets/timer.cpp rename to radio/src/gui/480x272/widgets/timer.cpp diff --git a/radio/src/gui/horus/widgets/value.cpp b/radio/src/gui/480x272/widgets/value.cpp similarity index 100% rename from radio/src/gui/horus/widgets/value.cpp rename to radio/src/gui/480x272/widgets/value.cpp diff --git a/radio/src/gui/horus/widgets_container.h b/radio/src/gui/480x272/widgets_container.h similarity index 100% rename from radio/src/gui/horus/widgets_container.h rename to radio/src/gui/480x272/widgets_container.h diff --git a/radio/src/gui/9x/helpers.cpp b/radio/src/gui/9x/helpers.cpp deleted file mode 100644 index 51d7f7d72..000000000 --- a/radio/src/gui/9x/helpers.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "../../opentx.h" - -uint8_t switchToMix(uint8_t source) -{ - if (source <= 3) - return MIXSRC_3POS; - else - return MIXSRC_FIRST_SWITCH - 3 + source; -} diff --git a/radio/src/gui/gui.h b/radio/src/gui/gui.h deleted file mode 100644 index 1f5c531cb..000000000 --- a/radio/src/gui/gui.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _GUI_H_ -#define _GUI_H_ - -#if defined(CPUARM) -#include "gui_helpers.h" -#endif - -#if defined(PCBHORUS) - #include "horus/gui.h" -#elif defined(PCBFLAMENCO) - #include "flamenco/gui.h" -#elif defined(PCBTARANIS) - #include "taranis/gui.h" -#else - #include "9x/gui.h" -#endif - -#if defined(SIMU) -extern bool simuLcdRefresh; -extern display_t simuLcdBuf[DISPLAY_BUFFER_SIZE]; -#endif - -#endif // _GUI_H_ diff --git a/radio/src/gui/gui_helpers.cpp b/radio/src/gui/gui_helpers.cpp index e5b7eb13b..53e963965 100644 --- a/radio/src/gui/gui_helpers.cpp +++ b/radio/src/gui/gui_helpers.cpp @@ -20,8 +20,23 @@ #include "opentx.h" -#if defined(CPUARM) +#if defined(PCBTARANIS) || defined(PCBHORUS) +uint8_t switchToMix(uint8_t source) +{ + div_t qr = div(source-1, 3); + return qr.quot+MIXSRC_FIRST_SWITCH; +} +#else +uint8_t switchToMix(uint8_t source) +{ + if (source <= 3) + return MIXSRC_3POS; + else + return MIXSRC_FIRST_SWITCH - 3 + source; +} +#endif +#if defined(CPUARM) int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable) { do { @@ -533,5 +548,4 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable) } return retval; } - #endif diff --git a/radio/src/gui/taranis/helpers.cpp b/radio/src/gui/taranis/helpers.cpp deleted file mode 100644 index f346aa56f..000000000 --- a/radio/src/gui/taranis/helpers.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "opentx.h" - -uint8_t switchToMix(uint8_t source) -{ - div_t qr = div(source-1, 3); - return qr.quot+MIXSRC_FIRST_SWITCH; -} diff --git a/radio/src/loadboot.cpp b/radio/src/loadboot.cpp index cfc5b1448..b223b3516 100644 --- a/radio/src/loadboot.cpp +++ b/radio/src/loadboot.cpp @@ -23,7 +23,7 @@ #if defined(PCBSKY9X) #include "AT91SAM3S4.h" #else - #include "targets/taranis/board_taranis.h" + #include "targets/taranis/board.h" #endif #if defined(PCBTARANIS) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 27081b5d2..5141cc5d4 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -237,21 +237,7 @@ #define RESXul 1024ul #define RESXl 1024l -#if defined(PCBHORUS) - #include "targets/horus/board_horus.h" -#elif defined(PCBFLAMENCO) - #include "targets/flamenco/board_flamenco.h" -#elif defined(PCBTARANIS) - #include "targets/taranis/board_taranis.h" -#elif defined(PCBSKY9X) - #include "targets/sky9x/board_sky9x.h" -#elif defined(PCBGRUVIN9X) - #include "targets/gruvin9x/board_gruvin9x.h" -#elif defined(PCBMEGA2560) - #include "targets/mega2560/board_mega2560.h" -#else - #include "targets/9x/board_stock.h" -#endif +#include "board.h" #if defined(DISK_CACHE) #include "disk_cache.h" @@ -499,7 +485,7 @@ typedef struct { } CustomFunctionsContext; #include "strhelpers.h" -#include "gui/gui.h" +#include "gui.h" #if defined(TEMPLATES) #include "templates.h" diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index 314385df6..1f4a84031 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -26,6 +26,8 @@ #include "opentx.h" #include #include +#include "targets/simu/simulcd.h" + #if defined(SIMU_AUDIO) #include #endif diff --git a/radio/src/targets/9x/CMakeLists.txt b/radio/src/targets/9x/CMakeLists.txt index 75afcad32..3d9d451d9 100644 --- a/radio/src/targets/9x/CMakeLists.txt +++ b/radio/src/targets/9x/CMakeLists.txt @@ -5,11 +5,11 @@ set(MCU atmega64) string(TOLOWER ${PCB} FLAVOUR) set(EEPROM_VARIANT_NEEDED ON) set(EEPROM EEPROM_RLC) -set(GUI_DIR 9x) +set(GUI_DIR 128x64) set(TARGET_DIR 9x) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCBSTD -DPCB${PCB} -DCPUM64) -set(TARGET_SRC ${TARGET_SRC} board_stock.cpp) +set(TARGET_SRC ${TARGET_SRC} board.cpp) set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC}) if(SP22) add_definitions(-DSP22) diff --git a/radio/src/targets/9x/board_stock.cpp b/radio/src/targets/9x/board.cpp similarity index 100% rename from radio/src/targets/9x/board_stock.cpp rename to radio/src/targets/9x/board.cpp diff --git a/radio/src/targets/9x/board_stock.h b/radio/src/targets/9x/board.h similarity index 100% rename from radio/src/targets/9x/board_stock.h rename to radio/src/targets/9x/board.h diff --git a/radio/src/targets/common/arm/CMakeLists.txt b/radio/src/targets/common/arm/CMakeLists.txt index 46c405182..6fa111337 100644 --- a/radio/src/targets/common/arm/CMakeLists.txt +++ b/radio/src/targets/common/arm/CMakeLists.txt @@ -75,7 +75,6 @@ endif() add_definitions(-DCPUARM) add_definitions(-DFRSKY -DFRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2) add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE) -include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR}) include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable) foreach(LANGUAGE ${TTS_LANGUAGES}) set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp) diff --git a/radio/src/targets/common/arm/stm32/CMakeLists.txt b/radio/src/targets/common/arm/stm32/CMakeLists.txt index 473892eb1..bd01de26c 100644 --- a/radio/src/targets/common/arm/stm32/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/CMakeLists.txt @@ -4,6 +4,7 @@ set(ARCH ARM) set(STM32USB_DIR ${THIRDPARTY_DIR}/STM32_USB-Host-Device_Lib_V2.1.0/Libraries) add_definitions(-DCPUSTM32) add_definitions(-DSBUS -DCROSSFIRE) +include_directories(${RADIO_SRC_DIRECTORY}/targets/common/arm/stm32) include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc) include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc) include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/msc/inc) @@ -19,15 +20,16 @@ set(STM32USB_SRC ) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} - usb_bsp.c - usbd_desc.c - usbd_usr.cpp + ../common/arm/stm32/usb_bsp.c + ../common/arm/stm32/usbd_desc.c + ../common/arm/stm32/usbd_usr.cpp + ../common/arm/stm32/usb_driver.c ) if(USB STREQUAL SERIAL) add_definitions(-DUSB_SERIAL) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} - usbd_cdc.cpp + ../common/arm/stm32/usbd_cdc.cpp ) set(STM32USB_SRC ${STM32USB_SRC} @@ -50,7 +52,7 @@ else() add_definitions(-DUSB_JOYSTICK) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} - usbd_hid_joystick.c + ../common/arm/stm32/usbd_hid_joystick.c ) endif() if(GVARS) diff --git a/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt b/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt index b09e44256..b9409d1f3 100644 --- a/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt @@ -18,5 +18,5 @@ set(STM32LIB_SRC STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c ) -set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} system_stm32f2xx.c) +set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} ../common/arm/stm32/f2/system_stm32f2xx.c) diff --git a/radio/src/targets/taranis/system_stm32f2xx.c b/radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c similarity index 100% rename from radio/src/targets/taranis/system_stm32f2xx.c rename to radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c diff --git a/radio/src/targets/common/arm/stm32/f4/CMakeLists.txt b/radio/src/targets/common/arm/stm32/f4/CMakeLists.txt index 7bcd4b9b7..73ba54944 100644 --- a/radio/src/targets/common/arm/stm32/f4/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/f4/CMakeLists.txt @@ -18,5 +18,5 @@ set(STM32LIB_SRC STM32F4xx_StdPeriph_Driver/src/stm32f4xx_pwr.c STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c ) -set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} system_stm32f4xx.c) +set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} ../common/arm/stm32/f4/system_stm32f4xx.c) diff --git a/radio/src/targets/horus/system_stm32f4xx.c b/radio/src/targets/common/arm/stm32/f4/system_stm32f4xx.c similarity index 93% rename from radio/src/targets/horus/system_stm32f4xx.c rename to radio/src/targets/common/arm/stm32/f4/system_stm32f4xx.c index 5c609ffac..05445c1a6 100644 --- a/radio/src/targets/horus/system_stm32f4xx.c +++ b/radio/src/targets/common/arm/stm32/f4/system_stm32f4xx.c @@ -1,23 +1,3 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - /** ****************************************************************************** * @file system_stm32f4xx.c @@ -28,20 +8,20 @@ * This file contains the system clock configuration for STM32F4xx devices, * and is generated by the clock configuration tool * stm32f4xx_Clock_Configuration_V1.1.0.xls - * - * 1. This file provides two functions and one global variable to be called from + * + * 1. This file provides two functions and one global variable to be called from * user application: * - SystemInit(): Setups the system clock (System clock source, PLL Multiplier * and Divider factors, AHB/APBx prescalers and Flash settings), - * depending on the configuration made in the clock xls tool. - * This function is called at startup just after reset and + * depending on the configuration made in the clock xls tool. + * This function is called at startup just after reset and * before branch to main program. This call is made inside * the "startup_stm32f4xx.s" file. * * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used - * by the user application to setup the SysTick + * by the user application to setup the SysTick * timer or configure other parameters. - * + * * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must * be called whenever the core clock is changed * during program execution. @@ -51,7 +31,7 @@ * configure the system clock before to branch to main program. * * 3. If the system clock source selected by user fails to startup, the SystemInit() - * function will do nothing and HSI still used as system clock source. User can + * function will do nothing and HSI still used as system clock source. User can * add some code to deal with this issue inside the SetSysClock() function. * * 4. The default value of HSE crystal is set to 25MHz, refer to "HSE_VALUE" define @@ -108,7 +88,7 @@ * SDIO and RNG clock | *----------------------------------------------------------------------------- *============================================================================= - ****************************************************************************** + ****************************************************************************** * @attention * *

© COPYRIGHT 2013 STMicroelectronics

@@ -119,15 +99,15 @@ * * http://www.st.com/software_license_agreement_liberty_v2 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, + * 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. * ****************************************************************************** */ - + /** @addtogroup CMSIS * @{ */ @@ -255,13 +235,15 @@ void SystemInit(void) /* Disable all interrupts */ RCC->CIR = 0x00000000; - + +#if defined(SDRAM) void SDRAM_Init(); void FMC_SDRAMWriteProtectionConfig(uint32_t SDRAM_Bank, FunctionalState NewState); SDRAM_Init(); // calls SDRAM_GPIOConfig() FMC_SDRAMWriteProtectionConfig(((uint32_t)0x00000001), DISABLE); - +#endif + #ifdef DATA_IN_ExtSRAM SystemInit_ExtMemCtl(); #endif /* DATA_IN_ExtSRAM */ @@ -426,7 +408,7 @@ static void SetSysClock(void) } /* Configure Flash prefetch, Instruction cache, Data cache and wait state */ - FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS; + FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_LATENCY_5WS; /* Select the main PLL as system clock source */ RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); diff --git a/radio/src/targets/horus/usb_bsp.c b/radio/src/targets/common/arm/stm32/usb_bsp.c similarity index 95% rename from radio/src/targets/horus/usb_bsp.c rename to radio/src/targets/common/arm/stm32/usb_bsp.c index 928a3c7b8..df4ecb757 100644 --- a/radio/src/targets/horus/usb_bsp.c +++ b/radio/src/targets/common/arm/stm32/usb_bsp.c @@ -21,7 +21,7 @@ /* Includes ------------------------------------------------------------------*/ #include "usb_bsp.h" -#include "board_horus.h" +#include "board.h" #include "usbd_conf.h" extern uint32_t SystemCoreClock; diff --git a/radio/src/targets/taranis/usb_conf.h b/radio/src/targets/common/arm/stm32/usb_conf.h similarity index 97% rename from radio/src/targets/taranis/usb_conf.h rename to radio/src/targets/common/arm/stm32/usb_conf.h index 15f7186bd..9db23007d 100644 --- a/radio/src/targets/taranis/usb_conf.h +++ b/radio/src/targets/common/arm/stm32/usb_conf.h @@ -1,28 +1,28 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef _USB_CONF_H_ -#define _USB_CONF_H_ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ -#if defined(REV9E) +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef _USB_CONF_H_ +#define _USB_CONF_H_ + +#if defined(STM32F4) #include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" #else #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h" @@ -162,7 +162,7 @@ #endif /* __CC_ARM */ #endif -#endif // _USB_CONF_H_ +#endif // _USB_CONF_H_ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/targets/horus/usb_driver.c b/radio/src/targets/common/arm/stm32/usb_driver.c similarity index 98% rename from radio/src/targets/horus/usb_driver.c rename to radio/src/targets/common/arm/stm32/usb_driver.c index 3232ae6bb..fa43ce205 100644 --- a/radio/src/targets/horus/usb_driver.c +++ b/radio/src/targets/common/arm/stm32/usb_driver.c @@ -18,7 +18,7 @@ * GNU General Public License for more details. */ -#include "board_horus.h" +#include "board.h" #include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h" #include "debug.h" diff --git a/radio/src/targets/horus/usbd_cdc.cpp b/radio/src/targets/common/arm/stm32/usbd_cdc.cpp similarity index 100% rename from radio/src/targets/horus/usbd_cdc.cpp rename to radio/src/targets/common/arm/stm32/usbd_cdc.cpp diff --git a/radio/src/targets/taranis/usbd_conf.h b/radio/src/targets/common/arm/stm32/usbd_conf.h similarity index 100% rename from radio/src/targets/taranis/usbd_conf.h rename to radio/src/targets/common/arm/stm32/usbd_conf.h diff --git a/radio/src/targets/taranis/usbd_desc.c b/radio/src/targets/common/arm/stm32/usbd_desc.c similarity index 93% rename from radio/src/targets/taranis/usbd_desc.c rename to radio/src/targets/common/arm/stm32/usbd_desc.c index 4b5e7106f..c19813488 100644 --- a/radio/src/targets/taranis/usbd_desc.c +++ b/radio/src/targets/common/arm/stm32/usbd_desc.c @@ -1,29 +1,29 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + /* Includes ------------------------------------------------------------------*/ #include "usbd_desc.h" #include -#include "board_taranis.h" +#include "board.h" #include "usbd_conf.h" #include "usbd_core.h" #include "usbd_req.h" @@ -60,17 +60,17 @@ #if defined(USB_JOYSTICK) #define USBD_PID 0x5710 - #define USBD_PRODUCT_FS_STRING "FrSky Taranis Joystick" + #define USBD_PRODUCT_FS_STRING USB_NAME " Joystick" #define USBD_CONFIGURATION_FS_STRING "HID Config" #define USBD_INTERFACE_FS_STRING "HID Interface" #elif defined(USB_SERIAL) #define USBD_PID 0x5740 // do not change, this ID is used by the ST USB driver for Windows - #define USBD_PRODUCT_FS_STRING "FrSky Taranis Serial Port" + #define USBD_PRODUCT_FS_STRING USB_NAME " Serial Port" #define USBD_CONFIGURATION_FS_STRING "VSP Config" #define USBD_INTERFACE_FS_STRING "VSP Interface" #elif defined(USB_MASS_STORAGE) #define USBD_PID 0x5720 - #define USBD_PRODUCT_FS_STRING "FrSky Taranis Mass Storage" + #define USBD_PRODUCT_FS_STRING USB_NAME " Mass Storage" #define USBD_CONFIGURATION_FS_STRING "MSC Config" #define USBD_INTERFACE_FS_STRING "MSC Interface" #endif diff --git a/radio/src/targets/horus/usbd_desc.h b/radio/src/targets/common/arm/stm32/usbd_desc.h similarity index 100% rename from radio/src/targets/horus/usbd_desc.h rename to radio/src/targets/common/arm/stm32/usbd_desc.h diff --git a/radio/src/targets/taranis/usbd_hid_joystick.c b/radio/src/targets/common/arm/stm32/usbd_hid_joystick.c similarity index 100% rename from radio/src/targets/taranis/usbd_hid_joystick.c rename to radio/src/targets/common/arm/stm32/usbd_hid_joystick.c diff --git a/radio/src/targets/horus/usbd_usr.cpp b/radio/src/targets/common/arm/stm32/usbd_usr.cpp similarity index 92% rename from radio/src/targets/horus/usbd_usr.cpp rename to radio/src/targets/common/arm/stm32/usbd_usr.cpp index e92119a78..e6f317d3b 100644 --- a/radio/src/targets/horus/usbd_usr.cpp +++ b/radio/src/targets/common/arm/stm32/usbd_usr.cpp @@ -112,7 +112,7 @@ void USBD_USR_DeviceConnected (void) */ void USBD_USR_DeviceDisconnected (void) { -#if !defined(BOOT) && defined(USB_MASS_STORAGE) && !defined(PCBHORUS) +#if !defined(BOOT) && defined(USB_MASS_STORAGE) && defined(EEPROM) // TODO is it really needed if we didn't write the EEPROM? NVIC_SystemReset(); #endif diff --git a/radio/src/targets/gruvin9x/CMakeLists.txt b/radio/src/targets/gruvin9x/CMakeLists.txt index 23d021c3b..65f7321d4 100644 --- a/radio/src/targets/gruvin9x/CMakeLists.txt +++ b/radio/src/targets/gruvin9x/CMakeLists.txt @@ -3,10 +3,10 @@ set(MCU atmega2560) string(TOLOWER ${PCB} FLAVOUR) set(EEPROM EEPROM_RLC) add_definitions(-DEEPROM_VARIANT=0) -set(GUI_DIR 9x) +set(GUI_DIR 128x64) set(TARGET_DIR gruvin9x) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCB${PCB} -DCPUM2560 -DROTARY_ENCODERS=2) -set(TARGET_SRC ${TARGET_SRC} board_gruvin9x.cpp) +set(TARGET_SRC ${TARGET_SRC} board.cpp) set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC}) set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/9x/lcd_driver.cpp) diff --git a/radio/src/targets/gruvin9x/board_gruvin9x.cpp b/radio/src/targets/gruvin9x/board.cpp similarity index 100% rename from radio/src/targets/gruvin9x/board_gruvin9x.cpp rename to radio/src/targets/gruvin9x/board.cpp diff --git a/radio/src/targets/gruvin9x/board_gruvin9x.h b/radio/src/targets/gruvin9x/board.h similarity index 100% rename from radio/src/targets/gruvin9x/board_gruvin9x.h rename to radio/src/targets/gruvin9x/board.h diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index 203d3cd51..7c135298d 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -1,75 +1,75 @@ - set(CPU_TYPE STM32F4) - set(HSE_VALUE 12000000) - set(SDCARD YES) - set(EEPROM SDCARD) - set(HAPTIC YES) - set(GUI_DIR horus) - set(TARGET_DIR horus) - set(LINKER_SCRIPT targets/horus/stm32f4_flash.ld) - set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} horus_bitmaps) - set(LUA_EXPORT lua_export_horus) - set(FLAVOUR horus) - set(VIRTUAL_INPUTS YES) - set(RAMBACKUP YES) - option(DISK_CACHE "Enable SD card disk cache" YES) - add_definitions(-DPCBHORUS -DCOLORLCD -DSTM32F429_439xx -DPPM_PIN_UART -DPPM_PIN_TIMER) - add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK) - add_definitions(-DLUAINPUTS -DXCURVES -DVARIO) - include_directories(${RADIO_SRC_DIRECTORY}/fonts/horus gui/${GUI_DIR} gui/${GUI_DIR}/layouts) - file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/themes/*.cpp) - file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/layouts/*.cpp) - file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/horus ${RADIO_SRC_DIRECTORY}/gui/horus/widgets/*.cpp) - set(GUI_SRC - ${GUI_SRC} - bitmapbuffer.cpp - curves.cpp - bitmaps.cpp - menu_general_hardware.cpp - menu_model_inputs.cpp - menu_model_mixes.cpp - view_channels.cpp - view_logical_switches.cpp - view_about.cpp - view_text.cpp - screens_setup.cpp - theme.cpp - topbar.cpp - layout.cpp - widget.cpp - ${THEMES_SRC} - ${LAYOUTS_SRC} - ${WIDGETS_SRC} - ) - set(SRC ${SRC} targets/taranis/rtc_driver.cpp) - if(DISK_CACHE) - set(SRC ${SRC} disk_cache.cpp) - add_definitions(-DDISK_CACHE) - endif() - set(TARGET_SRC - ${TARGET_SRC} - board_horus.cpp - extmodule_driver.cpp - ) - set(FIRMWARE_TARGET_SRC - ${FIRMWARE_TARGET_SRC} - sdio_sd.c - lcd_driver.cpp - delays.c - usb_driver.c - pwr_driver.cpp - sdram_driver.c - led_driver.cpp - startup_stm32f40_41xxx.s - ) - set(STM32LIB_SRC - STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c - STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c - STM32F4xx_StdPeriph_Driver/src/stm32f4xx_ltdc.c - STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c - STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma2d.c - ) - add_custom_target(datacopy - WORKING_DIRECTORY ${RADIO_DIRECTORY}/src - COMMAND python ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DCPUARM -DCOLORLCD -DVIRTUALINPUTS -DBACKUP > storage/datacopy.cpp - DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py +set(CPU_TYPE STM32F4) +set(HSE_VALUE 12000000) +set(SDCARD YES) +set(EEPROM SDCARD) +set(HAPTIC YES) +set(GUI_DIR 480x272) +set(TARGET_DIR horus) +set(LINKER_SCRIPT targets/horus/stm32f4_flash.ld) +set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} horus_bitmaps) +set(LUA_EXPORT lua_export_horus) +set(FLAVOUR horus) +add_definitions(-DUSB_NAME="FrSky Horus") +set(VIRTUAL_INPUTS YES) +set(RAMBACKUP YES) +option(DISK_CACHE "Enable SD card disk cache" YES) +add_definitions(-DPCBHORUS -DCOLORLCD -DSTM32F429_439xx -DSDRAM -DPPM_PIN_UART -DPPM_PIN_TIMER) +add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK) +add_definitions(-DLUAINPUTS -DXCURVES -DVARIO) +include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts) +file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/themes/*.cpp) +file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/layouts/*.cpp) +file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/widgets/*.cpp) +set(GUI_SRC + ${GUI_SRC} + bitmapbuffer.cpp + curves.cpp + bitmaps.cpp + radio_hardware.cpp + model_inputs.cpp + model_mixes.cpp + view_channels.cpp + view_logical_switches.cpp + view_about.cpp + view_text.cpp + screens_setup.cpp + theme.cpp + topbar.cpp + layout.cpp + widget.cpp + ${THEMES_SRC} + ${LAYOUTS_SRC} + ${WIDGETS_SRC} ) +set(SRC ${SRC} targets/taranis/rtc_driver.cpp) +if(DISK_CACHE) + set(SRC ${SRC} disk_cache.cpp) + add_definitions(-DDISK_CACHE) +endif() +set(TARGET_SRC + ${TARGET_SRC} + board.cpp + extmodule_driver.cpp + ) +set(FIRMWARE_TARGET_SRC + ${FIRMWARE_TARGET_SRC} + sdio_sd.c + lcd_driver.cpp + delays.c + pwr_driver.cpp + sdram_driver.c + led_driver.cpp + startup_stm32f40_41xxx.s + ) +set(STM32LIB_SRC + STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c + STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c + STM32F4xx_StdPeriph_Driver/src/stm32f4xx_ltdc.c + STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c + STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma2d.c + ) +add_custom_target(datacopy + WORKING_DIRECTORY ${RADIO_DIRECTORY}/src + COMMAND python ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DCPUARM -DCOLORLCD -DVIRTUALINPUTS -DBACKUP > storage/datacopy.cpp + DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py +) diff --git a/radio/src/targets/horus/board_horus.cpp b/radio/src/targets/horus/board.cpp similarity index 100% rename from radio/src/targets/horus/board_horus.cpp rename to radio/src/targets/horus/board.cpp diff --git a/radio/src/targets/horus/board_horus.h b/radio/src/targets/horus/board.h similarity index 100% rename from radio/src/targets/horus/board_horus.h rename to radio/src/targets/horus/board.h diff --git a/radio/src/targets/horus/delays.c b/radio/src/targets/horus/delays.c index 90abf3a80..895e5f6eb 100644 --- a/radio/src/targets/horus/delays.c +++ b/radio/src/targets/horus/delays.c @@ -19,7 +19,7 @@ */ #include -#include "board_horus.h" +#include "board.h" #define SYSTEM_TICKS_1US ((CFG_CPU_FREQ + 500000) / 1000000) // number of system ticks in 1us #define SYSTEM_TICKS_01US ((CFG_CPU_FREQ + 5000000) / 10000000) // number of system ticks in 0.1us (rounding needed for sys frequencies that are not multiple of 10MHz) diff --git a/radio/src/targets/horus/led_driver.cpp b/radio/src/targets/horus/led_driver.cpp index e9e5ddeb0..4ae8f1ebd 100644 --- a/radio/src/targets/horus/led_driver.cpp +++ b/radio/src/targets/horus/led_driver.cpp @@ -18,7 +18,7 @@ * GNU General Public License for more details. */ -#include "../horus/board_horus.h" +#include "board.h" void ledOn() { diff --git a/radio/src/targets/horus/pwr_driver.cpp b/radio/src/targets/horus/pwr_driver.cpp index 0f6ae3b62..ac9cf5efa 100644 --- a/radio/src/targets/horus/pwr_driver.cpp +++ b/radio/src/targets/horus/pwr_driver.cpp @@ -19,7 +19,7 @@ */ #include "pwr.h" -#include "board_horus.h" +#include "board.h" void pwrInit() { @@ -107,4 +107,4 @@ void pwrResetHandler() pwrOn(); } -} +} diff --git a/radio/src/targets/horus/sdio_sd.h b/radio/src/targets/horus/sdio_sd.h index 74ddbb8ce..b075ee14f 100644 --- a/radio/src/targets/horus/sdio_sd.h +++ b/radio/src/targets/horus/sdio_sd.h @@ -22,7 +22,7 @@ #ifndef _SDIO_SD_H_ #define _SDIO_SD_H_ -#include "board_horus.h" +#include "board.h" #ifdef __cplusplus extern "C" { diff --git a/radio/src/targets/horus/sdram_driver.c b/radio/src/targets/horus/sdram_driver.c index 07ac07d27..0e796f390 100755 --- a/radio/src/targets/horus/sdram_driver.c +++ b/radio/src/targets/horus/sdram_driver.c @@ -18,7 +18,7 @@ * GNU General Public License for more details. */ -#include "../horus/board_horus.h" +#include "board.h" #define SDRAM_MEMORY_WIDTH FMC_SDMemory_Width_16b diff --git a/radio/src/targets/horus/usb_conf.h b/radio/src/targets/horus/usb_conf.h deleted file mode 100644 index 4d0fd6737..000000000 --- a/radio/src/targets/horus/usb_conf.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef _USB_CONF_H_ -#define _USB_CONF_H_ - -#include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h" - -/* USB Core and PHY interface configuration. - Tip: To avoid modifying these defines each time you need to change the USB - configuration, you can declare the needed define in your toolchain - compiler preprocessor. - */ -/****************** USB OTG FS PHY CONFIGURATION ******************************* -* The USB OTG FS Core supports one on-chip Full Speed PHY. -* -* The USE_EMBEDDED_PHY symbol is defined in the project compiler preprocessor -* when FS core is used. -*******************************************************************************/ -#ifndef USE_USB_OTG_FS - #define USE_USB_OTG_FS // USB2.0 Full Speed == 12 Mbit -#endif /* USE_USB_OTG_FS */ - -#ifdef USE_USB_OTG_FS - #define USB_OTG_FS_CORE -#endif - -/******************************************************************************* -* FIFO Size Configuration in Device mode -* -* (i) Receive data FIFO size = RAM for setup packets + -* OUT endpoint control information + -* data OUT packets + miscellaneous -* Space = ONE 32-bits words -* --> RAM for setup packets = 10 spaces -* (n is the nbr of CTRL EPs the device core supports) -* --> OUT EP CTRL info = 1 space -* (one space for status information written to the FIFO along with each -* received packet) -* --> data OUT packets = (Largest Packet Size / 4) + 1 spaces -* (MINIMUM to receive packets) -* --> OR data OUT packets = at least 2*(Largest Packet Size / 4) + 1 spaces -* (if high-bandwidth EP is enabled or multiple isochronous EPs) -* --> miscellaneous = 1 space per OUT EP -* (one space for transfer complete status information also pushed to the -* FIFO with each endpoint's last packet) -* -* (ii)MINIMUM RAM space required for each IN EP Tx FIFO = MAX packet size for -* that particular IN EP. More space allocated in the IN EP Tx FIFO results -* in a better performance on the USB and can hide latencies on the AHB. -* -* (iii) TXn min size = 16 words. (n : Transmit FIFO index) -* (iv) When a TxFIFO is not used, the Configuration should be as follows: -* case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes) -* --> Txm can use the space allocated for Txn. -* case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes) -* --> Txn should be configured with the minimum space of 16 words -* (v) The FIFO is used optimally when used TxFIFOs are allocated in the top -* of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones. -* (vi) In HS case12 FIFO locations should be reserved for internal DMA registers -* so total FIFO size should be 1012 Only instead of 1024 -*******************************************************************************/ - -/****************** USB OTG FS CONFIGURATION **********************************/ -#ifdef USB_OTG_FS_CORE - #define RX_FIFO_FS_SIZE 128 - #define TX0_FIFO_FS_SIZE 64 - #define TX1_FIFO_FS_SIZE 128 - #define TX2_FIFO_FS_SIZE 0 - #define TX3_FIFO_FS_SIZE 0 - -// #define USB_OTG_FS_LOW_PWR_MGMT_SUPPORT -// #define USB_OTG_FS_SOF_OUTPUT_ENABLED -#endif - -/****************** USB OTG MISC CONFIGURATION ********************************/ -#define VBUS_SENSING_ENABLED - -/****************** USB OTG MODE CONFIGURATION ********************************/ -//#define USE_HOST_MODE -#define USE_DEVICE_MODE -//#define USE_OTG_MODE - -#ifndef USB_OTG_FS_CORE - #ifndef USB_OTG_HS_CORE - #error "USB_OTG_HS_CORE or USB_OTG_FS_CORE should be defined" - #endif -#endif - -#ifndef USE_DEVICE_MODE - #ifndef USE_HOST_MODE - #error "USE_DEVICE_MODE or USE_HOST_MODE should be defined" - #endif -#endif - -#ifndef USE_USB_OTG_HS - #ifndef USE_USB_OTG_FS - #error "USE_USB_OTG_HS or USE_USB_OTG_FS should be defined" - #endif -#else //USE_USB_OTG_HS - #ifndef USE_ULPI_PHY - #ifndef USE_EMBEDDED_PHY - #error "USE_ULPI_PHY or USE_EMBEDDED_PHY should be defined" - #endif - #endif -#endif - -/****************** C Compilers dependant keywords ****************************/ -/* In HS mode and when the DMA is used, all variables and data structures dealing - with the DMA during the transaction process should be 4-bytes aligned */ -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined (__GNUC__) /* GNU Compiler */ - #define __ALIGN_END __attribute__ ((aligned (4))) - #define __ALIGN_BEGIN - #else - #define __ALIGN_END - #if defined (__CC_ARM) /* ARM Compiler */ - #define __ALIGN_BEGIN __align(4) - #elif defined (__ICCARM__) /* IAR Compiler */ - #define __ALIGN_BEGIN - #elif defined (__TASKING__) /* TASKING Compiler */ - #define __ALIGN_BEGIN __align(4) - #endif /* __CC_ARM */ - #endif /* __GNUC__ */ -#else - #define __ALIGN_BEGIN - #define __ALIGN_END -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ - -/* __packed keyword used to decrease the data type alignment to 1-byte */ -#if !defined(__packed) - #if defined (__CC_ARM) /* ARM Compiler */ - #define __packed __packed - #elif defined (__ICCARM__) /* IAR Compiler */ - #define __packed __packed - #elif defined ( __GNUC__ ) /* GNU Compiler */ - #define __packed __attribute__ ((__packed__)) - #elif defined (__TASKING__) /* TASKING Compiler */ - #define __packed __unaligned - #endif /* __CC_ARM */ -#endif - -#endif // _USB_CONF_H_ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/radio/src/targets/horus/usbd_conf.h b/radio/src/targets/horus/usbd_conf.h deleted file mode 100644 index 5dcfeeb45..000000000 --- a/radio/src/targets/horus/usbd_conf.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef _USBD_CONF_H_ -#define _USBD_CONF_H_ - -/* Includes ------------------------------------------------------------------*/ -#include "usb_conf.h" - -#define USBD_CFG_MAX_NUM 1 -#define USBD_ITF_MAX_NUM 1 -#define USB_MAX_STR_DESC_SIZ 64 - -#define USBD_SELF_POWERED - -/* Class Layer Parameter */ - -#define MSC_IN_EP 0x81 -#define MSC_OUT_EP 0x01 -#define MSC_MAX_PACKET 64 - -#define MSC_MEDIA_PACKET 4096 - -#define HID_IN_EP 0x81 -#define HID_OUT_EP 0x01 - -#define HID_IN_PACKET 9 -#define HID_OUT_PACKET 9 - -#define CDC_IN_EP 0x81 /* EP1 for data IN */ -#define CDC_OUT_EP 0x01 /* EP1 for data OUT */ -#define CDC_CMD_EP 0x82 /* EP2 for CDC commands */ - -/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ -#define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ -#define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */ - -#define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */ -#define APP_RX_DATA_SIZE 512 // USB serial port output buffer. TODO: tune this buffer size /* Total size of IN buffer: APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */ -#define APP_FOPS VCP_fops - -#endif // _USBD_CONF_H_ - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/radio/src/targets/horus/usbd_desc.c b/radio/src/targets/horus/usbd_desc.c deleted file mode 100644 index 08b833c5f..000000000 --- a/radio/src/targets/horus/usbd_desc.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Includes ------------------------------------------------------------------*/ -#include "usbd_desc.h" - -#include - -#include "board_horus.h" -#include "usbd_conf.h" -#include "usbd_core.h" -#include "usbd_req.h" -#include "usb_regs.h" - -/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY - * @{ - */ - - -/** @defgroup USBD_DESC - * @brief USBD descriptors module - * @{ - */ - -/** @defgroup USBD_DESC_Private_TypesDefinitions - * @{ - */ -/** - * @} - */ - - -/** @defgroup USBD_DESC_Private_Defines - * @{ - */ - -#define USBD_VID 0x0483 - -#define USBD_LANGID_STRING 0x409 -#define USBD_MANUFACTURER_STRING "FrSky" -#define USBD_SERIALNUMBER_FS_STRING "00000000001B" - - -#if defined(USB_JOYSTICK) - #define USBD_PID 0x5710 - #define USBD_PRODUCT_FS_STRING "FrSky Horus Joystick" - #define USBD_CONFIGURATION_FS_STRING "HID Config" - #define USBD_INTERFACE_FS_STRING "HID Interface" -#elif defined(USB_SERIAL) - #define USBD_PID 0x5740 // do not change, this ID is used by the ST USB driver for Windows - #define USBD_PRODUCT_FS_STRING "FrSky Horus Serial Port" - #define USBD_CONFIGURATION_FS_STRING "VSP Config" - #define USBD_INTERFACE_FS_STRING "VSP Interface" -#elif defined(USB_MASS_STORAGE) - #define USBD_PID 0x5720 - #define USBD_PRODUCT_FS_STRING "FrSky Horus Mass Storage" - #define USBD_CONFIGURATION_FS_STRING "MSC Config" - #define USBD_INTERFACE_FS_STRING "MSC Interface" -#endif - -const USBD_DEVICE USR_desc = -{ - USBD_USR_DeviceDescriptor, - USBD_USR_LangIDStrDescriptor, - USBD_USR_ManufacturerStrDescriptor, - USBD_USR_ProductStrDescriptor, - USBD_USR_SerialStrDescriptor, - USBD_USR_ConfigStrDescriptor, - USBD_USR_InterfaceStrDescriptor, -}; - -/* USB Standard Device Descriptor */ -__ALIGN_BEGIN const uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END = -{ - USB_SIZ_DEVICE_DESC, /*bLength */ - USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/ - 0x00, /*bcdUSB */ - 0x02, - 0x00, /*bDeviceClass*/ - 0x00, /*bDeviceSubClass*/ - 0x00, /*bDeviceProtocol*/ - USB_OTG_MAX_EP0_SIZE, /*bMaxPacketSize*/ - LOBYTE(USBD_VID), /*idVendor*/ - HIBYTE(USBD_VID), /*idVendor*/ - LOBYTE(USBD_PID), /*idVendor*/ - HIBYTE(USBD_PID), /*idVendor*/ - 0x00, /*bcdDevice rel. 2.00*/ - 0x02, - USBD_IDX_MFC_STR, /*Index of manufacturer string*/ - USBD_IDX_PRODUCT_STR, /*Index of product string*/ - USBD_IDX_SERIAL_STR, /*Index of serial number string*/ - USBD_CFG_MAX_NUM /*bNumConfigurations*/ -}; /* USB_DeviceDescriptor */ - -/* USB Standard Device Descriptor */ -__ALIGN_BEGIN const uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END = -{ - USB_LEN_DEV_QUALIFIER_DESC, - USB_DESC_TYPE_DEVICE_QUALIFIER, - 0x00, - 0x02, - 0x00, - 0x00, - 0x00, - 0x40, - 0x01, - 0x00, -}; - -/* USB Standard Device Descriptor */ -__ALIGN_BEGIN const uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END = -{ - USB_SIZ_STRING_LANGID, - USB_DESC_TYPE_STRING, - LOBYTE(USBD_LANGID_STRING), - HIBYTE(USBD_LANGID_STRING), -}; - -/* -* @brief USBD_USR_DeviceDescriptor -* return the device descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length) -{ - *length = sizeof(USBD_DeviceDesc); - memcpy(USBD_StrDesc, USBD_DeviceDesc, *length); - return USBD_StrDesc; -} - -/** -* @brief USBD_USR_LangIDStrDescriptor -* return the LangID string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length) -{ - *length = sizeof(USBD_LangIDDesc); - memcpy(USBD_StrDesc, USBD_LangIDDesc, *length); - return USBD_StrDesc; -} - - -/** -* @brief USBD_USR_ProductStrDescriptor -* return the product string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_ProductStrDescriptor( uint8_t speed , uint16_t *length) -{ - USBD_GetString ((uint8_t*)USBD_PRODUCT_FS_STRING, USBD_StrDesc, length); - return USBD_StrDesc; -} - -/** -* @brief USBD_USR_ManufacturerStrDescriptor -* return the manufacturer string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_ManufacturerStrDescriptor( uint8_t speed , uint16_t *length) -{ - USBD_GetString ((uint8_t*)USBD_MANUFACTURER_STRING, USBD_StrDesc, length); - return USBD_StrDesc; -} - -/** -* @brief USBD_USR_SerialStrDescriptor -* return the serial number string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length) -{ - USBD_GetString ((uint8_t*)USBD_SERIALNUMBER_FS_STRING, USBD_StrDesc, length); - return USBD_StrDesc; -} - -/** -* @brief USBD_USR_ConfigStrDescriptor -* return the configuration string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length) -{ - USBD_GetString ((uint8_t *)USBD_CONFIGURATION_FS_STRING, USBD_StrDesc, length); - return USBD_StrDesc; -} - - -/** -* @brief USBD_USR_InterfaceStrDescriptor -* return the interface string descriptor -* @param speed : current device speed -* @param length : pointer to data length variable -* @retval pointer to descriptor buffer -*/ -uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length) -{ - USBD_GetString ((uint8_t*)USBD_INTERFACE_FS_STRING, USBD_StrDesc, length); - return USBD_StrDesc; -} - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/radio/src/targets/horus/usbd_hid_joystick.c b/radio/src/targets/horus/usbd_hid_joystick.c deleted file mode 100644 index fa2f40c77..000000000 --- a/radio/src/targets/horus/usbd_hid_joystick.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Includes ------------------------------------------------------------------*/ -#include "../horus/usbd_desc.h" -#include "usbd_hid_core.h" -#include "usbd_req.h" - -/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY - * @{ - */ - - -/** @defgroup USBD_HID - * @brief usbd core module - * @{ - */ - -/** @defgroup USBD_HID_Private_TypesDefinitions - * @{ - */ -/** - * @} - */ - - -/** @defgroup USBD_HID_Private_Defines - * @{ - */ - -/** - * @} - */ - - -/** @defgroup USBD_HID_Private_Macros - * @{ - */ -/** - * @} - */ - - - - -/** @defgroup USBD_HID_Private_FunctionPrototypes - * @{ - */ - - -static uint8_t USBD_HID_Init (void *pdev, - uint8_t cfgidx); - -static uint8_t USBD_HID_DeInit (void *pdev, - uint8_t cfgidx); - -static uint8_t USBD_HID_Setup (void *pdev, - USB_SETUP_REQ *req); - -static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length); - -static uint8_t USBD_HID_DataIn (void *pdev, uint8_t epnum); -/** - * @} - */ - - - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined ( __ICCARM__ ) /*!< IAR Compiler */ - #pragma data_alignment=4 - #endif -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -/* - This USB HID endpoint report description defines a device with: - * 8 digital buttons - * 8 analog axes with 8bit resolution - - Repot packet described as C struct is: - - struct { - uint8_t buttons; //bit 0 - button 1, bit 1 - button 2, ..., mapped to channels 9-16, on if channel > 0 - uint8_t X; //analog value, mapped to channel 1 - uint8_t Y; //analog value, mapped to channel 2 - uint8_t Z; //analog value, mapped to channel 3 - uint8_t Rx; //analog value, mapped to channel 4 - uint8_t Ry //analog value, mapped to channel 5 - uint8_t Rz; //analog value, mapped to channel 6 - uint8_t S1; //analog value, mapped to channel 7 - uint8_t S2; //analog value, mapped to channel 8 - } -*/ -__ALIGN_BEGIN static const uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END = -{ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x05, // USAGE (Game Pad) - 0xa1, 0x01, // COLLECTION (Application) - 0xa1, 0x00, // COLLECTION (Physical) - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x08, // USAGE_MAXIMUM (Button 8) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x95, 0x08, // REPORT_COUNT (8) - 0x75, 0x01, // REPORT_SIZE (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x09, 0x32, // USAGE (Z) - 0x09, 0x33, // USAGE (Rx) - 0x09, 0x34, // USAGE (Ry) - 0x09, 0x35, // USAGE (Rz) - 0x09, 0x36, // USAGE (Slider) - 0x09, 0x36, // USAGE (Slider) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x08, // REPORT_COUNT (8) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0xc0 // END_COLLECTION -}; - - -/** @defgroup USBD_HID_Private_Variables - * @{ - */ - -const USBD_Class_cb_TypeDef USBD_HID_cb = -{ - USBD_HID_Init, - USBD_HID_DeInit, - USBD_HID_Setup, - NULL, /*EP0_TxSent*/ - NULL, /*EP0_RxReady*/ - USBD_HID_DataIn, /*DataIn*/ - NULL, /*DataOut*/ - NULL, /*SOF */ - NULL, - NULL, - USBD_HID_GetCfgDesc, -#ifdef USB_OTG_HS_CORE - USBD_HID_GetCfgDesc, /* use same config as per FS */ -#endif -}; - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined ( __ICCARM__ ) /*!< IAR Compiler */ - #pragma data_alignment=4 - #endif -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -__ALIGN_BEGIN static uint32_t USBD_HID_AltSet __ALIGN_END = 0; - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined ( __ICCARM__ ) /*!< IAR Compiler */ - #pragma data_alignment=4 - #endif -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -__ALIGN_BEGIN static uint32_t USBD_HID_Protocol __ALIGN_END = 0; - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined ( __ICCARM__ ) /*!< IAR Compiler */ - #pragma data_alignment=4 - #endif -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -__ALIGN_BEGIN static uint32_t USBD_HID_IdleState __ALIGN_END = 0; - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - #if defined ( __ICCARM__ ) /*!< IAR Compiler */ - #pragma data_alignment=4 - #endif -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -/* USB HID device Configuration Descriptor */ -__ALIGN_BEGIN static const uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END = -{ - 0x09, /* bLength: Configuration Descriptor size */ - USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */ - USB_HID_CONFIG_DESC_SIZ, - /* wTotalLength: Bytes returned */ - 0x00, - 0x01, /*bNumInterfaces: 1 interface*/ - 0x01, /*bConfigurationValue: Configuration value*/ - 0x00, /*iConfiguration: Index of string descriptor describing - the configuration*/ - 0xE0, /*bmAttributes: bus powered and Support Remote Wake-up */ - 0x32, /*MaxPower 100 mA: this current is used for detecting Vbus*/ - - /************** Descriptor of Joystick Mouse interface ****************/ - /* 09 */ - 0x09, /*bLength: Interface Descriptor size*/ - USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/ - 0x00, /*bInterfaceNumber: Number of Interface*/ - 0x00, /*bAlternateSetting: Alternate setting*/ - 0x01, /*bNumEndpoints*/ - 0x03, /*bInterfaceClass: HID*/ - 0x00 /*0x01*/, /*bInterfaceSubClass : 1=BOOT, 0=no boot*/ - 0x00 /*0x02*/, /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/ - 0, /*iInterface: Index of string descriptor*/ - /******************** Descriptor of Joystick Mouse HID ********************/ - /* 18 */ - 0x09, /*bLength: HID Descriptor size*/ - HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/ - 0x11, /*bcdHID: HID Class Spec release number*/ - 0x01, - 0x00, /*bCountryCode: Hardware target country*/ - 0x01, /*bNumDescriptors: Number of HID class descriptors to follow*/ - 0x22, /*bDescriptorType*/ - sizeof(HID_JOYSTICK_ReportDesc),/*wItemLength: Total length of Report descriptor*/ - 0x00, - /******************** Descriptor of Mouse endpoint ********************/ - /* 27 */ - 0x07, /*bLength: Endpoint Descriptor size*/ - USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/ - - HID_IN_EP, /*bEndpointAddress: Endpoint Address (IN)*/ - 0x03, /*bmAttributes: Interrupt endpoint*/ - HID_IN_PACKET, /*wMaxPacketSize: 4 Byte max */ - 0x00, - 0x0A, /*bInterval: Polling Interval (10 ms)*/ - /* 34 */ -} ; - - - -static uint8_t ReportSent; - -/** - * @} - */ - -/** @defgroup USBD_HID_Private_Functions - * @{ - */ - -/** - * @brief USBD_HID_Init - * Initialize the HID interface - * @param pdev: device instance - * @param cfgidx: Configuration index - * @retval status - */ -static uint8_t USBD_HID_Init (void *pdev, - uint8_t cfgidx) -{ - - /* Open EP IN */ - DCD_EP_Open(pdev, - HID_IN_EP, - HID_IN_PACKET, - USB_OTG_EP_INT); - - /* Open EP OUT */ - DCD_EP_Open(pdev, - HID_OUT_EP, - HID_OUT_PACKET, - USB_OTG_EP_INT); - - ReportSent = 1; - return USBD_OK; -} - -/** - * @brief USBD_HID_Init - * DeInitialize the HID layer - * @param pdev: device instance - * @param cfgidx: Configuration index - * @retval status - */ -static uint8_t USBD_HID_DeInit (void *pdev, - uint8_t cfgidx) -{ - /* Close HID EPs */ - DCD_EP_Close (pdev , HID_IN_EP); - DCD_EP_Close (pdev , HID_OUT_EP); - - ReportSent = 1; - return USBD_OK; -} - -/** - * @brief USBD_HID_Setup - * Handle the HID specific requests - * @param pdev: instance - * @param req: usb requests - * @retval status - */ -static uint8_t USBD_HID_Setup (void *pdev, - USB_SETUP_REQ *req) -{ - uint16_t len = 0; - const uint8_t *pbuf = NULL; - - switch (req->bmRequest & USB_REQ_TYPE_MASK) - { - case USB_REQ_TYPE_CLASS : - switch (req->bRequest) - { - - - case HID_REQ_SET_PROTOCOL: - USBD_HID_Protocol = (uint8_t)(req->wValue); - break; - - case HID_REQ_GET_PROTOCOL: - USBD_CtlSendData (pdev, - (uint8_t *)&USBD_HID_Protocol, - 1); - break; - - case HID_REQ_SET_IDLE: - USBD_HID_IdleState = (uint8_t)(req->wValue >> 8); - break; - - case HID_REQ_GET_IDLE: - USBD_CtlSendData (pdev, - (uint8_t *)&USBD_HID_IdleState, - 1); - break; - - default: - USBD_CtlError (pdev, req); - return USBD_FAIL; - } - break; - - case USB_REQ_TYPE_STANDARD: - switch (req->bRequest) - { - case USB_REQ_GET_DESCRIPTOR: - if( req->wValue >> 8 == HID_REPORT_DESC) - { - len = MIN(sizeof(HID_JOYSTICK_ReportDesc) , req->wLength); - pbuf = HID_JOYSTICK_ReportDesc; // wiiccReportDescriptor; // - } - else if( req->wValue >> 8 == HID_DESCRIPTOR_TYPE) - { - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED - pbuf = USBD_HID_Desc; -#else - pbuf = USBD_HID_CfgDesc + 0x12; -#endif - len = MIN(USB_HID_DESC_SIZ , req->wLength); - } - - USBD_CtlSendData (pdev, - pbuf, - len); - - break; - - case USB_REQ_GET_INTERFACE : - USBD_CtlSendData (pdev, - (uint8_t *)&USBD_HID_AltSet, - 1); - break; - - case USB_REQ_SET_INTERFACE : - USBD_HID_AltSet = (uint8_t)(req->wValue); - break; - } - } - return USBD_OK; -} - - -/** - * @brief USBD_HID_SendReport - * Send HID Report - * @param pdev: device instance - * @param buff: pointer to report - * @retval status - */ -uint8_t USBD_HID_SendReport (USB_OTG_CORE_HANDLE *pdev, - uint8_t *report, - uint16_t len) -{ - if (pdev->dev.device_status == USB_OTG_CONFIGURED ) - { - if ( ReportSent ) - { - ReportSent = 0; - DCD_EP_Tx (pdev, HID_IN_EP, report, len); - } - } - return USBD_OK; -} - -/** - * @brief USBD_HID_GetCfgDesc - * return configuration descriptor - * @param speed : current device speed - * @param length : pointer data length - * @retval pointer to descriptor buffer - */ -static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length) -{ - *length = sizeof (USBD_HID_CfgDesc); - return USBD_HID_CfgDesc; -} - -/** - * @brief USBD_HID_DataIn - * handle data IN Stage - * @param pdev: device instance - * @param epnum: endpoint index - * @retval status - */ -static uint8_t USBD_HID_DataIn (void *pdev, - uint8_t epnum) -{ - ReportSent = 1; - /* Ensure that the FIFO is empty before a new transfer, this condition could - be caused by a new transfer before the end of the previous transfer */ - DCD_EP_Flush(pdev, HID_IN_EP); - return USBD_OK; -} - -/** - * @} - */ - - -/** - * @} - */ - - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/targets/horus/usbd_storage_msd.cpp b/radio/src/targets/horus/usbd_storage_msd.cpp index f124bd2b4..b45c6dde3 100644 --- a/radio/src/targets/horus/usbd_storage_msd.cpp +++ b/radio/src/targets/horus/usbd_storage_msd.cpp @@ -21,7 +21,7 @@ /* Includes ------------------------------------------------------------------*/ #include "../../opentx.h" #include "../../thirdparty/FatFs/diskio.h" -#include "board_horus.h" +#include "board.h" #include "sdio_sd.h" #if defined(__cplusplus) && !defined(SIMU) diff --git a/radio/src/targets/mega2560/CMakeLists.txt b/radio/src/targets/mega2560/CMakeLists.txt index b4758e652..a2569c4da 100644 --- a/radio/src/targets/mega2560/CMakeLists.txt +++ b/radio/src/targets/mega2560/CMakeLists.txt @@ -5,11 +5,11 @@ set(MCU atmega2560) string(TOLOWER ${PCB} FLAVOUR) set(EEPROM EEPROM_RLC) add_definitions(-DEEPROM_VARIANT=0) -set(GUI_DIR 9x) +set(GUI_DIR 128x64) set(TARGET_DIR mega2560) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCB${PCB} -DCPUM2560 -DROTARY_ENCODERS=2) -set(TARGET_SRC ${TARGET_SRC} board_mega2560.cpp) +set(TARGET_SRC ${TARGET_SRC} board.cpp) set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC}) set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/9x/lcd_driver.cpp) if(PWRMANAGE) diff --git a/radio/src/targets/mega2560/board_mega2560.cpp b/radio/src/targets/mega2560/board.cpp similarity index 100% rename from radio/src/targets/mega2560/board_mega2560.cpp rename to radio/src/targets/mega2560/board.cpp diff --git a/radio/src/targets/mega2560/board_mega2560.h b/radio/src/targets/mega2560/board.h similarity index 100% rename from radio/src/targets/mega2560/board_mega2560.h rename to radio/src/targets/mega2560/board.h diff --git a/radio/src/targets/simu/opentxsimulator.cpp b/radio/src/targets/simu/opentxsimulator.cpp index 97344383f..a330771d8 100644 --- a/radio/src/targets/simu/opentxsimulator.cpp +++ b/radio/src/targets/simu/opentxsimulator.cpp @@ -16,6 +16,7 @@ #include "opentxsimulator.h" #include "opentx.h" +#include "simulcd.h" int16_t g_anas[NUM_STICKS+NUM_POTS]; diff --git a/radio/src/targets/simu/simpgmspace.h b/radio/src/targets/simu/simpgmspace.h index 6076f8f15..07ee28a8a 100644 --- a/radio/src/targets/simu/simpgmspace.h +++ b/radio/src/targets/simu/simpgmspace.h @@ -21,8 +21,6 @@ #ifndef _SIMPGMSPACE_H_ #define _SIMPGMSPACE_H_ -extern int g_snapshot_idx; - #ifndef __GNUC__ #include #define sleep(x) Sleep(x) diff --git a/radio/src/gui/horus/helpers.cpp b/radio/src/targets/simu/simulcd.h similarity index 75% rename from radio/src/gui/horus/helpers.cpp rename to radio/src/targets/simu/simulcd.h index 470c34c7b..9d462ebc3 100644 --- a/radio/src/gui/horus/helpers.cpp +++ b/radio/src/targets/simu/simulcd.h @@ -2,7 +2,7 @@ * Copyright (C) OpenTX * * Based on code named - * th9x - http://code.google.com/p/th9x + * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * @@ -18,10 +18,11 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" +#ifndef _SIMULCD_H_ +#define _SIMULCD_H_ -uint8_t switchToMix(uint8_t source) -{ - div_t qr = div(source-1, 3); - return qr.quot+MIXSRC_FIRST_SWITCH; -} +extern int g_snapshot_idx; +extern bool simuLcdRefresh; +extern display_t simuLcdBuf[DISPLAY_BUFFER_SIZE]; + +#endif // _SIMULCD_H_ \ No newline at end of file diff --git a/radio/src/targets/sky9x/CMakeLists.txt b/radio/src/targets/sky9x/CMakeLists.txt index bdb7eca28..a99d8bb8c 100644 --- a/radio/src/targets/sky9x/CMakeLists.txt +++ b/radio/src/targets/sky9x/CMakeLists.txt @@ -35,13 +35,13 @@ set(MCU cortex-m3) set(SDCARD YES) set(HAPTIC YES) set(EEPROM EEPROM_RAW) -set(GUI_DIR 9x) +set(GUI_DIR 128x64) set(TARGET_DIR sky9x) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCBSKY9X -DPPM_PIN_SERIAL) add_definitions(-DAUDIO -DVOICE -DRTCLOCK -DVARIO) add_definitions(-DEEPROM_VARIANT=0) -set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC} menu_general_hardware.cpp view_telemetry.cpp view_text.cpp view_about.cpp) +set(GUI_SRC ${GUI_SRC} ${9X_GUI_SRC} radio_hardware.cpp view_telemetry.cpp view_text.cpp view_about.cpp) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} core_cm3.c board_lowlevel.c crt.c vectors_sam3s.c) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp pwr_driver.cpp usb/device/core/USBD_UDP.c usb/device/core/USBDDriver.c @@ -53,7 +53,7 @@ set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} lcd_driver.cpp pwr_driver.cpp ) set(TARGET_SRC ${TARGET_SRC} - board_sky9x.cpp + board.cpp telemetry_driver.cpp serial2_driver.cpp adc_driver.cpp diff --git a/radio/src/targets/sky9x/MEDSdcard.c b/radio/src/targets/sky9x/MEDSdcard.c index bbbfd8c4a..113c270bb 100644 --- a/radio/src/targets/sky9x/MEDSdcard.c +++ b/radio/src/targets/sky9x/MEDSdcard.c @@ -25,7 +25,7 @@ #include #include "debug.h" #include "diskio.h" -#include "board.h" +#include "board_lowlevel.h" #include "Media.h" //------------------------------------------------------------------------------ diff --git a/radio/src/targets/sky9x/board_sky9x.cpp b/radio/src/targets/sky9x/board.cpp similarity index 100% rename from radio/src/targets/sky9x/board_sky9x.cpp rename to radio/src/targets/sky9x/board.cpp diff --git a/radio/src/targets/sky9x/board.h b/radio/src/targets/sky9x/board.h index 3f7f5be8d..15cb6d620 100644 --- a/radio/src/targets/sky9x/board.h +++ b/radio/src/targets/sky9x/board.h @@ -1,637 +1,313 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -// TODO merge this file with board_sky9x.h +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ -#ifndef _BOARD_H_ -#define _BOARD_H_ +#ifndef _BOARD_SKY9X_H_ +#define _BOARD_SKY9X_H_ -#include +#include +#include "board_lowlevel.h" +#include "audio_driver.h" -#include "chip.h" +extern uint16_t ResetReason; +#define BOOTLOADER_SIZE 0x8000 +#define FIRMWARE_SIZE (256*1024) +#define FIRMWARE_ADDRESS 0x00400000 + +// Board driver +void boardInit(void); +#define boardOff() pwrOff() + +// Keys #if defined(REVA) -#include "AT91SAM3S2.h" + #define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR + #define KEYS_GPIO_REG_EXIT PIOA->PIO_PDSR + #define KEYS_GPIO_REG_UP PIOC->PIO_PDSR + #define KEYS_GPIO_REG_DOWN PIOC->PIO_PDSR + #define KEYS_GPIO_REG_RIGHT PIOC->PIO_PDSR + #define KEYS_GPIO_REG_LEFT PIOC->PIO_PDSR + #define KEYS_GPIO_PIN_MENU 0x00000040 + #define KEYS_GPIO_PIN_EXIT 0x80000000 + #define KEYS_GPIO_PIN_UP 0x00000004 + #define KEYS_GPIO_PIN_DOWN 0x00000008 + #define KEYS_GPIO_PIN_RIGHT 0x00000010 + #define KEYS_GPIO_PIN_LEFT 0x00000020 #else -#include "AT91SAM3S4.h" + #define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR + #define KEYS_GPIO_REG_EXIT PIOC->PIO_PDSR + #define KEYS_GPIO_REG_UP PIOC->PIO_PDSR + #define KEYS_GPIO_REG_DOWN PIOC->PIO_PDSR + #define KEYS_GPIO_REG_RIGHT PIOC->PIO_PDSR + #define KEYS_GPIO_REG_LEFT PIOC->PIO_PDSR + #define KEYS_GPIO_PIN_MENU 0x00000020 + #define KEYS_GPIO_PIN_EXIT 0x01000000 + #define KEYS_GPIO_PIN_UP 0x00000002 + #define KEYS_GPIO_PIN_DOWN 0x00000020 + #define KEYS_GPIO_PIN_RIGHT 0x00000010 + #define KEYS_GPIO_PIN_LEFT 0x00000008 #endif -#if !defined(SIMU) -#include "core_cm3.h" -#endif - -//------------------------------------------------------------------------------ -// Definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -/// \par -/// This page lists several definition related to the board description. -/// -/// Definitions -/// - BOARD_NAME - -/// Name of the board. -#define BOARD_NAME "AT91SAM3S-EK" -/// Board definition. -#define at91sam3sek -/// Family definition (already defined). -#define at91sam3s -/// Core definition -#define cortexm3 - -// TODO remove these definitions -//#define BOARD_REV_A -#define BOARD_REV_B - -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -/// \par sam3s_ek_opfreq "SAM3S-EK - Operating frequencies" -/// This page lists several definition related to the board operating frequency -/// (when using the initialization done by board_lowlevel.c). -/// -/// !Definitions -/// - BOARD_MAINOSC -/// - BOARD_MCK - -/// Frequency of the board main oscillator. -#define BOARD_MAINOSC 12000000 - -/// Master clock frequency (when using board_lowlevel.c). -// #define BOARD_MCK 64000000 - -//------------------------------------------------------------------------------ -// ADC -//------------------------------------------------------------------------------ - -/// Startup time max, return from Idle mode (in �s) -#define ADC_STARTUP_TIME_MAX 15 -/// Track and hold Acquisition Time min (in ns) -#define ADC_TRACK_HOLD_TIME_MIN 1200 - -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -/// USB attributes configuration descriptor (bus or self powered, remote wakeup) -//#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_RWAKEUP -#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -/// \par sam3s_ek_piodef "SAM3S-EK - PIO definitions" -/// This pages lists all the pio definitions contained in board.h. The constants -/// are named using the following convention: PIN_* for a constant which defines -/// a single Pin instance (but may include several PIOs sharing the same -/// controller), and PINS_* for a list of Pin instances. -/// -/// !ADC -/// - PIN_ADC0_AD0 -/// - PIN_ADC0_AD1 -/// - PIN_ADC0_AD2 -/// - PIN_ADC0_AD3 -/// - PIN_ADC0_AD4 -/// - PIN_ADC0_AD5 -/// - PIN_ADC0_AD6 -/// - PIN_ADC0_AD7 -/// - PINS_ADC0 -/// -/// !UART -/// - PINS_UART -/// -/// !EBI -/// - PIN_EBI_DATA_BUS -/// - PIN_EBI_NCS0 -/// - PIN_EBI_NRD -/// - PIN_EBI_NWE -/// - PIN_EBI_ADDR_BUS -/// - PIN_EBI_PSRAM_NBS -/// - PIN_EBI_A1 -/// - PIN_EBI_LCD_RS -/// -/// !LEDs -/// - PIN_LED_0 -/// - PIN_LED_1 -/// - PIN_LED_2 -/// - PINS_LEDS -/// -/// !MCI -/// - PINS_MCI -/// -/// !Push buttons -/// - PIN_PUSHBUTTON_1 -/// - PIN_PUSHBUTTON_2 -/// - PINS_PUSHBUTTONS -/// - PUSHBUTTON_BP1 -/// - PUSHBUTTON_BP2 -/// -/// !PWMC -/// - PIN_PWMC_PWMH0 -/// - PIN_PWMC_PWML0 -/// - PIN_PWMC_PWMH1 -/// - PIN_PWMC_PWML1 -/// - PIN_PWMC_PWMH2 -/// - PIN_PWMC_PWML2 -/// - PIN_PWMC_PWMH3 -/// - PIN_PWMC_PWML3 -/// - PIN_PWM_LED0 -/// - PIN_PWM_LED1 -/// - PIN_PWM_LED2 -/// - CHANNEL_PWM_LED0 -/// - CHANNEL_PWM_LED1 -/// - CHANNEL_PWM_LED2 -/// -/// !SPI -/// - PIN_SPI_MISO -/// - PIN_SPI_MOSI -/// - PIN_SPI_SPCK -/// - PINS_SPI -/// - PIN_SPI_NPCS0_PA11 -/// -/// ! SSC -/// - PIN_SSC_TD -/// - PIN_SSC_TK -/// - PIN_SSC_TF -/// - PINS_SSC_CODEC -/// -/// ! PCK0 -/// - PIN_PCK0 -/// -/// !TWI -/// - PIN_TWI_TWD0 -/// - PIN_TWI_TWCK0 -/// - PINS_TWI -/// -/// !USART0 -/// - PIN_USART0_RXD -/// - PIN_USART0_TXD -/// - PIN_USART0_CTS -/// - PIN_USART0_RTS -/// - PIN_USART0_SCK -/// -/// !USB -/// - PIN_USB_PULLUP -/// - -/// ADC_AD0 pin definition. -#define PIN_ADC0_AD0 {1 << 21, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD1 pin definition. -#define PIN_ADC0_AD1 {1 << 30, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD2 pin definition. -#define PIN_ADC0_AD2 {1 << 3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD3 pin definition. -#define PIN_ADC0_AD3 {1 << 4, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD4 pin definition. -#define PIN_ADC0_AD4 {1 << 15, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD5 pin definition. -#define PIN_ADC0_AD5 {1 << 16, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD6 pin definition. -#define PIN_ADC0_AD6 {1 << 17, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} -/// ADC_AD7 pin definition. -#define PIN_ADC0_AD7 {1 << 18, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} - -/// Pins ADC -#define PINS_ADC PIN_ADC0_AD0, PIN_ADC0_AD1, PIN_ADC0_AD2, PIN_ADC0_AD3, PIN_ADC0_AD4, PIN_ADC0_AD5, PIN_ADC0_AD6, PIN_ADC0_AD7 - -/** UART pins (UTXD0 and URXD0) definitions, PA9,10. */ -#define PINS_UART {0x00000600, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} - -/// EBI -#define PIN_EBI_DATA_BUS {0xFF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NRD {1 << 11, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NWE {1 << 8, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} - -#define PIN_EBI_NCS0 {1 << 20, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_PSRAM_ADDR_BUS {0x3f00fff, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_PSRAM_NBS {1 << 7, PIOB, ID_PIOB, PIO_PERIPH_B, PIO_PULLUP}, \ - {1 << 15, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_A1 {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} - -#define PIN_EBI_NCS1 {1 << 15, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} /* LCD CS pin */ -#define PIN_EBI_LCD_RS {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} /* LCD RS pin */ - -#ifdef BOARD_REV_A -/** LED #0 pin definition. */ -#define PIN_LED_0 {1 << 20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} -/** LED #1 pin definition. */ -#define PIN_LED_1 {1 << 21, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} -/** LED #2 pin definition. */ -#define PIN_LED_2 {1 << 22, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} -#endif -#ifdef BOARD_REV_B -/** LED #0 pin definition. */ -#define PIN_LED_0 {1 << 19, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} -/** LED #1 pin definition. */ -#define PIN_LED_1 {1 << 20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} -/** LED #2 pin definition. */ -#define PIN_LED_2 {1 << 20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} -#endif - -/** List of all LEDs definitions. */ -#define PINS_LEDS PIN_LED_0, PIN_LED_1, PIN_LED_2 - -/** MCI pins definition. */ -#define PINS_MCI {0x3fUL << 26, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_PULLUP} -/** MCI pin Card Detect. */ -#define PIN_MCI_CD {PIO_PB7, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP} - -/** Push button #0 definition. Attributes = pull-up + debounce + interrupt on rising edge. */ -#define PIN_PUSHBUTTON_1 {1 << 3, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE} -/** Push button #1 definition. Attributes = pull-up + debounce + interrupt on falling edge. */ -#define PIN_PUSHBUTTON_2 {1 << 12, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE} -/** List of all push button definitions. */ -#define PINS_PUSHBUTTONS PIN_PUSHBUTTON_1, PIN_PUSHBUTTON_2 - -/** Push button #1 index. */ -#define PUSHBUTTON_BP1 0 -/** Push button #2 index. */ -#define PUSHBUTTON_BP2 1 - -/// Simulated joystick LEFT index. -#define JOYSTICK_LEFT 0 -/// Simulated joystick RIGHT index. -#define JOYSTICK_RIGHT 1 - -/** PWMC PWM0 pin definition. */ -#define PIN_PWMC_PWMH0 {1 << 18, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} -#define PIN_PWMC_PWML0 {1 << 19, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} -/** PWMC PWM1 pin definition. */ -#define PIN_PWMC_PWMH1 {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} -#define PIN_PWMC_PWML1 {1 << 20, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} -/** PWMC PWM2 pin definition. */ -#define PIN_PWMC_PWMH2 {1 << 20, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} -#define PIN_PWMC_PWML2 {1 << 16, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT} -/** PWMC PWM3 pin definition. */ -#define PIN_PWMC_PWMH3 {1 << 21, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} -#define PIN_PWMC_PWML3 {1 << 15, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT} -/** PWM pin definition for LED0 */ -#define PIN_PWM_LED0 PIN_PWMC_PWMH0, PIN_PWMC_PWML0 -/** PWM pin definition for LED1 */ -#define PIN_PWM_LED1 PIN_PWMC_PWMH2, PIN_PWMC_PWML2 -/** PWM pin definition for LED2 */ -#define PIN_PWM_LED2 PIN_PWMC_PWMH3, PIN_PWMC_PWML3 -/** PWM channel for LED0 */ -#define CHANNEL_PWM_LED0 0 -/** PWM channel for LED1 */ -#define CHANNEL_PWM_LED1 2 -/** PWM channel for LED2 */ -#define CHANNEL_PWM_LED2 3 - -/** SPI MISO pin definition. */ -#define PIN_SPI_MISO {1 << 12, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -/** SPI MOSI pin definition. */ -#define PIN_SPI_MOSI {1 << 13, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -/** SPI SPCK pin definition. */ -#define PIN_SPI_SPCK {1 << 14, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -/** SPI chip select pin definition. */ -#define PIN_SPI_NPCS0_PA11 {1 << 11, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -/** List of SPI pin definitions (MISO, MOSI & SPCK). */ -#define PINS_SPI PIN_SPI_MISO, PIN_SPI_MOSI, PIN_SPI_SPCK - -/// SSC pins definition. -#define PIN_SSC_TD {0x1 << 26, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_SSC_TK {0x1 << 28, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_SSC_TF {0x1 << 30, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PINS_SSC_CODEC PIN_SSC_TD, PIN_SSC_TK, PIN_SSC_TF - -/// PCK0 -#define PIN_PCK0 {0x1 << 21, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} - -/// TWI pins definition. -#define TWI_V3XX -#define PIN_TWI_TWD0 {0x1 << 9, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_TWI_TWCK0 {0x1 << 10, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PINS_TWI0 PIN_TWI_TWD0, PIN_TWI_TWCK0 -#define PIN_TWI_TWD1 {0x1 << 24, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_TWI_TWCK1 {0x1 << 25, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PINS_TWI1 PIN_TWI_TWD1, PIN_TWI_TWCK1 - -/// USART0 -#define PIN_USART0_RXD {0x1 << 19, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART0_TXD {0x1 << 18, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART0_CTS {0x1 << 8, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART0_RTS {0x1 << 7, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART0_SCK {0x1 << 17, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} - -/// USART1 -#define PIN_USART1_RXD {0x1 << 21, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART1_TXD {0x1 << 22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART1_CTS {0x1 << 25, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART1_RTS {0x1 << 24, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} -#define PIN_USART1_EN {0x1 << 23, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} - -/// USB VBus monitoring pin definition. -#ifdef BOARD_REV_A -#define PIN_USB_VBUS {1 << 23, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} -#endif -#ifdef BOARD_REV_B -#define PIN_USB_VBUS {1 << 21, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} -#endif - -#define usbPlugged() (PIOC->PIO_PDSR & PIO_PC25) - -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -/// \par sam3s_ek_extcomp "SAM3S-EK - External components" -/// This page lists the definitions related to external on-board components -/// located in the board.h file for the AT91SAM3S-EK. -/// -/// !AT45 Dataflash Card -/// - BOARD_AT45_A_SPI_BASE -/// - BOARD_AT45_A_SPI_ID -/// - BOARD_AT45_A_SPI_PINS -/// - BOARD_AT45_A_SPI -/// - BOARD_AT45_A_NPCS -/// - BOARD_AT45_A_NPCS_PIN -/// -/// !AT45 Dataflash (serial onboard DataFlash) -/// - BOARD_AT45_B_SPI_BASE -/// - BOARD_AT45_B_SPI_ID -/// - BOARD_AT45_B_SPI_PINS -/// - BOARD_AT45_B_SPI -/// - BOARD_AT45_B_NPCS -/// - BOARD_AT45_B_NPCS_PIN -/// -/// !AT26 Serial Flash -/// - BOARD_AT26_A_SPI_BASE -/// - BOARD_AT26_A_SPI_ID -/// - BOARD_AT26_A_SPI_PINS -/// - BOARD_AT26_A_SPI -/// - BOARD_AT26_A_NPCS -/// - BOARD_AT26_A_NPCS_PIN -/// -/// !SD Card -/// - MCI2_INTERFACE -/// - BOARD_SD_MCI_BASE -/// - BOARD_SD_MCI_ID -/// - BOARD_SD_PINS -/// - BOARD_SD_SLOT -/// -/// !PSRAM -/// - BOARD_PSRAM_PINS -/// -/// !LCD -/// - BOARD_LCD_ILI9325 -/// - BOARD_LCD_PINS -/// - BOARD_BACKLIGHT_PIN -/// - BOARD_LCD_BASE -/// - BOARD_LCD_RS -/// - BOARD_LCD_WIDTH -/// - BOARD_LCD_HEIGHT -/// -/// !TouchScreen -/// - BOARD_TSC_ADS7843 -/// - PIN_TCS_IRQ -/// - PIN_TCS_BUSY -/// - BOARD_TSC_SPI_BASE -/// - BOARD_TSC_SPI_ID -/// - BOARD_TSC_SPI_PINS -/// - BOARD_TSC_NPCS -/// - BOARD_TSC_NPCS_PIN -/// -/// Base address of SPI peripheral connected to the dataflash. -//#define BOARD_AT45_A_SPI_BASE SPI0 -///// Identifier of SPI peripheral connected to the dataflash. -//#define BOARD_AT45_A_SPI_ID ID_SPI0 -///// Pins of the SPI peripheral connected to the dataflash. -//#define BOARD_AT45_A_SPI_PINS PINS_SPI0 -///// Dataflahs SPI number. -//#define BOARD_AT45_A_SPI 0 -///// Chip select connected to the dataflash. -//#define BOARD_AT45_A_NPCS 3 -///// Chip select pin connected to the dataflash. -//#define BOARD_AT45_A_NPCS_PIN PIN_SPI0_NPCS3 - -/// Base address of SPI peripheral connected to the dataflash. -//#define BOARD_AT45_B_SPI_BASE SPI1 -///// Identifier of SPI peripheral connected to the dataflash. -//#define BOARD_AT45_B_SPI_ID ID_SPI1 -///// Pins of the SPI peripheral connected to the dataflash. -//#define BOARD_AT45_B_SPI_PINS PINS_SPI1 -///// Dataflahs SPI number. -//#define BOARD_AT45_B_SPI 1 -///// Chip select connected to the dataflash. -//#define BOARD_AT45_B_NPCS 3 -///// Chip select pin connected to the dataflash. -//#define BOARD_AT45_B_NPCS_PIN PIN_SPI1_NPCS3 - -/// Base address of SPI peripheral connected to the serialflash. -//#define BOARD_AT26_A_SPI_BASE SPI0 -///// Identifier of SPI peripheral connected to the serialflash. -//#define BOARD_AT26_A_SPI_ID ID_SPI0 -///// Pins of the SPI peripheral connected to the serialflash. -//#define BOARD_AT26_A_SPI_PINS PINS_SPI0 -///// Serialflash SPI number. -//#define BOARD_AT26_A_SPI 0 -///// Chip select connected to the serialflash. -//#define BOARD_AT26_A_NPCS 3 -///// Chip select pin connected to the serialflash. -//#define BOARD_AT26_A_NPCS_PIN PIN_SPI0_NPCS3 - -/// ISO7816 -/// - PIN_SMARTCARD_CONNECT -/// - PIN_ISO7816_RSTMC -/// - PINS_ISO7816 - -/// Smartcard detection pin -//#define PIN_SMARTCARD_CONNECT {1 << 5, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} -/// PIN used for reset the smartcard -//#define PIN_ISO7816_RSTMC {1 << 7, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} -/// Pins used for connect the smartcard -//#define PINS_ISO7816 PIN_USART0_TXD, PIN_USART0_SCK, PIN_ISO7816_RSTMC - -/// Dma channel number -#define BOARD_MCI_DMA_CHANNEL 0 -/// MCI0 DMA hardware handshaking ID -#define DMA_HW_SRC_REQ_ID_MCI0 AT91C_HDMA_SRC_PER_0 -#define DMA_HW_DEST_REQ_ID_MCI0 AT91C_HDMA_DST_PER_0 -/// MCI1 DMA hardware handshaking ID -#define DMA_HW_SRC_REQ_ID_MCI1 AT91C_HDMA_SRC_PER_13 -#define DMA_HW_DEST_REQ_ID_MCI1 AT91C_HDMA_DST_PER_13 -/// SD DMA hardware handshaking ID -#define BOARD_SD_DMA_HW_SRC_REQ_ID DMA_HW_SRC_REQ_ID_MCI0 -#define BOARD_SD_DMA_HW_DEST_REQ_ID DMA_HW_DEST_REQ_ID_MCI0 - - -/// HS MCI interface -#define MCI2_INTERFACE -/// Base address of the MCI peripheral connected to the SD card. -#define BOARD_SD_MCI_BASE MCI0//MCI -///// Peripheral identifier of the MCI connected to the SD card. -#define BOARD_SD_MCI_ID AT91C_ID_MCI0 ID_MCI0 //ID_MCI -///// MCI pins that shall be configured to access the SD card. -#define BOARD_SD_PINS PINS_MCI -///// MCI slot to which the SD card is connected to. -#define BOARD_SD_SLOT MCI_SD_SLOTA -///// MCI Card Detect pin. -#define BOARD_SD_PIN_CD PIN_MCI_CD - -#define SD_CARD_PRESENT() ( (PIOB->PIO_PDSR & PIO_PB7) == 0 ) - -// States for initialising card -#define SD_ST_ERR -1 -#define SD_ST_STARTUP 0 -#define SD_ST_EMPTY 1 -#define SD_ST_INIT1 2 -#define SD_ST_INIT2 3 -#define SD_ST_IDLE 4 -#define SD_ST_READY 5 -#define SD_ST_IDENT 6 -#define SD_ST_STBY 7 -#define SD_ST_TRAN 8 -#define SD_ST_DATA 9 -#define SD_ST_MOUNTED 10 - -extern uint32_t Cmd_A41_resp; -extern int32_t Card_state; -extern volatile uint32_t Card_initialized; -extern uint32_t Card_CSD[4]; -extern uint32_t transSpeed; - -#define OCR_SD_CCS (1UL << 30) - -#define SD_CSD(csd, bitfield, bits) ((csd[3-(bitfield)/32] >> ((bitfield)%32)) & ((1 << (bits)) - 1)) - -#define SD_CSD_TRAN_SPEED(pSd) SD_CSD(pSd, 96, 8) ///< Max. data transfer rate - -#define SD_CSD_C_SIZE(pSd) ((SD_CSD(pSd, 72, 2) << 10) + \ - (SD_CSD(pSd, 64, 8) << 2) + \ - SD_CSD(pSd, 62, 2)) ///< Device size - -#define SD_CSD_C_SIZE_HC(csd) ((SD_CSD(csd, 64, 6) << 16) + \ - (SD_CSD(csd, 56, 8) << 8) + \ - SD_CSD(csd, 48, 8)) ///< Device size v2.0 High Capacity - -#define SD_CSD_C_SIZE_MULT(pSd) SD_CSD(pSd, 47, 3) ///< Device size multiplier - -#define SD_CSD_MULT(pSd) (1 << (SD_CSD_C_SIZE_MULT(pSd) + 2)) - -#define SD_CSD_READ_BL_LEN(pSd) SD_CSD(pSd, 80, 4) ///< Max. read data block length - -#define SD_CSD_BLKLEN(pSd) (1 << (SD_CSD_READ_BL_LEN(pSd) - 9)) - -#define SD_CSD_BLOCKNR(pSd) ((SD_CSD_C_SIZE(pSd) + 1) * SD_CSD_MULT(pSd)) * SD_CSD_BLKLEN(pSd) - -#define SD_CSD_BLOCKNR_HC(pSd) ((SD_CSD_C_SIZE_HC(pSd) + 1) * 1024) - -#if !defined(SIMU) - #define SD_IS_HC() (Cmd_A41_resp & OCR_SD_CCS) - #define SD_GET_BLOCKNR() (SD_IS_HC() ? (SD_CSD_BLOCKNR_HC(Card_CSD)) : (SD_CSD_BLOCKNR(Card_CSD))) - #define SD_GET_SPEED() (transSpeed) +#if defined(REVX) + #define TRIMS_GPIO_REG_LHL PIOB->PIO_PDSR + #define TRIMS_GPIO_REG_LVD PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_RVU PIOC->PIO_PDSR + #define TRIMS_GPIO_REG_RHL PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_LHR PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_LVU PIOC->PIO_PDSR + #define TRIMS_GPIO_REG_RVD PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_RHR PIOC->PIO_PDSR #else - #define SD_IS_HC() (0) - #define SD_GET_BLOCKNR() (0) - #define SD_GET_SPEED() (0) + #define TRIMS_GPIO_REG_LHL PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_LVD PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_RVU PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_RHL PIOA->PIO_PDSR + #define TRIMS_GPIO_REG_LHR PIOB->PIO_PDSR + #define TRIMS_GPIO_REG_LVU PIOC->PIO_PDSR + #define TRIMS_GPIO_REG_RVD PIOC->PIO_PDSR + #define TRIMS_GPIO_REG_RHR PIOC->PIO_PDSR #endif -//------------------------------------------------------------------------------ +#if defined(REVX) + #define TRIMS_GPIO_PIN_LHL 0x00000010 + #define TRIMS_GPIO_PIN_LVD 0x01000000 + #define TRIMS_GPIO_PIN_RVU 0x00000400 + #define TRIMS_GPIO_PIN_RHL 0x00000001 + #define TRIMS_GPIO_PIN_LHR 0x00800000 + #define TRIMS_GPIO_PIN_LVU 0x10000000 + #define TRIMS_GPIO_PIN_RVD 0x00000002 + #define TRIMS_GPIO_PIN_RHR 0x00000200 +#elif defined(REVA) + #define TRIMS_GPIO_PIN_LHL 0x00000080 + #define TRIMS_GPIO_PIN_LVD 0x08000000 + #define TRIMS_GPIO_PIN_RVU 0x40000000 + #define TRIMS_GPIO_PIN_RHL 0x20000000 + #define TRIMS_GPIO_PIN_LHR 0x00000010 + #define TRIMS_GPIO_PIN_LVU 0x10000000 + #define TRIMS_GPIO_PIN_RVD 0x00000400 + #define TRIMS_GPIO_PIN_RHR 0x00000200 +#else + #define TRIMS_GPIO_PIN_LHL 0x00800000 + #define TRIMS_GPIO_PIN_LVD 0x01000000 + #define TRIMS_GPIO_PIN_RVU 0x00000002 + #define TRIMS_GPIO_PIN_RHL 0x00000001 + #define TRIMS_GPIO_PIN_LHR 0x00000010 + #define TRIMS_GPIO_PIN_LVU 0x10000000 + #define TRIMS_GPIO_PIN_RVD 0x00000400 + #define TRIMS_GPIO_PIN_RHR 0x00000200 +#endif -//------------------------------------------------------------------------------ -/// \par sam3s_ek_mem "SAM3S-EK - Memories" -/// This page lists definitions related to internal & external on-board memories. -/// -/// !Embedded Flash -/// - BOARD_FLASH_EFC +void usbMassStorage(); -/// Internal SRAM address -#define AT91C_ISRAM AT91C_IRAM -#define AT91C_ISRAM_SIZE 0x00008000 +#define PIN_ENABLE 0x001 +#define PIN_PERIPHERAL 0x000 +#define PIN_INPUT 0x002 +#define PIN_OUTPUT 0x000 +#define PIN_PULLUP 0x004 +#define PIN_NO_PULLUP 0x000 +#define PIN_PULLDOWN 0x008 +#define PIN_NO_PULLDOWN 0x000 +#define PIN_PERI_MASK_L 0x010 +#define PIN_PERI_MASK_H 0x020 +#define PIN_PER_A 0x000 +#define PIN_PER_B 0x010 +#define PIN_PER_C 0x020 +#define PIN_PER_D 0x030 +#define PIN_PORT_MASK 0x0C0 +#define PIN_PORTA 0x000 +#define PIN_PORTB 0x040 +#define PIN_PORTC 0x080 +#define PIN_LOW 0x000 +#define PIN_HIGH 0x100 -#define AT91C_IFLASH_SIZE (0x40000) -#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH 0 Page Size: 256 bytes -#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH 0 Number of Pages: 512 -#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH 0 Lock Region Size: 16 Kbytes -#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH 0 Number of Lock Bits: 16 +// Telemetry port +#define SECOND_USART USART0 +#define SECOND_ID ID_USART0 +#define SECOND_PINS { PINS_USART0 } -//------------------------------------------------------------------------------ +void configure_pins( uint32_t pins, uint16_t config ); +uint16_t getCurrent(); +extern uint8_t temperature ; // Raw temp reading +extern uint8_t maxTemperature ; // Raw temp reading +uint8_t getTemperature(); -//------------------------------------------------------------------------------ -/// \section sam3s_ek_extcomp "SAM3S-EK - External components" -/// This page lists the definitions related to external on-board components -/// located in the board.h file for the SAM3S-EK. -/// -//------------------------------------------------------------------------------ +#define strcpy_P strcpy +#define strcat_P strcat -//------------------------------------------------------------------------------ -/// \par sam3s_ek_chipdef "SAM3S-EK - Individual chip definition" -/// This page lists the definitions related to different chip's definition -/// located in the board.h file for the SAM3S-EK. +#if !defined(REVA) +extern uint16_t Current_analogue; +extern uint16_t Current_max; +extern uint32_t Current_accumulator; +extern uint32_t Current_used; +extern uint16_t sessionTimer; +void calcConsumption(); +#endif -/// DBGU -#define BOARD_DBGU_ID ID_DBGU +// Trainer driver +#define SLAVE_MODE() (pwrCheck() == e_power_trainer) +void checkTrainerSettings(); +void init_trainer_capture(); -/// Rtc -#define BOARD_RTC_ID ID_RTC +// Write Flash driver +#define FLASH_PAGESIZE 256 +void writeFlash(uint32_t * address, uint32_t * buffer); -/// Twi eeprom -#define BOARD_ID_TWI_EEPROM ID_TWI1 -#define BOARD_BASE_TWI_EEPROM TWI1 -#define BOARD_PINS_TWI_EEPROM PINS_TWI1 +// Keys driver +extern uint32_t readKeys(); +extern uint32_t readTrims(); +#define TRIMS_PRESSED() readTrims() +#define KEYS_PRESSED() readKeys() -/// USART -#define BOARD_PIN_USART_RXD PIN_USART1_RXD -#define BOARD_PIN_USART_TXD PIN_USART1_TXD -#define BOARD_PIN_USART_CTS PIN_USART1_CTS -#define BOARD_PIN_USART_RTS PIN_USART1_RTS -#define BOARD_PIN_USART_EN PIN_USART1_EN -#define BOARD_USART_BASE USART1 -#define BOARD_ID_USART ID_USART1 +// Pulses driver +void init_no_pulses(uint32_t port); +void disable_no_pulses(uint32_t port); +void init_ppm(uint32_t port); +void disable_ppm(uint32_t port); +void init_pxx(uint32_t port); +void disable_pxx(uint32_t port); +void init_dsm2(uint32_t port); +void disable_dsm2(uint32_t port); -// BlueTooth -#define BT_USART UART1 -#define BT_ID ID_UART1 +// SD driver +#if defined(SIMU) + #define sdInit() + #define sdDone() +#else + #define sdPoll10ms() + void sdMountPoll(); + extern "C" { + void init_SDcard(); + void sdInit(); + void sdDone(); + uint32_t sd_card_ready(); + uint32_t sdMounted(); + } +#endif -//------------------------------------------------------------------------------ +// WDT driver +#if defined(SIMU) + #define wdt_disable() + #define wdt_enable(x) + #define wdt_reset() +#else + #define wdt_disable() + #define wdt_enable(x) WDT->WDT_MR = 0x3FFF207F + #define wdt_reset() WDT->WDT_CR = 0xA5000001 +#endif +// Backlight driver +#define setBacklight(xx) (PWM->PWM_CH_NUM[0].PWM_CDTYUPD = xx) +#define backlightEnable() (PWM->PWM_CH_NUM[0].PWM_CDTY = g_eeGeneral.backlightBright) +#define backlightDisable() (PWM->PWM_CH_NUM[0].PWM_CDTY = 100) +#define isBacklightEnable() (PWM->PWM_CH_NUM[0].PWM_CDTY != 100) -#define PIN_EBI_NANDOE {1 << 9, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NANDWE {1 << 10, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NANDCLE {1 << 17, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NANDALE {1 << 16, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} -#define PIN_EBI_NANDIO {0x000000FF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} - -/// Nandflash chip enable pin definition. -#define BOARD_NF_CE_PIN {1 << 14, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} -/// Nandflash ready/busy pin definition. -#define BOARD_NF_RB_PIN {1 << 18, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP} - -/// Nandflash controller peripheral pins definition. -#define PINS_NANDFLASH PIN_EBI_NANDIO, BOARD_NF_CE_PIN, BOARD_NF_RB_PIN, PIN_EBI_NANDOE, \ - PIN_EBI_NANDWE, PIN_EBI_NANDCLE, PIN_EBI_NANDALE - -/// Address for transferring command bytes to the nandflash. -#define BOARD_NF_COMMAND_ADDR 0x60400000 -/// Address for transferring address bytes to the nandflash. -#define BOARD_NF_ADDRESS_ADDR 0x60200000 -/// Address for transferring data bytes to the nandflash. -#define BOARD_NF_DATA_ADDR 0x60000000 - -extern uint32_t Master_frequency ; - -struct t_serial_tx -{ - uint8_t *buffer ; - uint16_t size ; - volatile uint16_t ready ; +// ADC driver +enum Analogs { + STICK1, + STICK2, + STICK3, + STICK4, + POT1, + POT2, + POT3, + POT_LAST = POT3, + TX_VOLTAGE, +#if !defined(REVA) + TX_CURRENT, +#endif + NUMBER_ANALOG }; +void adcInit(); +void adcRead(void); +uint16_t getAnalogValue(uint8_t index); +uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps +void setSticksGain(uint8_t gains); -#endif // _BOARD_H_ +// Buzzer driver +void buzzerSound(uint8_t duration); +void buzzerHeartbeat(); +#define BUZZER_HEARTBEAT buzzerHeartbeat + +// i2c driver +void i2cCheck(); + +// Coproc driver +void coprocInit(); +void coprocWriteData(uint8_t *data, uint32_t size); +void coprocReadData(bool onlytemp=false); +extern int8_t volumeRequired; +extern uint8_t Coproc_read; +extern int8_t Coproc_valid; +extern int8_t Coproc_temp; +extern int8_t Coproc_maxtemp; + +// Haptic driver +void hapticOff(void); +void hapticOn(uint32_t pwmPercent); + +// BlueTooth driver +#if defined(BLUETOOTH) +void btInit(); +void btTask(void* pdata); +void btPushByte(uint8_t data); +#endif + +// Power driver +void pwrInit(); +void pwrOff(); +uint32_t pwrCheck(); +uint32_t pwroffPressed(); +#define UNEXPECTED_SHUTDOWN() (g_eeGeneral.unexpectedShutdown) + +// EEPROM driver +void eepromInit(); +uint32_t eepromReadStatus(); +extern volatile uint32_t Spi_complete; +void eepromWriteEnable(); +void eepromBlockErase(uint32_t address); +void eepromReadArray(uint32_t address, uint8_t * buffer, uint32_t size); +void eepromByteProgram(uint32_t address, uint8_t * buffer, uint32_t size); + +// Rotary Encoder driver +void rotencInit(); +void rotencEnd(); + +#if ROTARY_ENCODERS > 0 + #define REA_DOWN() (!(PIOB->PIO_PDSR & 0x40)) +#else + #define REA_DOWN() (0) +#endif + +// Debug driver +void debugPutc(const char c); + +// Telemetry driver +void telemetryPortInit(uint32_t baudrate, int mode); +uint32_t telemetryTransmitPending(); +void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size); +void rxPdcUsart( void (*pChProcess)(uint8_t x) ); + +// Second UART driver +void serial2TelemetryInit(unsigned int protocol); +bool telemetrySecondPortReceive(uint8_t & data); + +extern const uint8_t BootCode[]; + +#endif // _BOARD_SKY9X_H_ diff --git a/radio/src/targets/sky9x/board_lowlevel.c b/radio/src/targets/sky9x/board_lowlevel.c index 57dc522db..d01d18a90 100644 --- a/radio/src/targets/sky9x/board_lowlevel.c +++ b/radio/src/targets/sky9x/board_lowlevel.c @@ -1,23 +1,23 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + /** * \file * @@ -30,7 +30,7 @@ * Headers *----------------------------------------------------------------------------*/ -#include "board.h" +#include "board_lowlevel.h" /*---------------------------------------------------------------------------- * Local definitions diff --git a/radio/src/targets/sky9x/board_lowlevel.h b/radio/src/targets/sky9x/board_lowlevel.h new file mode 100644 index 000000000..3f7f5be8d --- /dev/null +++ b/radio/src/targets/sky9x/board_lowlevel.h @@ -0,0 +1,637 @@ +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +// TODO merge this file with board_sky9x.h + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +#include + +#include "chip.h" + +#if defined(REVA) +#include "AT91SAM3S2.h" +#else +#include "AT91SAM3S4.h" +#endif + +#if !defined(SIMU) +#include "core_cm3.h" +#endif + +//------------------------------------------------------------------------------ +// Definitions +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par +/// This page lists several definition related to the board description. +/// +/// Definitions +/// - BOARD_NAME + +/// Name of the board. +#define BOARD_NAME "AT91SAM3S-EK" +/// Board definition. +#define at91sam3sek +/// Family definition (already defined). +#define at91sam3s +/// Core definition +#define cortexm3 + +// TODO remove these definitions +//#define BOARD_REV_A +#define BOARD_REV_B + +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par sam3s_ek_opfreq "SAM3S-EK - Operating frequencies" +/// This page lists several definition related to the board operating frequency +/// (when using the initialization done by board_lowlevel.c). +/// +/// !Definitions +/// - BOARD_MAINOSC +/// - BOARD_MCK + +/// Frequency of the board main oscillator. +#define BOARD_MAINOSC 12000000 + +/// Master clock frequency (when using board_lowlevel.c). +// #define BOARD_MCK 64000000 + +//------------------------------------------------------------------------------ +// ADC +//------------------------------------------------------------------------------ + +/// Startup time max, return from Idle mode (in �s) +#define ADC_STARTUP_TIME_MAX 15 +/// Track and hold Acquisition Time min (in ns) +#define ADC_TRACK_HOLD_TIME_MIN 1200 + +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// USB attributes configuration descriptor (bus or self powered, remote wakeup) +//#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_RWAKEUP +#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par sam3s_ek_piodef "SAM3S-EK - PIO definitions" +/// This pages lists all the pio definitions contained in board.h. The constants +/// are named using the following convention: PIN_* for a constant which defines +/// a single Pin instance (but may include several PIOs sharing the same +/// controller), and PINS_* for a list of Pin instances. +/// +/// !ADC +/// - PIN_ADC0_AD0 +/// - PIN_ADC0_AD1 +/// - PIN_ADC0_AD2 +/// - PIN_ADC0_AD3 +/// - PIN_ADC0_AD4 +/// - PIN_ADC0_AD5 +/// - PIN_ADC0_AD6 +/// - PIN_ADC0_AD7 +/// - PINS_ADC0 +/// +/// !UART +/// - PINS_UART +/// +/// !EBI +/// - PIN_EBI_DATA_BUS +/// - PIN_EBI_NCS0 +/// - PIN_EBI_NRD +/// - PIN_EBI_NWE +/// - PIN_EBI_ADDR_BUS +/// - PIN_EBI_PSRAM_NBS +/// - PIN_EBI_A1 +/// - PIN_EBI_LCD_RS +/// +/// !LEDs +/// - PIN_LED_0 +/// - PIN_LED_1 +/// - PIN_LED_2 +/// - PINS_LEDS +/// +/// !MCI +/// - PINS_MCI +/// +/// !Push buttons +/// - PIN_PUSHBUTTON_1 +/// - PIN_PUSHBUTTON_2 +/// - PINS_PUSHBUTTONS +/// - PUSHBUTTON_BP1 +/// - PUSHBUTTON_BP2 +/// +/// !PWMC +/// - PIN_PWMC_PWMH0 +/// - PIN_PWMC_PWML0 +/// - PIN_PWMC_PWMH1 +/// - PIN_PWMC_PWML1 +/// - PIN_PWMC_PWMH2 +/// - PIN_PWMC_PWML2 +/// - PIN_PWMC_PWMH3 +/// - PIN_PWMC_PWML3 +/// - PIN_PWM_LED0 +/// - PIN_PWM_LED1 +/// - PIN_PWM_LED2 +/// - CHANNEL_PWM_LED0 +/// - CHANNEL_PWM_LED1 +/// - CHANNEL_PWM_LED2 +/// +/// !SPI +/// - PIN_SPI_MISO +/// - PIN_SPI_MOSI +/// - PIN_SPI_SPCK +/// - PINS_SPI +/// - PIN_SPI_NPCS0_PA11 +/// +/// ! SSC +/// - PIN_SSC_TD +/// - PIN_SSC_TK +/// - PIN_SSC_TF +/// - PINS_SSC_CODEC +/// +/// ! PCK0 +/// - PIN_PCK0 +/// +/// !TWI +/// - PIN_TWI_TWD0 +/// - PIN_TWI_TWCK0 +/// - PINS_TWI +/// +/// !USART0 +/// - PIN_USART0_RXD +/// - PIN_USART0_TXD +/// - PIN_USART0_CTS +/// - PIN_USART0_RTS +/// - PIN_USART0_SCK +/// +/// !USB +/// - PIN_USB_PULLUP +/// + +/// ADC_AD0 pin definition. +#define PIN_ADC0_AD0 {1 << 21, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD1 pin definition. +#define PIN_ADC0_AD1 {1 << 30, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD2 pin definition. +#define PIN_ADC0_AD2 {1 << 3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD3 pin definition. +#define PIN_ADC0_AD3 {1 << 4, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD4 pin definition. +#define PIN_ADC0_AD4 {1 << 15, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD5 pin definition. +#define PIN_ADC0_AD5 {1 << 16, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD6 pin definition. +#define PIN_ADC0_AD6 {1 << 17, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} +/// ADC_AD7 pin definition. +#define PIN_ADC0_AD7 {1 << 18, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} + +/// Pins ADC +#define PINS_ADC PIN_ADC0_AD0, PIN_ADC0_AD1, PIN_ADC0_AD2, PIN_ADC0_AD3, PIN_ADC0_AD4, PIN_ADC0_AD5, PIN_ADC0_AD6, PIN_ADC0_AD7 + +/** UART pins (UTXD0 and URXD0) definitions, PA9,10. */ +#define PINS_UART {0x00000600, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} + +/// EBI +#define PIN_EBI_DATA_BUS {0xFF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NRD {1 << 11, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NWE {1 << 8, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} + +#define PIN_EBI_NCS0 {1 << 20, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_PSRAM_ADDR_BUS {0x3f00fff, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_PSRAM_NBS {1 << 7, PIOB, ID_PIOB, PIO_PERIPH_B, PIO_PULLUP}, \ + {1 << 15, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_A1 {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} + +#define PIN_EBI_NCS1 {1 << 15, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} /* LCD CS pin */ +#define PIN_EBI_LCD_RS {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} /* LCD RS pin */ + +#ifdef BOARD_REV_A +/** LED #0 pin definition. */ +#define PIN_LED_0 {1 << 20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} +/** LED #1 pin definition. */ +#define PIN_LED_1 {1 << 21, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} +/** LED #2 pin definition. */ +#define PIN_LED_2 {1 << 22, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} +#endif +#ifdef BOARD_REV_B +/** LED #0 pin definition. */ +#define PIN_LED_0 {1 << 19, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} +/** LED #1 pin definition. */ +#define PIN_LED_1 {1 << 20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} +/** LED #2 pin definition. */ +#define PIN_LED_2 {1 << 20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} +#endif + +/** List of all LEDs definitions. */ +#define PINS_LEDS PIN_LED_0, PIN_LED_1, PIN_LED_2 + +/** MCI pins definition. */ +#define PINS_MCI {0x3fUL << 26, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_PULLUP} +/** MCI pin Card Detect. */ +#define PIN_MCI_CD {PIO_PB7, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP} + +/** Push button #0 definition. Attributes = pull-up + debounce + interrupt on rising edge. */ +#define PIN_PUSHBUTTON_1 {1 << 3, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE} +/** Push button #1 definition. Attributes = pull-up + debounce + interrupt on falling edge. */ +#define PIN_PUSHBUTTON_2 {1 << 12, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE} +/** List of all push button definitions. */ +#define PINS_PUSHBUTTONS PIN_PUSHBUTTON_1, PIN_PUSHBUTTON_2 + +/** Push button #1 index. */ +#define PUSHBUTTON_BP1 0 +/** Push button #2 index. */ +#define PUSHBUTTON_BP2 1 + +/// Simulated joystick LEFT index. +#define JOYSTICK_LEFT 0 +/// Simulated joystick RIGHT index. +#define JOYSTICK_RIGHT 1 + +/** PWMC PWM0 pin definition. */ +#define PIN_PWMC_PWMH0 {1 << 18, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} +#define PIN_PWMC_PWML0 {1 << 19, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} +/** PWMC PWM1 pin definition. */ +#define PIN_PWMC_PWMH1 {1 << 19, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} +#define PIN_PWMC_PWML1 {1 << 20, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} +/** PWMC PWM2 pin definition. */ +#define PIN_PWMC_PWMH2 {1 << 20, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} +#define PIN_PWMC_PWML2 {1 << 16, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT} +/** PWMC PWM3 pin definition. */ +#define PIN_PWMC_PWMH3 {1 << 21, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT} +#define PIN_PWMC_PWML3 {1 << 15, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT} +/** PWM pin definition for LED0 */ +#define PIN_PWM_LED0 PIN_PWMC_PWMH0, PIN_PWMC_PWML0 +/** PWM pin definition for LED1 */ +#define PIN_PWM_LED1 PIN_PWMC_PWMH2, PIN_PWMC_PWML2 +/** PWM pin definition for LED2 */ +#define PIN_PWM_LED2 PIN_PWMC_PWMH3, PIN_PWMC_PWML3 +/** PWM channel for LED0 */ +#define CHANNEL_PWM_LED0 0 +/** PWM channel for LED1 */ +#define CHANNEL_PWM_LED1 2 +/** PWM channel for LED2 */ +#define CHANNEL_PWM_LED2 3 + +/** SPI MISO pin definition. */ +#define PIN_SPI_MISO {1 << 12, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +/** SPI MOSI pin definition. */ +#define PIN_SPI_MOSI {1 << 13, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +/** SPI SPCK pin definition. */ +#define PIN_SPI_SPCK {1 << 14, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +/** SPI chip select pin definition. */ +#define PIN_SPI_NPCS0_PA11 {1 << 11, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +/** List of SPI pin definitions (MISO, MOSI & SPCK). */ +#define PINS_SPI PIN_SPI_MISO, PIN_SPI_MOSI, PIN_SPI_SPCK + +/// SSC pins definition. +#define PIN_SSC_TD {0x1 << 26, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_SSC_TK {0x1 << 28, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_SSC_TF {0x1 << 30, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PINS_SSC_CODEC PIN_SSC_TD, PIN_SSC_TK, PIN_SSC_TF + +/// PCK0 +#define PIN_PCK0 {0x1 << 21, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} + +/// TWI pins definition. +#define TWI_V3XX +#define PIN_TWI_TWD0 {0x1 << 9, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_TWI_TWCK0 {0x1 << 10, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PINS_TWI0 PIN_TWI_TWD0, PIN_TWI_TWCK0 +#define PIN_TWI_TWD1 {0x1 << 24, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_TWI_TWCK1 {0x1 << 25, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PINS_TWI1 PIN_TWI_TWD1, PIN_TWI_TWCK1 + +/// USART0 +#define PIN_USART0_RXD {0x1 << 19, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART0_TXD {0x1 << 18, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART0_CTS {0x1 << 8, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART0_RTS {0x1 << 7, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART0_SCK {0x1 << 17, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} + +/// USART1 +#define PIN_USART1_RXD {0x1 << 21, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART1_TXD {0x1 << 22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART1_CTS {0x1 << 25, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART1_RTS {0x1 << 24, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} +#define PIN_USART1_EN {0x1 << 23, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} + +/// USB VBus monitoring pin definition. +#ifdef BOARD_REV_A +#define PIN_USB_VBUS {1 << 23, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} +#endif +#ifdef BOARD_REV_B +#define PIN_USB_VBUS {1 << 21, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT} +#endif + +#define usbPlugged() (PIOC->PIO_PDSR & PIO_PC25) + +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par sam3s_ek_extcomp "SAM3S-EK - External components" +/// This page lists the definitions related to external on-board components +/// located in the board.h file for the AT91SAM3S-EK. +/// +/// !AT45 Dataflash Card +/// - BOARD_AT45_A_SPI_BASE +/// - BOARD_AT45_A_SPI_ID +/// - BOARD_AT45_A_SPI_PINS +/// - BOARD_AT45_A_SPI +/// - BOARD_AT45_A_NPCS +/// - BOARD_AT45_A_NPCS_PIN +/// +/// !AT45 Dataflash (serial onboard DataFlash) +/// - BOARD_AT45_B_SPI_BASE +/// - BOARD_AT45_B_SPI_ID +/// - BOARD_AT45_B_SPI_PINS +/// - BOARD_AT45_B_SPI +/// - BOARD_AT45_B_NPCS +/// - BOARD_AT45_B_NPCS_PIN +/// +/// !AT26 Serial Flash +/// - BOARD_AT26_A_SPI_BASE +/// - BOARD_AT26_A_SPI_ID +/// - BOARD_AT26_A_SPI_PINS +/// - BOARD_AT26_A_SPI +/// - BOARD_AT26_A_NPCS +/// - BOARD_AT26_A_NPCS_PIN +/// +/// !SD Card +/// - MCI2_INTERFACE +/// - BOARD_SD_MCI_BASE +/// - BOARD_SD_MCI_ID +/// - BOARD_SD_PINS +/// - BOARD_SD_SLOT +/// +/// !PSRAM +/// - BOARD_PSRAM_PINS +/// +/// !LCD +/// - BOARD_LCD_ILI9325 +/// - BOARD_LCD_PINS +/// - BOARD_BACKLIGHT_PIN +/// - BOARD_LCD_BASE +/// - BOARD_LCD_RS +/// - BOARD_LCD_WIDTH +/// - BOARD_LCD_HEIGHT +/// +/// !TouchScreen +/// - BOARD_TSC_ADS7843 +/// - PIN_TCS_IRQ +/// - PIN_TCS_BUSY +/// - BOARD_TSC_SPI_BASE +/// - BOARD_TSC_SPI_ID +/// - BOARD_TSC_SPI_PINS +/// - BOARD_TSC_NPCS +/// - BOARD_TSC_NPCS_PIN +/// +/// Base address of SPI peripheral connected to the dataflash. +//#define BOARD_AT45_A_SPI_BASE SPI0 +///// Identifier of SPI peripheral connected to the dataflash. +//#define BOARD_AT45_A_SPI_ID ID_SPI0 +///// Pins of the SPI peripheral connected to the dataflash. +//#define BOARD_AT45_A_SPI_PINS PINS_SPI0 +///// Dataflahs SPI number. +//#define BOARD_AT45_A_SPI 0 +///// Chip select connected to the dataflash. +//#define BOARD_AT45_A_NPCS 3 +///// Chip select pin connected to the dataflash. +//#define BOARD_AT45_A_NPCS_PIN PIN_SPI0_NPCS3 + +/// Base address of SPI peripheral connected to the dataflash. +//#define BOARD_AT45_B_SPI_BASE SPI1 +///// Identifier of SPI peripheral connected to the dataflash. +//#define BOARD_AT45_B_SPI_ID ID_SPI1 +///// Pins of the SPI peripheral connected to the dataflash. +//#define BOARD_AT45_B_SPI_PINS PINS_SPI1 +///// Dataflahs SPI number. +//#define BOARD_AT45_B_SPI 1 +///// Chip select connected to the dataflash. +//#define BOARD_AT45_B_NPCS 3 +///// Chip select pin connected to the dataflash. +//#define BOARD_AT45_B_NPCS_PIN PIN_SPI1_NPCS3 + +/// Base address of SPI peripheral connected to the serialflash. +//#define BOARD_AT26_A_SPI_BASE SPI0 +///// Identifier of SPI peripheral connected to the serialflash. +//#define BOARD_AT26_A_SPI_ID ID_SPI0 +///// Pins of the SPI peripheral connected to the serialflash. +//#define BOARD_AT26_A_SPI_PINS PINS_SPI0 +///// Serialflash SPI number. +//#define BOARD_AT26_A_SPI 0 +///// Chip select connected to the serialflash. +//#define BOARD_AT26_A_NPCS 3 +///// Chip select pin connected to the serialflash. +//#define BOARD_AT26_A_NPCS_PIN PIN_SPI0_NPCS3 + +/// ISO7816 +/// - PIN_SMARTCARD_CONNECT +/// - PIN_ISO7816_RSTMC +/// - PINS_ISO7816 + +/// Smartcard detection pin +//#define PIN_SMARTCARD_CONNECT {1 << 5, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} +/// PIN used for reset the smartcard +//#define PIN_ISO7816_RSTMC {1 << 7, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} +/// Pins used for connect the smartcard +//#define PINS_ISO7816 PIN_USART0_TXD, PIN_USART0_SCK, PIN_ISO7816_RSTMC + +/// Dma channel number +#define BOARD_MCI_DMA_CHANNEL 0 +/// MCI0 DMA hardware handshaking ID +#define DMA_HW_SRC_REQ_ID_MCI0 AT91C_HDMA_SRC_PER_0 +#define DMA_HW_DEST_REQ_ID_MCI0 AT91C_HDMA_DST_PER_0 +/// MCI1 DMA hardware handshaking ID +#define DMA_HW_SRC_REQ_ID_MCI1 AT91C_HDMA_SRC_PER_13 +#define DMA_HW_DEST_REQ_ID_MCI1 AT91C_HDMA_DST_PER_13 +/// SD DMA hardware handshaking ID +#define BOARD_SD_DMA_HW_SRC_REQ_ID DMA_HW_SRC_REQ_ID_MCI0 +#define BOARD_SD_DMA_HW_DEST_REQ_ID DMA_HW_DEST_REQ_ID_MCI0 + + +/// HS MCI interface +#define MCI2_INTERFACE +/// Base address of the MCI peripheral connected to the SD card. +#define BOARD_SD_MCI_BASE MCI0//MCI +///// Peripheral identifier of the MCI connected to the SD card. +#define BOARD_SD_MCI_ID AT91C_ID_MCI0 ID_MCI0 //ID_MCI +///// MCI pins that shall be configured to access the SD card. +#define BOARD_SD_PINS PINS_MCI +///// MCI slot to which the SD card is connected to. +#define BOARD_SD_SLOT MCI_SD_SLOTA +///// MCI Card Detect pin. +#define BOARD_SD_PIN_CD PIN_MCI_CD + +#define SD_CARD_PRESENT() ( (PIOB->PIO_PDSR & PIO_PB7) == 0 ) + +// States for initialising card +#define SD_ST_ERR -1 +#define SD_ST_STARTUP 0 +#define SD_ST_EMPTY 1 +#define SD_ST_INIT1 2 +#define SD_ST_INIT2 3 +#define SD_ST_IDLE 4 +#define SD_ST_READY 5 +#define SD_ST_IDENT 6 +#define SD_ST_STBY 7 +#define SD_ST_TRAN 8 +#define SD_ST_DATA 9 +#define SD_ST_MOUNTED 10 + +extern uint32_t Cmd_A41_resp; +extern int32_t Card_state; +extern volatile uint32_t Card_initialized; +extern uint32_t Card_CSD[4]; +extern uint32_t transSpeed; + +#define OCR_SD_CCS (1UL << 30) + +#define SD_CSD(csd, bitfield, bits) ((csd[3-(bitfield)/32] >> ((bitfield)%32)) & ((1 << (bits)) - 1)) + +#define SD_CSD_TRAN_SPEED(pSd) SD_CSD(pSd, 96, 8) ///< Max. data transfer rate + +#define SD_CSD_C_SIZE(pSd) ((SD_CSD(pSd, 72, 2) << 10) + \ + (SD_CSD(pSd, 64, 8) << 2) + \ + SD_CSD(pSd, 62, 2)) ///< Device size + +#define SD_CSD_C_SIZE_HC(csd) ((SD_CSD(csd, 64, 6) << 16) + \ + (SD_CSD(csd, 56, 8) << 8) + \ + SD_CSD(csd, 48, 8)) ///< Device size v2.0 High Capacity + +#define SD_CSD_C_SIZE_MULT(pSd) SD_CSD(pSd, 47, 3) ///< Device size multiplier + +#define SD_CSD_MULT(pSd) (1 << (SD_CSD_C_SIZE_MULT(pSd) + 2)) + +#define SD_CSD_READ_BL_LEN(pSd) SD_CSD(pSd, 80, 4) ///< Max. read data block length + +#define SD_CSD_BLKLEN(pSd) (1 << (SD_CSD_READ_BL_LEN(pSd) - 9)) + +#define SD_CSD_BLOCKNR(pSd) ((SD_CSD_C_SIZE(pSd) + 1) * SD_CSD_MULT(pSd)) * SD_CSD_BLKLEN(pSd) + +#define SD_CSD_BLOCKNR_HC(pSd) ((SD_CSD_C_SIZE_HC(pSd) + 1) * 1024) + +#if !defined(SIMU) + #define SD_IS_HC() (Cmd_A41_resp & OCR_SD_CCS) + #define SD_GET_BLOCKNR() (SD_IS_HC() ? (SD_CSD_BLOCKNR_HC(Card_CSD)) : (SD_CSD_BLOCKNR(Card_CSD))) + #define SD_GET_SPEED() (transSpeed) +#else + #define SD_IS_HC() (0) + #define SD_GET_BLOCKNR() (0) + #define SD_GET_SPEED() (0) +#endif + +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par sam3s_ek_mem "SAM3S-EK - Memories" +/// This page lists definitions related to internal & external on-board memories. +/// +/// !Embedded Flash +/// - BOARD_FLASH_EFC + +/// Internal SRAM address +#define AT91C_ISRAM AT91C_IRAM +#define AT91C_ISRAM_SIZE 0x00008000 + +#define AT91C_IFLASH_SIZE (0x40000) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH 0 Page Size: 256 bytes +#define AT91C_IFLASH_NB_OF_PAGES (1024) // Internal FLASH 0 Number of Pages: 512 +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH 0 Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_LOCK_BITS (16) // Internal FLASH 0 Number of Lock Bits: 16 + +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +/// \section sam3s_ek_extcomp "SAM3S-EK - External components" +/// This page lists the definitions related to external on-board components +/// located in the board.h file for the SAM3S-EK. +/// +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +/// \par sam3s_ek_chipdef "SAM3S-EK - Individual chip definition" +/// This page lists the definitions related to different chip's definition +/// located in the board.h file for the SAM3S-EK. + +/// DBGU +#define BOARD_DBGU_ID ID_DBGU + +/// Rtc +#define BOARD_RTC_ID ID_RTC + +/// Twi eeprom +#define BOARD_ID_TWI_EEPROM ID_TWI1 +#define BOARD_BASE_TWI_EEPROM TWI1 +#define BOARD_PINS_TWI_EEPROM PINS_TWI1 + +/// USART +#define BOARD_PIN_USART_RXD PIN_USART1_RXD +#define BOARD_PIN_USART_TXD PIN_USART1_TXD +#define BOARD_PIN_USART_CTS PIN_USART1_CTS +#define BOARD_PIN_USART_RTS PIN_USART1_RTS +#define BOARD_PIN_USART_EN PIN_USART1_EN +#define BOARD_USART_BASE USART1 +#define BOARD_ID_USART ID_USART1 + +// BlueTooth +#define BT_USART UART1 +#define BT_ID ID_UART1 + +//------------------------------------------------------------------------------ + + +#define PIN_EBI_NANDOE {1 << 9, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NANDWE {1 << 10, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NANDCLE {1 << 17, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NANDALE {1 << 16, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} +#define PIN_EBI_NANDIO {0x000000FF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP} + +/// Nandflash chip enable pin definition. +#define BOARD_NF_CE_PIN {1 << 14, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT} +/// Nandflash ready/busy pin definition. +#define BOARD_NF_RB_PIN {1 << 18, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP} + +/// Nandflash controller peripheral pins definition. +#define PINS_NANDFLASH PIN_EBI_NANDIO, BOARD_NF_CE_PIN, BOARD_NF_RB_PIN, PIN_EBI_NANDOE, \ + PIN_EBI_NANDWE, PIN_EBI_NANDCLE, PIN_EBI_NANDALE + +/// Address for transferring command bytes to the nandflash. +#define BOARD_NF_COMMAND_ADDR 0x60400000 +/// Address for transferring address bytes to the nandflash. +#define BOARD_NF_ADDRESS_ADDR 0x60200000 +/// Address for transferring data bytes to the nandflash. +#define BOARD_NF_DATA_ADDR 0x60000000 + +extern uint32_t Master_frequency ; + +struct t_serial_tx +{ + uint8_t *buffer ; + uint16_t size ; + volatile uint16_t ready ; +}; + +#endif // _BOARD_H_ diff --git a/radio/src/targets/sky9x/board_sky9x.h b/radio/src/targets/sky9x/board_sky9x.h deleted file mode 100644 index bac9482bc..000000000 --- a/radio/src/targets/sky9x/board_sky9x.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _BOARD_SKY9X_H_ -#define _BOARD_SKY9X_H_ - -#include -#include "board.h" -#include "audio_driver.h" - -extern uint16_t ResetReason; - -#define BOOTLOADER_SIZE 0x8000 -#define FIRMWARE_SIZE (256*1024) -#define FIRMWARE_ADDRESS 0x00400000 - -// Board driver -void boardInit(void); -#define boardOff() pwrOff() - -// Keys -#if defined(REVA) - #define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR - #define KEYS_GPIO_REG_EXIT PIOA->PIO_PDSR - #define KEYS_GPIO_REG_UP PIOC->PIO_PDSR - #define KEYS_GPIO_REG_DOWN PIOC->PIO_PDSR - #define KEYS_GPIO_REG_RIGHT PIOC->PIO_PDSR - #define KEYS_GPIO_REG_LEFT PIOC->PIO_PDSR - #define KEYS_GPIO_PIN_MENU 0x00000040 - #define KEYS_GPIO_PIN_EXIT 0x80000000 - #define KEYS_GPIO_PIN_UP 0x00000004 - #define KEYS_GPIO_PIN_DOWN 0x00000008 - #define KEYS_GPIO_PIN_RIGHT 0x00000010 - #define KEYS_GPIO_PIN_LEFT 0x00000020 -#else - #define KEYS_GPIO_REG_MENU PIOB->PIO_PDSR - #define KEYS_GPIO_REG_EXIT PIOC->PIO_PDSR - #define KEYS_GPIO_REG_UP PIOC->PIO_PDSR - #define KEYS_GPIO_REG_DOWN PIOC->PIO_PDSR - #define KEYS_GPIO_REG_RIGHT PIOC->PIO_PDSR - #define KEYS_GPIO_REG_LEFT PIOC->PIO_PDSR - #define KEYS_GPIO_PIN_MENU 0x00000020 - #define KEYS_GPIO_PIN_EXIT 0x01000000 - #define KEYS_GPIO_PIN_UP 0x00000002 - #define KEYS_GPIO_PIN_DOWN 0x00000020 - #define KEYS_GPIO_PIN_RIGHT 0x00000010 - #define KEYS_GPIO_PIN_LEFT 0x00000008 -#endif - -#if defined(REVX) - #define TRIMS_GPIO_REG_LHL PIOB->PIO_PDSR - #define TRIMS_GPIO_REG_LVD PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_RVU PIOC->PIO_PDSR - #define TRIMS_GPIO_REG_RHL PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_LHR PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_LVU PIOC->PIO_PDSR - #define TRIMS_GPIO_REG_RVD PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_RHR PIOC->PIO_PDSR -#else - #define TRIMS_GPIO_REG_LHL PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_LVD PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_RVU PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_RHL PIOA->PIO_PDSR - #define TRIMS_GPIO_REG_LHR PIOB->PIO_PDSR - #define TRIMS_GPIO_REG_LVU PIOC->PIO_PDSR - #define TRIMS_GPIO_REG_RVD PIOC->PIO_PDSR - #define TRIMS_GPIO_REG_RHR PIOC->PIO_PDSR -#endif - -#if defined(REVX) - #define TRIMS_GPIO_PIN_LHL 0x00000010 - #define TRIMS_GPIO_PIN_LVD 0x01000000 - #define TRIMS_GPIO_PIN_RVU 0x00000400 - #define TRIMS_GPIO_PIN_RHL 0x00000001 - #define TRIMS_GPIO_PIN_LHR 0x00800000 - #define TRIMS_GPIO_PIN_LVU 0x10000000 - #define TRIMS_GPIO_PIN_RVD 0x00000002 - #define TRIMS_GPIO_PIN_RHR 0x00000200 -#elif defined(REVA) - #define TRIMS_GPIO_PIN_LHL 0x00000080 - #define TRIMS_GPIO_PIN_LVD 0x08000000 - #define TRIMS_GPIO_PIN_RVU 0x40000000 - #define TRIMS_GPIO_PIN_RHL 0x20000000 - #define TRIMS_GPIO_PIN_LHR 0x00000010 - #define TRIMS_GPIO_PIN_LVU 0x10000000 - #define TRIMS_GPIO_PIN_RVD 0x00000400 - #define TRIMS_GPIO_PIN_RHR 0x00000200 -#else - #define TRIMS_GPIO_PIN_LHL 0x00800000 - #define TRIMS_GPIO_PIN_LVD 0x01000000 - #define TRIMS_GPIO_PIN_RVU 0x00000002 - #define TRIMS_GPIO_PIN_RHL 0x00000001 - #define TRIMS_GPIO_PIN_LHR 0x00000010 - #define TRIMS_GPIO_PIN_LVU 0x10000000 - #define TRIMS_GPIO_PIN_RVD 0x00000400 - #define TRIMS_GPIO_PIN_RHR 0x00000200 -#endif - -void usbMassStorage(); - -#define PIN_ENABLE 0x001 -#define PIN_PERIPHERAL 0x000 -#define PIN_INPUT 0x002 -#define PIN_OUTPUT 0x000 -#define PIN_PULLUP 0x004 -#define PIN_NO_PULLUP 0x000 -#define PIN_PULLDOWN 0x008 -#define PIN_NO_PULLDOWN 0x000 -#define PIN_PERI_MASK_L 0x010 -#define PIN_PERI_MASK_H 0x020 -#define PIN_PER_A 0x000 -#define PIN_PER_B 0x010 -#define PIN_PER_C 0x020 -#define PIN_PER_D 0x030 -#define PIN_PORT_MASK 0x0C0 -#define PIN_PORTA 0x000 -#define PIN_PORTB 0x040 -#define PIN_PORTC 0x080 -#define PIN_LOW 0x000 -#define PIN_HIGH 0x100 - -// Telemetry port -#define SECOND_USART USART0 -#define SECOND_ID ID_USART0 -#define SECOND_PINS { PINS_USART0 } - -void configure_pins( uint32_t pins, uint16_t config ); -uint16_t getCurrent(); - -extern uint8_t temperature ; // Raw temp reading -extern uint8_t maxTemperature ; // Raw temp reading -uint8_t getTemperature(); - -#define strcpy_P strcpy -#define strcat_P strcat - -#if !defined(REVA) -extern uint16_t Current_analogue; -extern uint16_t Current_max; -extern uint32_t Current_accumulator; -extern uint32_t Current_used; -extern uint16_t sessionTimer; -void calcConsumption(); -#endif - -// Trainer driver -#define SLAVE_MODE() (pwrCheck() == e_power_trainer) -void checkTrainerSettings(); -void init_trainer_capture(); - -// Write Flash driver -#define FLASH_PAGESIZE 256 -void writeFlash(uint32_t * address, uint32_t * buffer); - -// Keys driver -extern uint32_t readKeys(); -extern uint32_t readTrims(); -#define TRIMS_PRESSED() readTrims() -#define KEYS_PRESSED() readKeys() - -// Pulses driver -void init_no_pulses(uint32_t port); -void disable_no_pulses(uint32_t port); -void init_ppm(uint32_t port); -void disable_ppm(uint32_t port); -void init_pxx(uint32_t port); -void disable_pxx(uint32_t port); -void init_dsm2(uint32_t port); -void disable_dsm2(uint32_t port); - -// SD driver -#if defined(SIMU) - #define sdInit() - #define sdDone() -#else - #define sdPoll10ms() - void sdMountPoll(); - extern "C" { - void init_SDcard(); - void sdInit(); - void sdDone(); - uint32_t sd_card_ready(); - uint32_t sdMounted(); - } -#endif - -// WDT driver -#if defined(SIMU) - #define wdt_disable() - #define wdt_enable(x) - #define wdt_reset() -#else - #define wdt_disable() - #define wdt_enable(x) WDT->WDT_MR = 0x3FFF207F - #define wdt_reset() WDT->WDT_CR = 0xA5000001 -#endif - -// Backlight driver -#define setBacklight(xx) (PWM->PWM_CH_NUM[0].PWM_CDTYUPD = xx) -#define backlightEnable() (PWM->PWM_CH_NUM[0].PWM_CDTY = g_eeGeneral.backlightBright) -#define backlightDisable() (PWM->PWM_CH_NUM[0].PWM_CDTY = 100) -#define isBacklightEnable() (PWM->PWM_CH_NUM[0].PWM_CDTY != 100) - -// ADC driver -enum Analogs { - STICK1, - STICK2, - STICK3, - STICK4, - POT1, - POT2, - POT3, - POT_LAST = POT3, - TX_VOLTAGE, -#if !defined(REVA) - TX_CURRENT, -#endif - NUMBER_ANALOG -}; -void adcInit(); -void adcRead(void); -uint16_t getAnalogValue(uint8_t index); -uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps -void setSticksGain(uint8_t gains); - -// Buzzer driver -void buzzerSound(uint8_t duration); -void buzzerHeartbeat(); -#define BUZZER_HEARTBEAT buzzerHeartbeat - -// i2c driver -void i2cCheck(); - -// Coproc driver -void coprocInit(); -void coprocWriteData(uint8_t *data, uint32_t size); -void coprocReadData(bool onlytemp=false); -extern int8_t volumeRequired; -extern uint8_t Coproc_read; -extern int8_t Coproc_valid; -extern int8_t Coproc_temp; -extern int8_t Coproc_maxtemp; - -// Haptic driver -void hapticOff(void); -void hapticOn(uint32_t pwmPercent); - -// BlueTooth driver -#if defined(BLUETOOTH) -void btInit(); -void btTask(void* pdata); -void btPushByte(uint8_t data); -#endif - -// Power driver -void pwrInit(); -void pwrOff(); -uint32_t pwrCheck(); -uint32_t pwroffPressed(); -#define UNEXPECTED_SHUTDOWN() (g_eeGeneral.unexpectedShutdown) - -// EEPROM driver -void eepromInit(); -uint32_t eepromReadStatus(); -extern volatile uint32_t Spi_complete; -void eepromWriteEnable(); -void eepromBlockErase(uint32_t address); -void eepromReadArray(uint32_t address, uint8_t * buffer, uint32_t size); -void eepromByteProgram(uint32_t address, uint8_t * buffer, uint32_t size); - -// Rotary Encoder driver -void rotencInit(); -void rotencEnd(); - -#if ROTARY_ENCODERS > 0 - #define REA_DOWN() (!(PIOB->PIO_PDSR & 0x40)) -#else - #define REA_DOWN() (0) -#endif - -// Debug driver -void debugPutc(const char c); - -// Telemetry driver -void telemetryPortInit(uint32_t baudrate, int mode); -uint32_t telemetryTransmitPending(); -void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size); -void rxPdcUsart( void (*pChProcess)(uint8_t x) ); - -// Second UART driver -void serial2TelemetryInit(unsigned int protocol); -bool telemetrySecondPortReceive(uint8_t & data); - -extern const uint8_t BootCode[]; - -#endif // _BOARD_SKY9X_H_ diff --git a/radio/src/targets/sky9x/i2c_driver.cpp b/radio/src/targets/sky9x/i2c_driver.cpp index fee1fe3d2..7479a71f7 100644 --- a/radio/src/targets/sky9x/i2c_driver.cpp +++ b/radio/src/targets/sky9x/i2c_driver.cpp @@ -20,7 +20,7 @@ #include "i2c_driver.h" #include "twi.h" -#include "board.h" +#include "board_lowlevel.h" #include "stdlib.h" #define I2C_CLK_FAST 400000 diff --git a/radio/src/targets/sky9x/usb/common/core/USBDeviceDescriptor.h b/radio/src/targets/sky9x/usb/common/core/USBDeviceDescriptor.h index 68e27d901..22fc1a410 100644 --- a/radio/src/targets/sky9x/usb/common/core/USBDeviceDescriptor.h +++ b/radio/src/targets/sky9x/usb/common/core/USBDeviceDescriptor.h @@ -42,7 +42,7 @@ #ifndef USBDEVICEDESCRIPTOR_H #define USBDEVICEDESCRIPTOR_H -#include "../../../board.h" +#include "board_lowlevel.h" //------------------------------------------------------------------------------ // Definitions //------------------------------------------------------------------------------ diff --git a/radio/src/targets/sky9x/usb/common/core/USBIrqHandler.c b/radio/src/targets/sky9x/usb/common/core/USBIrqHandler.c index c0a61bf3b..09a2a4709 100644 --- a/radio/src/targets/sky9x/usb/common/core/USBIrqHandler.c +++ b/radio/src/targets/sky9x/usb/common/core/USBIrqHandler.c @@ -39,7 +39,7 @@ //------------------------------------------------------------------------------ #include -#include "../../../board.h" +#include "radio/src/targets/sky9x/board_lowlevel.h" #include "../../../usb/device/core/USBD.h" //------------------------------------------------------------------------------ diff --git a/radio/src/targets/sky9x/usb/device/core/USBDDriver.c b/radio/src/targets/sky9x/usb/device/core/USBDDriver.c index f510d700f..2d2da3017 100644 --- a/radio/src/targets/sky9x/usb/device/core/USBDDriver.c +++ b/radio/src/targets/sky9x/usb/device/core/USBDDriver.c @@ -42,7 +42,7 @@ #include "../../../usb/common/core/USBSetAddressRequest.h" #include "../../../usb/common/core/USBSetConfigurationRequest.h" #include "../../../usb/device/core/USBD.h" -#include "../../../board.h" +#include "board_lowlevel.h" #include "../../../usb/common/core/USBConfigurationDescriptor.h" #include "../../../usb/common/core/USBDeviceDescriptor.h" #include "../../../usb/common/core/USBDeviceQualifierDescriptor.h" diff --git a/radio/src/targets/sky9x/usb/device/core/USBD_UDP.c b/radio/src/targets/sky9x/usb/device/core/USBD_UDP.c index 80794ed04..c827c977a 100644 --- a/radio/src/targets/sky9x/usb/device/core/USBD_UDP.c +++ b/radio/src/targets/sky9x/usb/device/core/USBD_UDP.c @@ -41,7 +41,7 @@ // Headers //------------------------------------------------------------------------------ -#include "../../../board.h" +#include "board_lowlevel.h" #include "../../../usb/common/core/USBEndpointDescriptor.h" #include "../../../usb/common/core/USBGenericRequest.h" #include "../../../usb/device/core/USBD.h" diff --git a/radio/src/targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c b/radio/src/targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c index 181eacfe7..11b01d368 100644 --- a/radio/src/targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c +++ b/radio/src/targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c @@ -36,7 +36,7 @@ #include "../../../usb/common/core/USBStringDescriptor.h" #include "../../../usb/common/massstorage/MSDeviceDescriptor.h" #include "../../../usb/common/massstorage/MSInterfaceDescriptor.h" -#include "../../../board.h" +#include "board_lowlevel.h" #include "../../../usb/common/core/USBConfigurationDescriptor.h" #include "../../../usb/common/core/USBDeviceDescriptor.h" #include "../../../usb/common/core/USBEndpointDescriptor.h" diff --git a/radio/src/targets/taranis/CMakeLists.txt b/radio/src/targets/taranis/CMakeLists.txt index 31a27d399..48abab005 100644 --- a/radio/src/targets/taranis/CMakeLists.txt +++ b/radio/src/targets/taranis/CMakeLists.txt @@ -1,14 +1,15 @@ -option(PCBREV "PCB Revision" REVPLUS) option(SHUTDOWN_CONFIRMATION "Shutdown confirmation" OFF) option(LCD_DUAL_BUFFER "Dual LCD Buffer" OFF) option(TARANIS_INTERNAL_PPM "Taranis internal module hack to output PPM" OFF) -if(PCBREV STREQUAL REV9E) +add_definitions(-DUSB_NAME="FrSky Taranis") + +if(PCB STREQUAL X9E) option(STICKS "Sticks type" STANDARD) set(CPU_TYPE STM32F4) set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_taranis_x9e) - set(FLAVOUR taranisx9e) + set(FLAVOUR x9e) add_definitions(-DSTM32F40_41xxx -DREVPLUS -DREV9E) add_definitions(-DEEPROM_VARIANT=32768) set(FIRMWARE_TARGET_SRC @@ -20,36 +21,68 @@ if(PCBREV STREQUAL REV9E) if(STICKS STREQUAL HORUS) add_definitions(-DHORUS_STICKS) endif() -elseif(PCBREV STREQUAL REVPLUS) + set(GUI_DIR 212x64) + set(GUI_SRC ${GUI_SRC} bmp.cpp) + set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps) + set(VIRTUAL_INPUTS YES) +elseif(PCB STREQUAL X9D+) set(CPU_TYPE STM32F2) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_taranis) - set(FLAVOUR taranisplus) + set(FLAVOUR x9d+) add_definitions(-DREVPLUS) add_definitions(-DEEPROM_VARIANT=0) -else() + set(GUI_DIR 212x64) + set(GUI_SRC ${GUI_SRC} bmp.cpp) + set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps) + set(VIRTUAL_INPUTS YES) +elseif(PCB STREQUAL X9D) set(CPU_TYPE STM32F2) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC NO) set(LUA_EXPORT lua_export_taranis) - set(FLAVOUR taranis) + set(FLAVOUR x9d) add_definitions(-DEEPROM_VARIANT=0) + set(GUI_DIR 212x64) + set(GUI_SRC ${GUI_SRC} bmp.cpp) + set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps) + set(VIRTUAL_INPUTS YES) +elseif(PCB STREQUAL X7D) + set(CPU_TYPE STM32F2) + set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) + set(HAPTIC NO) + set(LUA_EXPORT lua_export_taranis) + set(FLAVOUR x7d) + add_definitions(-DPCBX7D) + add_definitions(-DEEPROM_VARIANT=0) + set(GUI_DIR 128x64) + set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) + set(VIRTUAL_INPUTS NO) endif() + set(HSE_VALUE 12000000) set(SDCARD YES) set(EEPROM EEPROM_RLC) -set(GUI_DIR taranis) set(TARGET_DIR taranis) -set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps) -set(VIRTUAL_INPUTS YES) add_definitions(-DPCBTARANIS -DPPM_PIN_TIMER) add_definitions(-DAUDIO -DVOICE -DRTCLOCK) add_definitions(-DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DVARIO) -set(GUI_SRC ${GUI_SRC} bmp.cpp menu_model_inputs.cpp menu_model_mixes.cpp menu_model_display.cpp menu_general_diagkeys.cpp menu_general_diaganas.cpp menu_general_hardware.cpp view_channels.cpp view_telemetry.cpp view_text.cpp view_about.cpp) +set(GUI_SRC ${GUI_SRC} + model_inputs.cpp + model_mixes.cpp + model_display.cpp + radio_diagkeys.cpp + radio_diaganas.cpp + radio_hardware.cpp + view_channels.cpp + view_telemetry.cpp + view_text.cpp + view_about.cpp + ) set(TARGET_SRC ${TARGET_SRC} - board_taranis.cpp + board.cpp extmodule_driver.cpp rtc_driver.cpp ) @@ -62,7 +95,6 @@ set(FIRMWARE_TARGET_SRC lcd_driver.cpp delays.c i2c_driver.cpp - usb_driver.c pwr_driver.c configure_pins.cpp flash_driver.cpp diff --git a/radio/src/targets/taranis/aspi.c b/radio/src/targets/taranis/aspi.c index dd481612c..17847da1c 100644 --- a/radio/src/targets/taranis/aspi.c +++ b/radio/src/targets/taranis/aspi.c @@ -1,24 +1,24 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "board_taranis.h" +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "board.h" /** **********send command to lcd************** diff --git a/radio/src/targets/taranis/board_taranis.cpp b/radio/src/targets/taranis/board.cpp similarity index 95% rename from radio/src/targets/taranis/board_taranis.cpp rename to radio/src/targets/taranis/board.cpp index e626a242e..3756f5f81 100644 --- a/radio/src/targets/taranis/board_taranis.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -117,11 +117,11 @@ extern "C" void INTERRUPT_5MS_IRQHandler() #define PWR_PRESS_DURATION_MAX 500 // 5s const pm_uchar bmp_startup[] PROGMEM = { - #include "../../bitmaps/taranis/startup.lbm" + #include "../../bitmaps/212x64/startup.lbm" }; const pm_uchar bmp_lock[] PROGMEM = { - #include "../../bitmaps/taranis/lock.lbm" + #include "../../bitmaps/212x64/lock.lbm" }; #endif diff --git a/radio/src/targets/taranis/board_taranis.h b/radio/src/targets/taranis/board.h similarity index 100% rename from radio/src/targets/taranis/board_taranis.h rename to radio/src/targets/taranis/board.h diff --git a/radio/src/targets/taranis/bootloader/CMakeLists.txt b/radio/src/targets/taranis/bootloader/CMakeLists.txt index 86af4bbcd..b0d6a39ad 100644 --- a/radio/src/targets/taranis/bootloader/CMakeLists.txt +++ b/radio/src/targets/taranis/bootloader/CMakeLists.txt @@ -2,10 +2,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -if(PCBREV STREQUAL REV9E) +if(PCB STREQUAL X9E) set(BOOTLOADER_SRC ${BOOTLOADER_SRC} - ../system_stm32f4xx.c + ../../common/arm/stm32/f4/system_stm32f4xx.c ../../../${STM32LIB_DIR}/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_stm32f40_41xxx.s ../../../${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c ../../../${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c @@ -16,7 +16,7 @@ if(PCBREV STREQUAL REV9E) else() set(BOOTLOADER_SRC ${BOOTLOADER_SRC} - ../system_stm32f2xx.c + ../../common/arm/stm32/f2/system_stm32f2xx.c ../../../${STM32LIB_DIR}/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s ../../../${STM32LIB_DIR}/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rcc.c ../../../${STM32LIB_DIR}/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c @@ -28,8 +28,8 @@ endif() set(BOOTLOADER_SRC ${BOOTLOADER_SRC} - ../../../gui/taranis/lcd.cpp - ../../../gui/taranis/fonts.cpp + ../../../gui/212x64/lcd.cpp + ../../../gui/212x64/fonts.cpp ../../../keys.cpp ../../../strhelpers.cpp ../../../${STM32USB_DIR}/STM32_USB_OTG_Driver/src/usb_core.c @@ -50,13 +50,13 @@ set(BOOTLOADER_SRC ../i2c_driver.cpp ../flash_driver.cpp ../diskio.cpp - ../usbd_usr.cpp + ../../common/arm/stm32/usbd_usr.cpp ../usbd_storage_msd.cpp ../delays.c - ../usbd_desc.c + ../../common/arm/stm32/usbd_desc.c ../aspi.c - ../usb_bsp.c - ../usb_driver.c + ../../common/arm/stm32/usb_bsp.c + ../../common/arm/stm32/usb_driver.c ../pwr_driver.c init.c boot.cpp diff --git a/radio/src/targets/taranis/bootloader/boot.cpp b/radio/src/targets/taranis/bootloader/boot.cpp index aa41f6538..9357e564e 100644 --- a/radio/src/targets/taranis/bootloader/boot.cpp +++ b/radio/src/targets/taranis/bootloader/boot.cpp @@ -53,8 +53,8 @@ #include #include -#include "../../../gui/taranis/lcd.h" -#include "../../taranis/board_taranis.h" +#include "../../../gui/212x64/lcd.h" +#include "board.h" #include "storage/eeprom_rlc.h" #include "pwr.h" #include "keys.h" diff --git a/radio/src/targets/taranis/delays.c b/radio/src/targets/taranis/delays.c index d83d3abbb..8efa61ca6 100644 --- a/radio/src/targets/taranis/delays.c +++ b/radio/src/targets/taranis/delays.c @@ -19,7 +19,7 @@ */ #include -#include "board_taranis.h" +#include "board.h" #if !defined(REV9E) #include "dwt.h" // the old ST library that we use does not define DWT register for STM32F2xx #endif diff --git a/radio/src/targets/taranis/i2c_driver.cpp b/radio/src/targets/taranis/i2c_driver.cpp index 3bf5f48f8..344859fda 100644 --- a/radio/src/targets/taranis/i2c_driver.cpp +++ b/radio/src/targets/taranis/i2c_driver.cpp @@ -18,7 +18,7 @@ * GNU General Public License for more details. */ -#include "board_taranis.h" +#include "board.h" void eepromPageWrite(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t NumByteToWrite); void eepromWaitEepromStandbyState(void); diff --git a/radio/src/targets/taranis/pwr_driver.c b/radio/src/targets/taranis/pwr_driver.c index 13d8400ee..31e2682c0 100644 --- a/radio/src/targets/taranis/pwr_driver.c +++ b/radio/src/targets/taranis/pwr_driver.c @@ -19,7 +19,7 @@ */ #include "pwr.h" -#include "board_taranis.h" +#include "board.h" void pwrInit() { diff --git a/radio/src/targets/taranis/system_stm32f4xx.c b/radio/src/targets/taranis/system_stm32f4xx.c deleted file mode 100644 index b816925b4..000000000 --- a/radio/src/targets/taranis/system_stm32f4xx.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/** @addtogroup CMSIS - * @{ - */ - -/** @addtogroup stm32f4xx_system - * @{ - */ - -/** @addtogroup STM32F4xx_System_Private_Includes - * @{ - */ - -#include "stm32f4xx.h" - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_Defines - * @{ - */ - -/************************* Miscellaneous Configuration ************************/ -/*!< Uncomment the following line if you need to use external SRAM mounted - on STM324xG_EVAL/STM324x7I_EVAL board as data memory */ -/* #define DATA_IN_ExtSRAM */ - -/*!< Uncomment the following line if you need to relocate your vector Table in - Internal SRAM. */ -/* #define VECT_TAB_SRAM */ -#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. - This value must be a multiple of 0x200. */ -/******************************************************************************/ - -/************************* PLL Parameters *************************************/ -/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ -#define PLL_M 12 -#define PLL_N 336 - -/* SYSCLK = PLL_VCO / PLL_P */ -#define PLL_P 2 - -/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ -#define PLL_Q 7 - -/******************************************************************************/ - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_Variables - * @{ - */ - - uint32_t SystemCoreClock = 168000000; - - __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes - * @{ - */ - -static void SetSysClock(void); -#ifdef DATA_IN_ExtSRAM - static void SystemInit_ExtMemCtl(void); -#endif /* DATA_IN_ExtSRAM */ - -/** - * @} - */ - -/** @addtogroup STM32F4xx_System_Private_Functions - * @{ - */ - -/** - * @brief Setup the microcontroller system - * Initialize the Embedded Flash Interface, the PLL and update the - * SystemFrequency variable. - * @param None - * @retval None - */ -void SystemInit(void) -{ - /* FPU settings ------------------------------------------------------------*/ - #if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */ - #endif - /* Reset the RCC clock configuration to the default reset state ------------*/ - /* Set HSION bit */ - RCC->CR |= (uint32_t)0x00000001; - - /* Reset CFGR register */ - RCC->CFGR = 0x00000000; - - /* Reset HSEON, CSSON and PLLON bits */ - RCC->CR &= (uint32_t)0xFEF6FFFF; - - /* Reset PLLCFGR register */ - RCC->PLLCFGR = 0x24003010; - - /* Reset HSEBYP bit */ - RCC->CR &= (uint32_t)0xFFFBFFFF; - - /* Disable all interrupts */ - RCC->CIR = 0x00000000; - -#ifdef DATA_IN_ExtSRAM - SystemInit_ExtMemCtl(); -#endif /* DATA_IN_ExtSRAM */ - - /* Configure the System clock source, PLL Multiplier and Divider factors, - AHB/APBx prescalers and Flash settings ----------------------------------*/ - SetSysClock(); - - /* Configure the Vector Table location add offset address ------------------*/ -#ifdef VECT_TAB_SRAM - SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ -#else - // SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ - extern uint32_t g_pfnVectors ; - SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */ -#endif -} - -/** - * @brief Update SystemCoreClock variable according to Clock Register Values. - * The SystemCoreClock variable contains the core clock (HCLK), it can - * be used by the user application to setup the SysTick timer or configure - * other parameters. - * - * @note Each time the core clock (HCLK) changes, this function must be called - * to update SystemCoreClock variable value. Otherwise, any configuration - * based on this variable will be incorrect. - * - * @note - The system frequency computed by this function is not the real - * frequency in the chip. It is calculated based on the predefined - * constant and the selected clock source: - * - * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) - * - * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) - * - * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) - * or HSI_VALUE(*) multiplied/divided by the PLL factors. - * - * (*) HSI_VALUE is a constant defined in stm32f4xx.h file (default value - * 16 MHz) but the real value may vary depending on the variations - * in voltage and temperature. - * - * (**) HSE_VALUE is a constant defined in stm32f4xx.h file (default value - * 25 MHz), user has to ensure that HSE_VALUE is same as the real - * frequency of the crystal used. Otherwise, this function may - * have wrong result. - * - * - The result of this function could be not correct when using fractional - * value for HSE crystal. - * - * @param None - * @retval None - */ -void SystemCoreClockUpdate(void) -{ - uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; - - /* Get SYSCLK source -------------------------------------------------------*/ - tmp = RCC->CFGR & RCC_CFGR_SWS; - - switch (tmp) - { - case 0x00: /* HSI used as system clock source */ - SystemCoreClock = HSI_VALUE; - break; - case 0x04: /* HSE used as system clock source */ - SystemCoreClock = HSE_VALUE; - break; - case 0x08: /* PLL used as system clock source */ - - /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N - SYSCLK = PLL_VCO / PLL_P - */ - pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; - pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; - - if (pllsource != 0) - { - /* HSE used as PLL clock source */ - pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); - } - else - { - /* HSI used as PLL clock source */ - pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); - } - - pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; - SystemCoreClock = pllvco/pllp; - break; - default: - SystemCoreClock = HSI_VALUE; - break; - } - /* Compute HCLK frequency --------------------------------------------------*/ - /* Get HCLK prescaler */ - tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; - /* HCLK frequency */ - SystemCoreClock >>= tmp; -} - -/** - * @brief Configures the System clock source, PLL Multiplier and Divider factors, - * AHB/APBx prescalers and Flash settings - * @Note This function should be called only once the RCC clock configuration - * is reset to the default reset state (done in SystemInit() function). - * @param None - * @retval None - */ -static void SetSysClock(void) -{ -/******************************************************************************/ -/* PLL (clocked by HSE) used as System clock source */ -/******************************************************************************/ - __IO uint32_t StartUpCounter = 0, HSEStatus = 0; - - /* Enable HSE */ - RCC->CR |= ((uint32_t)RCC_CR_HSEON); - - /* Wait till HSE is ready and if Time out is reached exit */ - do - { - HSEStatus = RCC->CR & RCC_CR_HSERDY; - StartUpCounter++; - } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); - - if ((RCC->CR & RCC_CR_HSERDY) != RESET) - { - HSEStatus = (uint32_t)0x01; - } - else - { - HSEStatus = (uint32_t)0x00; - } - - if (HSEStatus == (uint32_t)0x01) - { - /* Select regulator voltage output Scale 1 mode, System frequency up to 168 MHz */ - RCC->APB1ENR |= RCC_APB1ENR_PWREN; - PWR->CR |= PWR_CR_VOS; - - /* HCLK = SYSCLK / 1*/ - RCC->CFGR |= RCC_CFGR_HPRE_DIV1; - - /* PCLK2 = HCLK / 2*/ - RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; - - /* PCLK1 = HCLK / 4*/ - RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; - - /* Configure the main PLL */ - RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) | - (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24); - - /* Enable the main PLL */ - RCC->CR |= RCC_CR_PLLON; - - /* Wait till the main PLL is ready */ - while((RCC->CR & RCC_CR_PLLRDY) == 0) - { - } - - /* Configure Flash prefetch, Instruction cache, Data cache and wait state */ - FLASH->ACR = FLASH_ACR_PRFTEN |FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS; - - /* Select the main PLL as system clock source */ - RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); - RCC->CFGR |= RCC_CFGR_SW_PLL; - - /* Wait till the main PLL is used as system clock source */ - while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL); - { - } - } - else - { /* If HSE fails to start-up, the application will have wrong clock - configuration. User can add here some code to deal with this error */ - } - -} - -/** - * @brief Setup the external memory controller. Called in startup_stm32f4xx.s - * before jump to __main - * @param None - * @retval None - */ -#ifdef DATA_IN_ExtSRAM -/** - * @brief Setup the external memory controller. - * Called in startup_stm32f4xx.s before jump to main. - * This function configures the external SRAM mounted on STM324xG_EVAL/STM324x7I_EVAL board - * This SRAM will be used as program data memory (including heap and stack). - * @param None - * @retval None - */ -void SystemInit_ExtMemCtl(void) -{ -/*-- GPIOs Configuration -----------------------------------------------------*/ -/* - +-------------------+--------------------+------------------+------------------+ - + SRAM pins assignment + - +-------------------+--------------------+------------------+------------------+ - | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | - | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | - | PD4 <-> FSMC_NOE | PE2 <-> FSMC_A23 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | - | PD5 <-> FSMC_NWE | PE3 <-> FSMC_A19 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | - | PD8 <-> FSMC_D13 | PE4 <-> FSMC_A20 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | - | PD9 <-> FSMC_D14 | PE5 <-> FSMC_A21 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | - | PD10 <-> FSMC_D15 | PE6 <-> FSMC_A22 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | - | PD11 <-> FSMC_A16 | PE7 <-> FSMC_D4 | PF13 <-> FSMC_A7 |------------------+ - | PD12 <-> FSMC_A17 | PE8 <-> FSMC_D5 | PF14 <-> FSMC_A8 | - | PD13 <-> FSMC_A18 | PE9 <-> FSMC_D6 | PF15 <-> FSMC_A9 | - | PD14 <-> FSMC_D0 | PE10 <-> FSMC_D7 |------------------+ - | PD15 <-> FSMC_D1 | PE11 <-> FSMC_D8 | - +-------------------| PE12 <-> FSMC_D9 | - | PE13 <-> FSMC_D10 | - | PE14 <-> FSMC_D11 | - | PE15 <-> FSMC_D12 | - +--------------------+ -*/ - /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */ - RCC->AHB1ENR |= 0x00000078; - - /* Connect PDx pins to FSMC Alternate function */ - GPIOD->AFR[0] = 0x00cc00cc; - GPIOD->AFR[1] = 0xcccccccc; - /* Configure PDx pins in Alternate function mode */ - GPIOD->MODER = 0xaaaa0a0a; - /* Configure PDx pins speed to 100 MHz */ - GPIOD->OSPEEDR = 0xffff0f0f; - /* Configure PDx pins Output type to push-pull */ - GPIOD->OTYPER = 0x00000000; - /* No pull-up, pull-down for PDx pins */ - GPIOD->PUPDR = 0x00000000; - - /* Connect PEx pins to FSMC Alternate function */ - GPIOE->AFR[0] = 0xcccccccc; - GPIOE->AFR[1] = 0xcccccccc; - /* Configure PEx pins in Alternate function mode */ - GPIOE->MODER = 0xaaaaaaaa; - /* Configure PEx pins speed to 100 MHz */ - GPIOE->OSPEEDR = 0xffffffff; - /* Configure PEx pins Output type to push-pull */ - GPIOE->OTYPER = 0x00000000; - /* No pull-up, pull-down for PEx pins */ - GPIOE->PUPDR = 0x00000000; - - /* Connect PFx pins to FSMC Alternate function */ - GPIOF->AFR[0] = 0x00cccccc; - GPIOF->AFR[1] = 0xcccc0000; - /* Configure PFx pins in Alternate function mode */ - GPIOF->MODER = 0xaa000aaa; - /* Configure PFx pins speed to 100 MHz */ - GPIOF->OSPEEDR = 0xff000fff; - /* Configure PFx pins Output type to push-pull */ - GPIOF->OTYPER = 0x00000000; - /* No pull-up, pull-down for PFx pins */ - GPIOF->PUPDR = 0x00000000; - - /* Connect PGx pins to FSMC Alternate function */ - GPIOG->AFR[0] = 0x00cccccc; - GPIOG->AFR[1] = 0x000000c0; - /* Configure PGx pins in Alternate function mode */ - GPIOG->MODER = 0x00080aaa; - /* Configure PGx pins speed to 100 MHz */ - GPIOG->OSPEEDR = 0x000c0fff; - /* Configure PGx pins Output type to push-pull */ - GPIOG->OTYPER = 0x00000000; - /* No pull-up, pull-down for PGx pins */ - GPIOG->PUPDR = 0x00000000; - -/*-- FSMC Configuration ------------------------------------------------------*/ - /* Enable the FSMC interface clock */ - RCC->AHB3ENR |= 0x00000001; - - /* Configure and enable Bank1_SRAM2 */ - FSMC_Bank1->BTCR[2] = 0x00001011; - FSMC_Bank1->BTCR[3] = 0x00000201; - FSMC_Bank1E->BWTR[2] = 0x0fffffff; -/* - Bank1_SRAM2 is configured as follow: - - p.FSMC_AddressSetupTime = 1; - p.FSMC_AddressHoldTime = 0; - p.FSMC_DataSetupTime = 2; - p.FSMC_BusTurnAroundDuration = 0; - p.FSMC_CLKDivision = 0; - p.FSMC_DataLatency = 0; - p.FSMC_AccessMode = FSMC_AccessMode_A; - - FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2; - FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; - FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; -*/ -} -#endif /* DATA_IN_ExtSRAM */ - - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/radio/src/targets/taranis/usb_bsp.c b/radio/src/targets/taranis/usb_bsp.c deleted file mode 100644 index fb2bbf460..000000000 --- a/radio/src/targets/taranis/usb_bsp.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Includes ------------------------------------------------------------------*/ - -#include "usb_bsp.h" - -#include "board_taranis.h" -#include "usbd_conf.h" - -extern uint32_t SystemCoreClock; - -/** -* @brief USB_OTG_BSP_Init -* Initilizes BSP configurations -* @param None -* @retval None -*/ - -void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - RCC_AHB1PeriphClockCmd(USB_RCC_AHB1Periph_GPIO, ENABLE); - - /* Configure DM and DP Pins */ - GPIO_InitStructure.GPIO_Pin = USB_GPIO_PIN_DM | USB_GPIO_PIN_DP; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(USB_GPIO, &GPIO_InitStructure); - - GPIO_PinAFConfig(USB_GPIO, USB_GPIO_PinSource_DM, USB_GPIO_AF); - GPIO_PinAFConfig(USB_GPIO, USB_GPIO_PinSource_DP, USB_GPIO_AF); - - /* Configure VBUS Pin */ - GPIO_InitStructure.GPIO_Pin = USB_GPIO_PIN_VBUS; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; - GPIO_Init(USB_GPIO, &GPIO_InitStructure); - - RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); - RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ; -} - -void USB_OTG_BSP_Deinit(USB_OTG_CORE_HANDLE *pdev) -{ - //nothing to do -} - -/** -* @brief USB_OTG_BSP_EnableInterrupt -* Enable USB Global interrupt -* @param None -* @retval None -*/ -void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev) -{ - NVIC_SetPriority(OTG_FS_IRQn, 11); // Lower priority interrupt - NVIC_EnableIRQ(OTG_FS_IRQn); -} - -/** -* @brief USB_OTG_BSP_DisableInterrupt -* Disable USB Global interrupt -* @param None -* @retval None -*/ -void USB_OTG_BSP_DisableInterrupt(USB_OTG_CORE_HANDLE *pdev) -{ - NVIC_DisableIRQ(OTG_FS_IRQn); -} - - -/** -* @brief USB_OTG_BSP_uDelay -* This function provides delay time in micro sec -* @param usec : Value of delay required in micro sec -* @retval None -*/ -void USB_OTG_BSP_uDelay (const uint32_t usec) -{ - uint32_t count = 0; - const uint32_t utime = ((SystemCoreClock/1000000) * usec); - do - { - if ( ++count > utime ) - { - return ; - } - } - while (1); -} - - -/** -* @brief USB_OTG_BSP_mDelay -* This function provides delay time in milli sec -* @param msec : Value of delay required in milli sec -* @retval None -*/ -void USB_OTG_BSP_mDelay (const uint32_t msec) -{ - USB_OTG_BSP_uDelay(msec * 1000); -} - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/targets/taranis/usb_driver.c b/radio/src/targets/taranis/usb_driver.c deleted file mode 100644 index e6dcc4ad2..000000000 --- a/radio/src/targets/taranis/usb_driver.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include "board_taranis.h" -#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h" -#include "debug.h" - -int usbPlugged(void) -{ - // debounce - static uint8_t debounced_state = 0; - static uint8_t last_state = 0; - - if (GPIO_ReadInputDataBit(USB_GPIO, USB_GPIO_PIN_VBUS)) { - if (last_state) { - debounced_state = 1; - } - last_state = 1; - } - else { - if (!last_state) { - debounced_state = 0; - } - last_state = 0; - } - return debounced_state; -} - -USB_OTG_CORE_HANDLE USB_OTG_dev; - -void OTG_FS_IRQHandler(void) -{ - DEBUG_INTERRUPT(INT_OTG_FS); - USBD_OTG_ISR_Handler(&USB_OTG_dev); -} - -void usbInit(void) -{ -#if defined(USB_JOYSTICK) - // initialize USB as HID device - USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_cb, &USR_cb); -#elif defined(USB_SERIAL) - // initialize USB as CDC device (virtual serial port) - USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb); -#elif defined(USB_MASS_STORAGE) - // initialize USB as MSC device - USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb); -#endif -} - -void usbDeInit(void) -{ - USBD_DeInit(&USB_OTG_dev); -} diff --git a/radio/src/targets/taranis/usbd_cdc.cpp b/radio/src/targets/taranis/usbd_cdc.cpp deleted file mode 100644 index e19620577..000000000 --- a/radio/src/targets/taranis/usbd_cdc.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED -#pragma data_alignment = 4 -#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ - -#include "opentx.h" - -extern "C" { - -/* Includes ------------------------------------------------------------------*/ -#include "usb_conf.h" - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ - - -/* These are external variables imported from CDC core to be used for IN - transfer management. */ -extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer. - These data will be sent over USB IN endpoint - in the CDC core functions. */ -extern volatile uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to - start address when writing received data - in the buffer APP_Rx_Buffer. */ -extern volatile uint32_t APP_Rx_ptr_out; - -/* Private function prototypes -----------------------------------------------*/ -static uint16_t VCP_Init (void); -static uint16_t VCP_DeInit (void); -static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len); -static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len); - -// static uint16_t VCP_COMConfig(uint8_t Conf); - -CDC_IF_Prop_TypeDef VCP_fops = -{ - VCP_Init, - VCP_DeInit, - VCP_Ctrl, - 0, - VCP_DataRx -}; - -} // extern "C" - -bool cdcConnected = false; - -/* Private functions ---------------------------------------------------------*/ -/** - * @brief VCP_Init - * Initializes the Media on the STM32 - * @param None - * @retval Result of the opeartion (USBD_OK in all cases) - */ -static uint16_t VCP_Init(void) -{ - cdcConnected = true; - return USBD_OK; -} - -/** - * @brief VCP_DeInit - * DeInitializes the Media on the STM32 - * @param None - * @retval Result of the opeartion (USBD_OK in all cases) - */ -static uint16_t VCP_DeInit(void) -{ - cdcConnected = false; - return USBD_OK; -} - - -/** - * @brief VCP_Ctrl - * Manage the CDC class requests - * @param Cmd: Command code - * @param Buf: Buffer containing command data (request parameters) - * @param Len: Number of data to be sent (in bytes) - * @retval Result of the opeartion (USBD_OK in all cases) - */ -static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len) -{ - switch (Cmd) - { - case SEND_ENCAPSULATED_COMMAND: - /* Not needed for this driver */ - break; - - case GET_ENCAPSULATED_RESPONSE: - /* Not needed for this driver */ - break; - - case SET_COMM_FEATURE: - /* Not needed for this driver */ - break; - - case GET_COMM_FEATURE: - /* Not needed for this driver */ - break; - - case CLEAR_COMM_FEATURE: - /* Not needed for this driver */ - break; - - case SET_LINE_CODING: - /* Not needed for this driver */ - break; - - case GET_LINE_CODING: - /* Not needed for this driver */ - break; - - case SET_CONTROL_LINE_STATE: - /* Not needed for this driver */ - break; - - case SEND_BREAK: - /* Not needed for this driver */ - break; - - default: - break; - } - - return USBD_OK; -} - -// some debug vars -uint16_t usbWraps = 0; -uint16_t charsWritten = 0; - -void usbSerialPutc(uint8_t c) -{ - if (!cdcConnected) return; - - uint32_t txDataLen; - do { - txDataLen = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out; - if (txDataLen >= APP_RX_DATA_SIZE) { - txDataLen -= APP_RX_DATA_SIZE; - } - } while (txDataLen >= (APP_RX_DATA_SIZE - CDC_DATA_MAX_PACKET_SIZE)); - - APP_Rx_Buffer[APP_Rx_ptr_in] = c; - ++charsWritten; - /* To avoid buffer overflow */ - if (APP_Rx_ptr_in >= APP_RX_DATA_SIZE-1) { - APP_Rx_ptr_in = 0; - ++usbWraps; - } - else { - APP_Rx_ptr_in++; - } -} - -/** - * @brief VCP_DataRx - * Data received over USB OUT endpoint is available here - * - * @note - * This function will block any OUT packet reception on USB endpoint - * until exiting this function. If you exit this function before transfer - * is complete on CDC interface (ie. using DMA controller) it will result - * in receiving more data while previous ones are still not sent. - * - * @note - * This function is executed inside the USBD_OTG_ISR_Handler() interrupt handler! - - * @param Buf: Buffer of data to be received - * @param Len: Number of data received (in bytes) - * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL - */ -static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len) -{ - // TODO: try implementing inbound flow control: - // if the cliRxFifo does not have enough free space to receive all - // available characters, return VCP_FAIL. Maybe that will throttle down - // the sender and we will receive the same packet at a later time. - -#if defined(CLI) - //copy data to the application FIFO - for (uint32_t i = 0; i < Len; i++) - { - cliRxFifo.push(Buf[i]); - } -#endif - - return USBD_OK; -} - - - -// /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/targets/taranis/usbd_desc.h b/radio/src/targets/taranis/usbd_desc.h deleted file mode 100644 index 171102a8e..000000000 --- a/radio/src/targets/taranis/usbd_desc.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ - -#ifndef _USBD_DESC_H_ -#define _USBD_DESC_H_ - -/* Includes ------------------------------------------------------------------*/ -#include "usb_core.h" -#include "usbd_def.h" - -/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY - * @{ - */ - -/** @defgroup USB_DESC - * @brief general defines for the usb device library file - * @{ - */ - -/** @defgroup USB_DESC_Exported_Defines - * @{ - */ -#define USB_DEVICE_DESCRIPTOR_TYPE 0x01 -#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 -#define USB_STRING_DESCRIPTOR_TYPE 0x03 -#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 -#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 -#define USB_SIZ_DEVICE_DESC 18 -#define USB_SIZ_STRING_LANGID 4 - -/** - * @} - */ - - -/** @defgroup USBD_DESC_Exported_TypesDefinitions - * @{ - */ -/** - * @} - */ - - - -/** @defgroup USBD_DESC_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup USBD_DESC_Exported_Variables - * @{ - */ -extern const uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; -extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; -extern const uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; -extern const uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; -extern const uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; -extern const USBD_DEVICE USR_desc; -/** - * @} - */ - -/** @defgroup USBD_DESC_Exported_FunctionsPrototype - * @{ - */ - - -uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length); -uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length); - -#ifdef USB_SUPPORT_USER_STRING_DESC -uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length); -#endif /* USB_SUPPORT_USER_STRING_DESC */ - -/** - * @} - */ - -#endif // _USBD_DESC_H_ - -/** - * @} - */ - -/** -* @} -*/ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/targets/taranis/usbd_storage_msd.cpp b/radio/src/targets/taranis/usbd_storage_msd.cpp index c25eca72e..69e1e7428 100644 --- a/radio/src/targets/taranis/usbd_storage_msd.cpp +++ b/radio/src/targets/taranis/usbd_storage_msd.cpp @@ -21,7 +21,7 @@ /* Includes ------------------------------------------------------------------*/ #include "../../opentx.h" #include "../../thirdparty/FatFs/diskio.h" -#include "board_taranis.h" +#include "board.h" #if defined(__cplusplus) && !defined(SIMU) extern "C" { diff --git a/radio/src/targets/taranis/usbd_usr.cpp b/radio/src/targets/taranis/usbd_usr.cpp deleted file mode 100644 index f130b5545..000000000 --- a/radio/src/targets/taranis/usbd_usr.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* Includes ------------------------------------------------------------------*/ -#include "../../opentx.h" - -extern "C" { -#include "usbd_usr.h" - -/* Points to the DEVICE_PROP structure of current device */ -/* The purpose of this register is to speed up the execution */ - - -const USBD_Usr_cb_TypeDef USR_cb = -{ - USBD_USR_Init, - USBD_USR_DeviceReset, - USBD_USR_DeviceConfigured, - USBD_USR_DeviceSuspended, - USBD_USR_DeviceResumed, - - USBD_USR_DeviceConnected, - USBD_USR_DeviceDisconnected, -}; -} - -/** -* @brief Whatever the user application needs to do when USB is initialised -* @param None -* @retval None -*/ -void USBD_USR_Init(void) -{ - -} - -/** -* @brief Displays the message on LCD on device reset event -* @param speed : device speed -* @retval None -*/ -void USBD_USR_DeviceReset (uint8_t speed) -{ - -} - - -/** -* @brief Displays the message on LCD on device config event -* @param None -* @retval Staus -*/ -void USBD_USR_DeviceConfigured (void) -{ - -} -/** -* @brief Displays the message on LCD on device suspend event -* @param None -* @retval None -*/ -void USBD_USR_DeviceSuspended(void) -{ - -} - - -/** -* @brief Displays the message on LCD on device resume event -* @param None -* @retval None -*/ -void USBD_USR_DeviceResumed(void) -{ - -} - -/** -* @brief USBD_USR_DeviceConnected -* Displays the message on LCD on device connection Event -* @param None -* @retval Staus -*/ -void USBD_USR_DeviceConnected (void) -{ - -} - - -/** -* @brief USBD_USR_DeviceDisonnected -* Displays the message on LCD on device disconnection Event -* @param None -* @retval Staus -*/ -void USBD_USR_DeviceDisconnected (void) -{ -#if !defined(BOOT) && defined(USB_MASS_STORAGE) - NVIC_SystemReset(); -#endif -} - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/radio/src/templates.cpp b/radio/src/templates.cpp index 7fb91280c..9f2848cd5 100644 --- a/radio/src/templates.cpp +++ b/radio/src/templates.cpp @@ -40,8 +40,8 @@ #include "opentx.h" -#if defined(PCBTARANIS) - #pragma message("Templates with virtual inputs (FrSky Taranis) are not implemented!") +#if defined(VIRTUALINPUTS) + #pragma message("Templates with VIRTUALINPUTS enabled are not implemented!") #endif MixData* setDest(uint8_t dch, uint8_t src, bool clear=false) diff --git a/radio/src/tests/lcd.cpp b/radio/src/tests/lcd.cpp index 3a41496c0..9d637f62e 100644 --- a/radio/src/tests/lcd.cpp +++ b/radio/src/tests/lcd.cpp @@ -28,6 +28,7 @@ #define SWAP_DEFINED #include "opentx.h" #include "location.h" +#include "targets/simu/simulcd.h" void doPaint(QPainter & p) { diff --git a/radio/util/commit-tests.sh b/tools/commit-tests.sh similarity index 83% rename from radio/util/commit-tests.sh rename to tools/commit-tests.sh index 2ddd8738d..e3b3089dd 100755 --- a/radio/util/commit-tests.sh +++ b/tools/commit-tests.sh @@ -4,20 +4,13 @@ set -e set -x -cd $1 -SRCDIR=$(pwd) -cd - +SCRIPT=$(readlink -f "$0") +SRCDIR=$(dirname "$SCRIPT")/.. +COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt55" mkdir build || true cd build -COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt55" - -# Companion -rm -rf * -cmake ${COMMON_OPTIONS} ${SRCDIR} -make -j2 - # OpenTX on 9X stock with FrSky telemetry rm -rf * cmake ${COMMON_OPTIONS} -DPCB=9X -DHELI=YES -DEXT=FRSKY ${SRCDIR} @@ -60,21 +53,21 @@ make -j2 gtests ; ./gtests # OpenTX on Taranis rm -rf * -cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=X9D -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Taranis X9E rm -rf * -cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DPCBREV=REV9E -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=X9E -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Taranis Plus rm -rf * -cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DPCBREV=REVPLUS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=X9D+ -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests @@ -85,3 +78,8 @@ cmake ${COMMON_OPTIONS} -DPCB=HORUS -DHELI=NO -DUSB=SERIAL -DCLI=YES -DDEBUG=YES make -j2 firmware make -j2 simu # make -j2 gtests ; ./gtests + +# Companion +rm -rf * +cmake ${COMMON_OPTIONS} ${SRCDIR} +make -j2