Bsongis/gui refactoring for x7 d (#3701)
* [X7D] New board added * Cosmetics
This commit is contained in:
@@ -72,9 +72,9 @@ if(MULTIMODULE)
|
||||
add_definitions(-DMULTIMODULE)
|
||||
set(SRC ${SRC} pulses/multi_arm.cpp telemetry/spektrum.cpp)
|
||||
endif()
|
||||
add_definitions(-DCPUARM)
|
||||
add_definitions(-DCPUARM -DVIRTUAL_INPUTS)
|
||||
add_definitions(-DTELEMETRY_FRSKY -DTELEMETRY_FRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2)
|
||||
add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE)
|
||||
add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE -DGAUGES)
|
||||
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
|
||||
foreach(LANGUAGE ${TTS_LANGUAGES})
|
||||
set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp)
|
||||
@@ -104,8 +104,8 @@ set(TARGET_SRC
|
||||
adc_driver.cpp
|
||||
trainer_driver.cpp
|
||||
audio_driver.cpp
|
||||
serial2_driver.cpp
|
||||
telemetry_driver.cpp
|
||||
${SERIAL2_DRIVER}
|
||||
)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
|
||||
@@ -2,8 +2,7 @@ set(LUA "NO" CACHE STRING "Lua scripts (YES/NO/NO_MODEL_SCRIPTS)")
|
||||
set(USB "JOYSTICK" CACHE STRING "USB option (JOYSTICK/MASSSTORAGE/SERIAL)")
|
||||
set(ARCH ARM)
|
||||
set(STM32USB_DIR ${THIRDPARTY_DIR}/STM32_USB-Host-Device_Lib_V2.1.0/Libraries)
|
||||
add_definitions(-DCPUSTM32)
|
||||
add_definitions(-DSBUS -DCROSSFIRE)
|
||||
add_definitions(-DSTM32 -DLUA_INPUTS -DVARIO -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)
|
||||
@@ -20,6 +19,7 @@ set(STM32USB_SRC
|
||||
)
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/delays.cpp
|
||||
../common/arm/stm32/usb_bsp.c
|
||||
../common/arm/stm32/usbd_desc.c
|
||||
../common/arm/stm32/usbd_usr.cpp
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 <OsConfig.h>
|
||||
#include "board.h"
|
||||
#if defined(STM32F2)
|
||||
#include "dwt.h" // the old ST library that we use does not define DWT register for STM32F2xx
|
||||
#endif
|
||||
|
||||
#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)
|
||||
|
||||
void delaysInit(void)
|
||||
{
|
||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
DWT->CYCCNT = 0;
|
||||
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
||||
}
|
||||
|
||||
void delay_01us(uint16_t nb)
|
||||
{
|
||||
volatile uint32_t dwtStart = DWT->CYCCNT;
|
||||
volatile uint32_t dwtTotal = (SYSTEM_TICKS_01US * nb) - 10;
|
||||
while((DWT->CYCCNT - dwtStart) < dwtTotal);
|
||||
}
|
||||
|
||||
void delay_us(uint16_t nb)
|
||||
{
|
||||
volatile uint32_t dwtStart = DWT->CYCCNT;
|
||||
volatile uint32_t dwtTotal = (SYSTEM_TICKS_1US * nb) - 10;
|
||||
while((DWT->CYCCNT - dwtStart) < dwtTotal);
|
||||
}
|
||||
|
||||
void delay_ms(uint32_t ms)
|
||||
{
|
||||
while(ms--) {
|
||||
delay_us(1000);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ set(STM32LIB_DIR ${THIRDPARTY_DIR}/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries)
|
||||
include_directories(${STM32LIB_DIR}/STM32F2xx_StdPeriph_Driver/inc)
|
||||
include_directories(${STM32LIB_DIR}/CMSIS/Device/ST/STM32F2xx/Include)
|
||||
include_directories(${STM32LIB_DIR}/CMSIS/include)
|
||||
add_definitions(-DSTM32F2)
|
||||
set(STM32LIB_SRC
|
||||
${STM32LIB_SRC}
|
||||
CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*/
|
||||
|
||||
// ADC driver
|
||||
#define NUM_POTS 3
|
||||
#define NUM_SLIDERS 0
|
||||
#define NUM_XPOTS 0
|
||||
enum Analogs {
|
||||
STICK1,
|
||||
STICK2,
|
||||
@@ -45,6 +48,75 @@ void adcPrepareBandgap();
|
||||
void getADC();
|
||||
void getADC_bandgap();
|
||||
|
||||
// Keys driver
|
||||
#define NUM_SWITCHES 7
|
||||
enum EnumKeys
|
||||
{
|
||||
KEY_MENU,
|
||||
KEY_ENTER=KEY_MENU,
|
||||
KEY_EXIT,
|
||||
KEY_DOWN,
|
||||
KEY_UP,
|
||||
KEY_RIGHT,
|
||||
KEY_LEFT,
|
||||
|
||||
TRM_BASE,
|
||||
TRM_LH_DWN = TRM_BASE,
|
||||
TRM_LH_UP,
|
||||
TRM_LV_DWN,
|
||||
TRM_LV_UP,
|
||||
TRM_RV_DWN,
|
||||
TRM_RV_UP,
|
||||
TRM_RH_DWN,
|
||||
TRM_RH_UP,
|
||||
TRM_LAST = TRM_RH_UP,
|
||||
|
||||
#if ROTARY_ENCODERS > 0 || defined(ROTARY_ENCODER_NAVIGATION)
|
||||
BTN_REa,
|
||||
#endif
|
||||
#if ROTARY_ENCODERS > 0
|
||||
BTN_REb,
|
||||
#endif
|
||||
|
||||
NUM_KEYS
|
||||
};
|
||||
|
||||
enum EnumSwitches
|
||||
{
|
||||
SW_ID0,
|
||||
SW_ID1,
|
||||
SW_ID2,
|
||||
SW_THR,
|
||||
SW_RUD,
|
||||
SW_ELE,
|
||||
SW_AIL,
|
||||
SW_GEA,
|
||||
SW_TRN,
|
||||
};
|
||||
#define IS_3POS(sw) ((sw) == 0)
|
||||
#define IS_TOGGLE(sw) ((sw) == SWSRC_TRN)
|
||||
uint8_t keyState(uint8_t index);
|
||||
uint8_t switchState(uint8_t index);
|
||||
|
||||
// LCD driver
|
||||
#define LCD_W 128
|
||||
#define LCD_H 64
|
||||
#define LCD_DEPTH 1
|
||||
void lcdRefresh(void);
|
||||
#define lcdRefreshWait()
|
||||
void lcdSetRefVolt(unsigned char val);
|
||||
void lcdSetContrast(void);
|
||||
void lcdInit(void);
|
||||
#define lcdOff()
|
||||
|
||||
#if defined(LCD_KS108)
|
||||
void lcdRefreshSide();
|
||||
#endif
|
||||
|
||||
#if defined(LCD_ST7920)
|
||||
uint8_t lcdRefresh_ST7920(uint8_t full);
|
||||
#endif
|
||||
|
||||
// USART driver (static register dispatcher)
|
||||
#define RXD_DDR1 DDRD
|
||||
#define RXD_DDR_PIN1 DDD2
|
||||
|
||||
Reference in New Issue
Block a user