No more REV9E and REVPLUS

This commit is contained in:
Bertrand Songis
2016-07-29 14:44:59 +02:00
parent 0f740358f2
commit 51223a5864
60 changed files with 248 additions and 249 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ void OpenTxSimulator::wheelEvent(int steps)
rotencValue -= 2;
else
rotencValue += 2;
#elif defined(REV9E)
#elif defined(PCBX9E)
if (steps == 255)
rotencValue -= 2;
else
+3 -3
View File
@@ -140,7 +140,7 @@ void simuInit()
break;
#if defined(CPUARM)
#if defined(PCBTARANIS) && !defined(REV9E)
#if defined(PCBTARANIS) && !defined(PCBX9E)
#define SWITCH_CASE NEG_CASE
#else
#define SWITCH_CASE POS_CASE
@@ -247,7 +247,7 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
SWITCH_CASE(5, SWITCHES_GPIO_REG_F, SWITCHES_GPIO_PIN_F)
SWITCH_3_CASE(6, SWITCHES_GPIO_REG_G_L, SWITCHES_GPIO_REG_G_H, SWITCHES_GPIO_PIN_G_L, SWITCHES_GPIO_PIN_G_H)
SWITCH_CASE(7, SWITCHES_GPIO_REG_H, SWITCHES_GPIO_PIN_H)
#if defined(REV9E)
#if defined(PCBX9E)
SWITCH_3_CASE(8, SWITCHES_GPIO_REG_I_L, SWITCHES_GPIO_REG_I_H, SWITCHES_GPIO_PIN_I_L, SWITCHES_GPIO_PIN_I_H)
SWITCH_3_CASE(9, SWITCHES_GPIO_REG_J_L, SWITCHES_GPIO_REG_J_H, SWITCHES_GPIO_PIN_J_L, SWITCHES_GPIO_PIN_J_H)
SWITCH_3_CASE(10, SWITCHES_GPIO_REG_K_L, SWITCHES_GPIO_REG_K_H, SWITCHES_GPIO_PIN_K_L, SWITCHES_GPIO_PIN_K_H)
@@ -1385,7 +1385,7 @@ void unlockFlash() { }
void lockFlash() { }
void writeFlash(uint32_t *address, uint32_t *buffer) { SIMU_SLEEP(100); }
uint32_t isBootloaderStart(const void *block) { return 1; }
#if defined(REVPLUS)
#if defined(PCBX9DP) || defined(PCBX9E)
void turnBacklightOn(uint8_t level, uint8_t color)
{
TIM4->CCR4 = (100-level)*color;
+2 -2
View File
@@ -10,7 +10,7 @@ if(PCB STREQUAL X9E)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_taranis_x9e)
set(FLAVOUR x9e)
add_definitions(-DSTM32F40_41xxx -DREVPLUS -DREV9E)
add_definitions(-DSTM32F40_41xxx -DPCBX9E)
add_definitions(-DEEPROM_VARIANT=32768)
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
@@ -31,7 +31,7 @@ elseif(PCB STREQUAL X9D+)
set(HAPTIC YES)
set(LUA_EXPORT lua_export_taranis)
set(FLAVOUR x9d+)
add_definitions(-DREVPLUS)
add_definitions(-DPCBX9DP)
add_definitions(-DEEPROM_VARIANT=0)
set(GUI_DIR 212x64)
set(GUI_SRC ${GUI_SRC} bmp.cpp)
+12 -12
View File
@@ -29,11 +29,11 @@
#define SAMPTIME 2 // sample time = 28 cycles
#define SAMPTIME_LONG 3 // sample time = 56 cycles
#if defined(REV9E) && defined(HORUS_STICKS)
#if defined(PCBX9E) && defined(HORUS_STICKS)
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1};
#elif defined(REV9E)
#elif defined(PCBX9E)
const int8_t ana_direction[NUMBER_ANALOG] = {1,1,-1,-1, -1,-1,-1,1, -1,1,1,1, -1};
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,-1, -1,1, 1};
#elif defined(REV4a)
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,0, -1,1, 1};
@@ -41,7 +41,7 @@
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,0, -1,1, 1};
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define NUMBER_ANALOG_ADC1 10
#define NUMBER_ANALOG_ADC3 3
// mapping from adcValues order to enum Analogs
@@ -57,12 +57,12 @@ uint16_t adcValues[NUMBER_ANALOG] __DMA;
void adcInit()
{
#if defined(REV9E)
#if defined(PCBX9E)
configure_pins(ADC_GPIO_PIN_STICK_RV | ADC_GPIO_PIN_STICK_RH | ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_SLIDER3, PIN_ANALOG | PIN_PORTA);
configure_pins(ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_SLIDER4, PIN_ANALOG | PIN_PORTB);
configure_pins(ADC_GPIO_PIN_POT3 | ADC_GPIO_PIN_POT4 | ADC_GPIO_PIN_SLIDER1 | ADC_GPIO_PIN_SLIDER2 | ADC_GPIO_PIN_BATT, PIN_ANALOG | PIN_PORTC);
configure_pins(ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_SLIDER1 | ADC_GPIO_PIN_SLIDER2, PIN_ANALOG | PIN_PORTF);
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
configure_pins(ADC_GPIO_PIN_STICK_RV | ADC_GPIO_PIN_STICK_RH | ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_POT1, PIN_ANALOG | PIN_PORTA);
configure_pins(ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_POT3, PIN_ANALOG | PIN_PORTB);
configure_pins(ADC_GPIO_PIN_SLIDER1 | ADC_GPIO_PIN_SLIDER2 | ADC_GPIO_PIN_BATT, PIN_ANALOG | PIN_PORTC);
@@ -75,7 +75,7 @@ void adcInit()
ADC1->CR1 = ADC_CR1_SCAN;
ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_DMA | ADC_CR2_DDS;
ADC1->SQR1 = (NUMBER_ANALOG_ADC1-1) << 20; // bits 23:20 = number of conversions
#if defined(REV9E)
#if defined(PCBX9E)
ADC1->SQR2 = (ADC_CHANNEL_POT4<<0) + (ADC_CHANNEL_SLIDER3<<5) + (ADC_CHANNEL_SLIDER4<<10) + (ADC_CHANNEL_BATT<<15); // conversions 7 and more
ADC1->SQR3 = (ADC_CHANNEL_STICK_LH<<0) + (ADC_CHANNEL_STICK_LV<<5) + (ADC_CHANNEL_STICK_RV<<10) + (ADC_CHANNEL_STICK_RH<<15) + (ADC_CHANNEL_POT2<<20) + (ADC_CHANNEL_POT3<<25); // conversions 1 to 6
#else
@@ -93,7 +93,7 @@ void adcInit()
ADC1_DMA_Stream->NDTR = NUMBER_ANALOG_ADC1;
ADC1_DMA_Stream->FCR = DMA_SxFCR_DMDIS | DMA_SxFCR_FTH_0;
#if defined(REV9E)
#if defined(PCBX9E)
ADC3->CR1 = ADC_CR1_SCAN;
ADC3->CR2 = ADC_CR2_ADON | ADC_CR2_DMA | ADC_CR2_DDS;
ADC3->SQR1 = (NUMBER_ANALOG_ADC3-1) << 20; // NUMBER_ANALOG Channels
@@ -118,15 +118,15 @@ void adcSingleRead()
ADC1_DMA_Stream->CR |= DMA_SxCR_EN; // Enable DMA
ADC1->CR2 |= (uint32_t) ADC_CR2_SWSTART;
#if defined(REV9E)
#if defined(PCBX9E)
ADC3_DMA_Stream->CR &= ~DMA_SxCR_EN; // Disable DMA
ADC3->SR &= ~(uint32_t) ( ADC_SR_EOC | ADC_SR_STRT | ADC_SR_OVR );
ADC3_DMA->LIFCR = ADC3_DMA_FLAGS; // Write ones to clear bits
ADC3_DMA_Stream->CR |= DMA_SxCR_EN; // Enable DMA
ADC3->CR2 |= (uint32_t)ADC_CR2_SWSTART;
#endif // defined(REV9E)
#endif
#if defined(REV9E)
#if defined(PCBX9E)
for (unsigned int i=0; i<10000; i++) {
if ((ADC1_DMA->HISR & ADC1_DMA_FLAG_TC) && (ADC3_DMA->LISR & ADC3_DMA_FLAG_TC)) {
break;
@@ -180,7 +180,7 @@ uint16_t getAnalogValue(uint8_t index)
// which produces ghost readings on these inputs.
return 0;
}
#if defined(REV9E)
#if defined(PCBX9E)
index = ana_mapping[index];
#endif
if (ana_direction[index] < 0)
+1 -1
View File
@@ -39,7 +39,7 @@
return readValue;
}*/
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
void AspiCmd(uint8_t Command_Byte)
{
LCD_A0_LOW() ;
+1 -1
View File
@@ -122,7 +122,7 @@ extern "C" void AUDIO_TIM_IRQHandler()
{
DEBUG_INTERRUPT(INT_AUDIO);
DAC->CR &= ~DAC_CR_DMAEN1 ; // Stop DMA requests
#if !defined(REV9E)
#if !defined(PCBX9E)
DAC->CR &= ~DAC_CR_DMAUDRIE1 ; // Stop underrun interrupt
#endif
DAC->SR = DAC_SR_DMAUDR1 ; // Write 1 to clear flag
+10 -10
View File
@@ -98,7 +98,7 @@ void interrupt5ms()
per10ms();
}
#if defined(REV9E)
#if defined(PCBX9E)
checkRotaryEncoder();
#endif
}
@@ -112,16 +112,16 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
}
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define PWR_PRESS_DURATION_MIN 200 // 2s
#define PWR_PRESS_DURATION_MAX 500 // 5s
const pm_uchar bmp_startup[] PROGMEM = {
#include "../../bitmaps/212x64/startup.lbm"
#include "startup.lbm"
};
const pm_uchar bmp_lock[] PROGMEM = {
#include "../../bitmaps/212x64/lock.lbm"
#include "lock.lbm"
};
#endif
@@ -132,8 +132,8 @@ void boardInit()
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
#if !defined(REV9E)
// some REV9E boards need that the pwrInit() is moved a little bit later
#if !defined(PCBX9E)
// some X9E boards need that the pwrInit() is moved a little bit later
pwrInit();
#endif
@@ -152,7 +152,7 @@ void boardInit()
hapticInit();
#endif
#if defined(REV9E)
#if defined(PCBX9E)
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
#endif
@@ -160,7 +160,7 @@ void boardInit()
DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE);
#endif
#if defined(REV9E)
#if defined(PCBX9E)
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
lcdClear();
lcdDrawBitmap(76, 2, bmp_lock, 0, 60);
@@ -210,11 +210,11 @@ void boardInit()
void boardOff()
{
BACKLIGHT_OFF();
#if defined(REV9E)
#if defined(PCBX9E)
toplcdOff();
#endif
#if defined(REV9E)
#if defined(PCBX9E)
while (pwrPressed()) {
wdt_reset();
}
+10 -10
View File
@@ -27,7 +27,7 @@
extern "C" {
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h"
#include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rcc.h"
#include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_gpio.h"
@@ -80,7 +80,7 @@ extern "C" {
#define BOOTLOADER_SIZE 0x8000
#define FIRMWARE_ADDRESS 0x08000000
#if defined(REV9E)
#if defined(PCBX9E)
#define PERI1_FREQUENCY 42000000
#define PERI2_FREQUENCY 84000000
#else
@@ -130,7 +130,7 @@ extern uint16_t sessionTimer;
#define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE)
#if defined(REV9E)
#if defined(PCBX9E)
#define TRAINER_CONNECTED() (true)
#else
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_GPIO_DETECT, TRAINER_GPIO_PIN_DETECT) == Bit_RESET)
@@ -224,7 +224,7 @@ uint32_t readTrims(void);
#define TRIMS_PRESSED() (readTrims())
#define KEYS_PRESSED() (readKeys())
#if defined(REV9E)
#if defined(PCBX9E)
// Rotary Encoder driver
extern int32_t rotencValue;
void rotencInit(void);
@@ -255,7 +255,7 @@ enum Analogs {
POT1,
POT2,
POT3,
#if defined(REV9E)
#if defined(PCBX9E)
POT4,
POT_LAST = POT4,
#else
@@ -263,7 +263,7 @@ enum Analogs {
#endif
SLIDER1,
SLIDER2,
#if defined(REV9E)
#if defined(PCBX9E)
SLIDER3,
SLIDER4,
#endif
@@ -287,7 +287,7 @@ void pwrInit(void);
uint32_t pwrCheck(void);
void pwrOn(void);
void pwrOff(void);
#if defined(REV9E)
#if defined(PCBX9E)
uint32_t pwrPressed(void);
uint32_t pwrPressedDuration(void);
#define pwroffPressed() pwrPressed()
@@ -298,7 +298,7 @@ uint32_t pwroffPressed(void);
// Backlight driver
void backlightInit(void);
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
void turnBacklightOn(uint8_t level, uint8_t color);
void turnBacklightOff(void);
#define setBacklight(xx) turnBacklightOn(xx, g_eeGeneral.backlightColor)
@@ -353,7 +353,7 @@ int32_t getVolume(void);
// Haptic driver
void hapticInit(void);
void hapticOff(void);
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
void hapticOn(uint32_t pwmPercent);
#else
void hapticOn(void);
@@ -384,7 +384,7 @@ void lcdInitFinish(void);
void lcdOff(void);
// Top LCD driver
#if defined(REV9E)
#if defined(PCBX9E)
void toplcdInit(void);
void toplcdOff(void);
void toplcdRefreshStart(void);
@@ -67,7 +67,7 @@
#if defined(PCBTARANIS)
#define BOOTLOADER_TITLE " Taranis BootLoader - " VERSION
#if defined(REV9E)
#if defined(PCBX9E)
#define BOOT_KEY_UP KEY_MINUS
#define BOOT_KEY_DOWN KEY_PLUS
#else
@@ -155,7 +155,7 @@ extern void init_spi(void);
extern void writeBlock(void);
extern void usbPluggedIn();
#if defined(REV9E)
#if defined(PCBX9E)
typedef int32_t rotenc_t;
extern rotenc_t rotencValue;
#endif
@@ -172,7 +172,7 @@ void interrupt10ms(void)
++enuk;
}
#if defined(REV9E)
#if defined(PCBX9E)
checkRotaryEncoder();
static rotenc_t rePreviousValue;
rotenc_t reNewValue = (rotencValue / 2);
@@ -672,7 +672,7 @@ int main()
}
if (state != ST_FLASHING && state != ST_USB) {
#if defined(REV9E)
#if defined(PCBX9E)
if (pwrPressed()) {
#else
if (pwrCheck() == e_power_off) {
+1 -2
View File
@@ -20,11 +20,10 @@
#include <OsConfig.h>
#include "board.h"
#if !defined(REV9E)
#if !defined(PCBX9E)
#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)
+1 -1
View File
@@ -127,7 +127,7 @@ uint32_t isFirmwareStart(const void * buffer)
{
const uint32_t * block = (const uint32_t *)buffer;
#if defined(REV9E)
#if defined(PCBX9E)
if ((block[0] & 0xFFFC0000) != 0x10000000 && (block[0] & 0xFFFC0000) != 0x20000000) {
return 0;
}
+26 -26
View File
@@ -28,7 +28,7 @@
#define KEYS_GPIO_PIN_EXIT GPIO_Pin_2 // PD.02
#define KEYS_GPIO_REG_PAGE GPIOD->IDR
#define KEYS_GPIO_PIN_PAGE GPIO_Pin_3 // PD.03
#if defined(REV9E)
#if defined(PCBX9E)
#if defined(SIMU)
#define KEYS_GPIO_REG_PLUS GPIOE->IDR
#define KEYS_GPIO_PIN_PLUS GPIO_Pin_5 // This is for SIMU: reuse rotary encoder pins to map UP and DOWN keyboard keys
@@ -52,7 +52,7 @@
#define ENC_GPIO_PIN_B GPIO_Pin_13 // PD.13
// Trims
#if defined(REV9E)
#if defined(PCBX9E)
#define TRIMS_GPIO_REG_LHL GPIOG->IDR
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_1 // PG.01
#define TRIMS_GPIO_REG_LHR GPIOG->IDR
@@ -89,7 +89,7 @@
#endif
// Switches
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_A_H GPIOD->IDR
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_10 // PD.10
#define SWITCHES_GPIO_REG_A_L GPIOD->IDR
@@ -101,7 +101,7 @@
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_0 // PE.00
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_B_H GPIOG->IDR
#define SWITCHES_GPIO_PIN_B_H GPIO_Pin_11 // PG.11
#define SWITCHES_GPIO_REG_B_L GPIOG->IDR
@@ -113,7 +113,7 @@
#define SWITCHES_GPIO_PIN_B_L GPIO_Pin_2 // PE.02
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_C_H GPIOF->IDR
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_13 // PF.13
#define SWITCHES_GPIO_REG_C_L GPIOF->IDR
@@ -125,12 +125,12 @@
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_5 // PA.05
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_D_H GPIOE->IDR
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_1 // PE.01
#define SWITCHES_GPIO_REG_D_L GPIOE->IDR
#define SWITCHES_GPIO_PIN_D_L GPIO_Pin_2 // PE.02
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
#define SWITCHES_GPIO_REG_D_H GPIOE->IDR
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PE.07
#define SWITCHES_GPIO_REG_D_L GPIOE->IDR
@@ -142,7 +142,7 @@
#define SWITCHES_GPIO_PIN_D_L GPIO_Pin_1 // PB.01
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_E_H GPIOE->IDR
#define SWITCHES_GPIO_PIN_E_H GPIO_Pin_7 // PE.07
#define SWITCHES_GPIO_REG_E_L GPIOE->IDR
@@ -154,7 +154,7 @@
#define SWITCHES_GPIO_PIN_E_L GPIO_Pin_4 // PB.04
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_F GPIOE->IDR
#define SWITCHES_GPIO_PIN_F GPIO_Pin_11 // PE.11
#else
@@ -162,7 +162,7 @@
#define SWITCHES_GPIO_PIN_F GPIO_Pin_14 // PE.14
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_G_H GPIOF->IDR
#define SWITCHES_GPIO_PIN_G_H GPIO_Pin_3 // PF.03
#define SWITCHES_GPIO_REG_G_L GPIOF->IDR
@@ -174,10 +174,10 @@
#define SWITCHES_GPIO_PIN_G_L GPIO_Pin_8 // PE.08
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_H GPIOF->IDR
#define SWITCHES_GPIO_PIN_H GPIO_Pin_1 // PF.01
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
#define SWITCHES_GPIO_REG_H GPIOD->IDR
#define SWITCHES_GPIO_PIN_H GPIO_Pin_14 // PD.14
#else
@@ -185,7 +185,7 @@
#define SWITCHES_GPIO_PIN_H GPIO_Pin_13 // PE.13
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define SWITCHES_GPIO_REG_I_H GPIOF->IDR
#define SWITCHES_GPIO_PIN_I_H GPIO_Pin_15 // PF.15
#define SWITCHES_GPIO_REG_I_L GPIOE->IDR
@@ -228,7 +228,7 @@
#define SWITCHES_GPIO_PIN_R_L GPIO_Pin_0 // PE.00
#endif
#if defined(REV9E)
#if defined(PCBX9E)
#define KEYS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF|RCC_AHB1Periph_GPIOG)
#define KEYS_GPIOA_PINS (SWITCHES_GPIO_PIN_M_L)
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_N_H | SWITCHES_GPIO_PIN_N_L | SWITCHES_GPIO_PIN_R_H)
@@ -237,7 +237,7 @@
#define KEYS_GPIOE_PINS (TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_LVD | SWITCHES_GPIO_PIN_D_H | SWITCHES_GPIO_PIN_D_L| SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_E_L | SWITCHES_GPIO_PIN_F | SWITCHES_GPIO_PIN_I_L | SWITCHES_GPIO_PIN_L_H | SWITCHES_GPIO_PIN_L_L | SWITCHES_GPIO_PIN_M_H | SWITCHES_GPIO_PIN_O_L | SWITCHES_GPIO_PIN_R_L)
#define KEYS_GPIOF_PINS (KEYS_GPIO_PIN_ENTER | SWITCHES_GPIO_PIN_C_H | SWITCHES_GPIO_PIN_C_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | SWITCHES_GPIO_PIN_I_H | SWITCHES_GPIO_PIN_O_H | SWITCHES_GPIO_PIN_P_H | SWITCHES_GPIO_PIN_P_L | SWITCHES_GPIO_PIN_Q_H | SWITCHES_GPIO_PIN_Q_L)
#define KEYS_GPIOG_PINS (TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR| SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_J_H | SWITCHES_GPIO_PIN_J_L | SWITCHES_GPIO_PIN_K_H | SWITCHES_GPIO_PIN_K_L)
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
#define KEYS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE)
#define KEYS_GPIOA_PINS (SWITCHES_GPIO_PIN_C_L)
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_E_L | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_A_H)
@@ -254,7 +254,7 @@
#endif
// ADC
#if defined(REV9E)
#if defined(PCBX9E)
#define ADC_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_DMA2)
#define ADC_RCC_APB2Periph (RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC3)
#else
@@ -273,7 +273,7 @@
#define ADC1_DMA_Stream DMA2_Stream4
#define ADC1_DMA_FLAGS (DMA_HIFCR_CTCIF4 | DMA_HIFCR_CHTIF4 | DMA_HIFCR_CTEIF4 | DMA_HIFCR_CDMEIF4 | DMA_HIFCR_CFEIF4)
#define ADC1_DMA_FLAG_TC DMA_HISR_TCIF4
#if defined(REV9E)
#if defined(PCBX9E)
#define ADC_GPIO_PIN_POT1 GPIO_Pin_8 // PF.08
#define ADC_GPIO_PIN_POT2 GPIO_Pin_0 // PB.00
#define ADC_GPIO_PIN_POT3 GPIO_Pin_5 // PC.05
@@ -296,7 +296,7 @@
#define ADC3_DMA_Stream DMA2_Stream0
#define ADC3_DMA_FLAGS (DMA_LIFCR_CTCIF0 | DMA_LIFCR_CHTIF0 | DMA_LIFCR_CTEIF0 | DMA_LIFCR_CDMEIF0 | DMA_LIFCR_CFEIF0)
#define ADC3_DMA_FLAG_TC DMA_LISR_TCIF0
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
#define ADC_GPIO_PIN_POT1 GPIO_Pin_6 // PA.06
#define ADC_GPIO_PIN_POT2 GPIO_Pin_0 // PB.00
#define ADC_GPIO_PIN_POT3 GPIO_Pin_1 // PB.01
@@ -332,7 +332,7 @@
// Internal Module
#define INTMODULE_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA2)
#define INTMODULE_RCC_APB2Periph RCC_APB2Periph_TIM1
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
#define INTMODULE_PWR_GPIO GPIOC
#define INTMODULE_PWR_GPIO_PIN GPIO_Pin_6 // PC.06
#else
@@ -453,7 +453,7 @@
#define USB_GPIO_AF GPIO_AF_OTG1_FS
// BackLight
#if defined(REV9E)
#if defined(PCBX9E)
#define BACKLIGHT_RCC_AHB1Periph RCC_AHB1Periph_GPIOE
#define BACKLIGHT_RCC_APB1Periph 0
#define BACKLIGHT_RCC_APB2Periph RCC_APB2Periph_TIM9
@@ -465,7 +465,7 @@
#define BACKLIGHT_GPIO_PinSource_2 GPIO_PinSource5
#define BACKLIGHT_GPIO_AF_1 GPIO_AF_TIM9
#define BACKLIGHT_GPIO_AF_2 GPIO_AF_TIM9
#elif defined (REVPLUS)
#elif defined (PCBX9DP)
#define BACKLIGHT_RCC_AHB1Periph RCC_AHB1Periph_GPIOD
#define BACKLIGHT_RCC_APB1Periph RCC_APB1Periph_TIM4
#define BACKLIGHT_RCC_APB2Periph 0
@@ -489,7 +489,7 @@
#endif
// LCD
#if defined(REV9E)
#if defined(PCBX9E)
#define LCD_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA1)
#define LCD_RCC_APB1Periph RCC_APB1Periph_SPI3
#define LCD_GPIO_SPI GPIOC
@@ -507,7 +507,7 @@
#define LCD_DMA_FLAGS (DMA_HIFCR_CTCIF7 | DMA_HIFCR_CHTIF7 | DMA_HIFCR_CTEIF7 | DMA_HIFCR_CDMEIF7 | DMA_HIFCR_CFEIF7)
#define LCD_DMA_FLAG_INT DMA_HIFCR_CTCIF7
#define LCD_SPI SPI3
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
#define LCD_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA1)
#define LCD_RCC_APB1Periph RCC_APB1Periph_SPI3
#define LCD_GPIO_SPI GPIOC
@@ -597,7 +597,7 @@
#define AUDIO_DMA DMA1
// Haptic
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
#define HAPTIC_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
#define HAPTIC_RCC_APB2Periph RCC_APB2Periph_TIM10
#define HAPTIC_GPIO_PinSource GPIO_PinSource8
@@ -613,7 +613,7 @@
#endif
// Top LCD on X9E
#if defined(REV9E)
#if defined(PCBX9E)
#define TOPLCD_RCC_AHB1Periph RCC_AHB1Periph_GPIOG
#define TOPLCD_GPIO GPIOG
#define TOPLCD_GPIO_PIN_DATA GPIO_Pin_5
@@ -624,7 +624,7 @@
#endif
// Bluetooth on X9E
#if defined(REV9E)
#if defined(PCBX9E)
#define BT_USART USART6
#define BT_GPIO_AF GPIO_AF_USART6
#define BT_USART_IRQn USART6_IRQn
+3 -3
View File
@@ -18,9 +18,9 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
void hapticOff(void)
{
HAPTIC_TIMER->CCR1 = 0;
@@ -58,7 +58,7 @@ void hapticInit(void)
#else
// No PWM before REVPLUS
// No PWM before X9D+
void hapticInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
+5 -5
View File
@@ -33,7 +33,7 @@ uint32_t readKeys()
if (~KEYS_GPIO_REG_EXIT & KEYS_GPIO_PIN_EXIT)
result |= 1 << KEY_EXIT;
#if !defined(REV9E) || defined(SIMU)
#if !defined(PCBX9E) || defined(SIMU)
if (~KEYS_GPIO_REG_PLUS & KEYS_GPIO_PIN_PLUS)
result |= 1 << KEY_PLUS;
if (~KEYS_GPIO_REG_MINUS & KEYS_GPIO_PIN_MINUS)
@@ -81,7 +81,7 @@ uint8_t keyDown()
return readKeys();
}
#if defined(REV9E)
#if defined(PCBX9E)
uint32_t Rotary_position;
rotenc_t rotencValue;
void checkRotaryEncoder()
@@ -116,7 +116,7 @@ void readKeysAndTrims()
keys[enuk++].input(in & i);
}
#if defined(REV9E) && !defined(SIMU)
#if defined(PCBX9E) && !defined(SIMU)
#define X9E_RE_TIMEOUT 5
static rotenc_t rePreviousValue;
rotenc_t reNewValue = (rotencValue / 2);
@@ -157,7 +157,7 @@ void readKeysAndTrims()
}
}
#if defined(REV9E)
#if defined(PCBX9E)
#define ADD_2POS_CASE(x) \
case SW_S ## x ## 2: \
xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \
@@ -217,7 +217,7 @@ bool switchState(EnumKeys enuk)
ADD_2POS_CASE(F);
ADD_3POS_CASE(G, 6);
ADD_2POS_CASE(H);
#if defined(REV9E)
#if defined(PCBX9E)
ADD_3POS_CASE(I, 8);
ADD_3POS_CASE(J, 9);
ADD_3POS_CASE(K, 10);
+10 -10
View File
@@ -18,12 +18,12 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
#define WriteData(x) AspiData(x)
#define WriteCommand(x) AspiCmd(x)
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
#define CONTRAST_OFS 160
#define RESET_WAIT_DELAY_MS 300 //wait time after LCD reset before first command
#define WAIT_FOR_DMA_END() { while(lcd_busy) {}; }
@@ -36,7 +36,7 @@
bool lcdInitFinished = false;
void lcdInitFinish();
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
// New hardware SPI driver for LCD
void initLcdSpi()
@@ -155,7 +155,7 @@ void Set_Address(u8 x, u8 y)
LCD_CLK_HIGH(); \
LCD_CLK_HIGH();
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
volatile bool lcd_busy;
@@ -213,7 +213,7 @@ extern "C" void LCD_DMA_Stream_IRQHandler()
lcd_busy = false;
}
#else // #if defined(REVPLUS)
#else // #if defined(PCBX9E) || defined(PCBX9DP)
void lcdRefresh()
{
if (!lcdInitFinished) {
@@ -252,7 +252,7 @@ void backlightInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
#if defined(REV9E)
#if defined(PCBX9E)
GPIO_InitStructure.GPIO_Pin = BACKLIGHT_GPIO_PIN_1|BACKLIGHT_GPIO_PIN_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
@@ -269,7 +269,7 @@ void backlightInit()
BACKLIGHT_TIMER->CCR1 = 100 ;
BACKLIGHT_TIMER->EGR = 0 ;
BACKLIGHT_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
GPIO_InitStructure.GPIO_Pin = BACKLIGHT_GPIO_PIN_1|BACKLIGHT_GPIO_PIN_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
@@ -376,7 +376,7 @@ void lcdInitFinish()
{
lcdInitFinished = true;
#if defined(REVPLUS)
#if defined(PCBX9E) || defined(PCBX9DP)
initLcdSpi();
#endif
@@ -420,7 +420,7 @@ void lcdSetRefVolt(uint8_t val)
AspiCmd(val+CONTRAST_OFS); //0--255
}
#if defined(REV9E)
#if defined(PCBX9E)
void turnBacklightOn(uint8_t level, uint8_t color)
{
BACKLIGHT_TIMER->CCR1 = ((100-level)*(20-color))/20;
@@ -432,7 +432,7 @@ void turnBacklightOff(void)
BACKLIGHT_TIMER->CCR1 = 0;
BACKLIGHT_TIMER->CCR2 = 0;
}
#elif defined(REVPLUS)
#elif defined(PCBX9DP)
void turnBacklightOn(uint8_t level, uint8_t color)
{
BACKLIGHT_TIMER->CCR4 = ((100-level)*(20-color))/20;
+3 -3
View File
@@ -70,7 +70,7 @@ void pwrOff()
while(1) {
wdt_reset();
#if defined(REV9E)
#if defined(PCBX9E)
// 9E needs watchdog reset because CPU is still running while
// the power key is held pressed by the user.
// The power key should be released by now, but we must make sure
@@ -90,7 +90,7 @@ void pwrOff()
// this function must not return!
}
#if defined(REV9E)
#if defined(PCBX9E)
uint32_t pwrPressed()
{
return GPIO_ReadInputDataBit(PWR_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET;
@@ -102,7 +102,7 @@ uint32_t pwroffPressed()
}
#endif
#if !defined(REV9E)
#if !defined(PCBX9E)
uint32_t pwrCheck()
{
if (!pwroffPressed())