From 0be7d4a67148a2b400abc56271468d2bb09026ae Mon Sep 17 00:00:00 2001 From: bsongis Date: Tue, 3 Apr 2012 18:01:05 +0000 Subject: [PATCH] Rotary encoders Beep Center should be ok now More port from ersky9x Problem in Telemetry labels for french and swedish --- src/board_ersky9x.cpp | 209 +++++++++++++++++++++-------------------- src/board_gruvin9x.cpp | 6 +- src/eeprom_arm.cpp | 6 +- src/lcd.cpp | 5 +- src/model_menus.cpp | 14 +-- src/myeeprom.h | 8 +- src/open9x.cpp | 21 +++-- src/open9x.h | 9 +- src/pulses_arm.cpp | 9 +- src/simu.cpp | 2 +- src/translations/en.h | 4 + src/translations/fr.h | 7 +- src/translations/se.h | 6 +- 13 files changed, 162 insertions(+), 144 deletions(-) diff --git a/src/board_ersky9x.cpp b/src/board_ersky9x.cpp index 56fe049df..803f787a9 100644 --- a/src/board_ersky9x.cpp +++ b/src/board_ersky9x.cpp @@ -63,38 +63,14 @@ volatile uint32_t Tenms ; #ifdef REVB inline void init_soft_power() { - register Pio *pioptr = PIOC ; // Configure RF_power (PC17) - pioptr->PIO_PER = PIO_PC17 ; // Enable bit C17 - pioptr->PIO_ODR = PIO_PC17 ; // Set bit C17 as input - pioptr->PIO_PUDR = PIO_PC17; // Disable pullup on bit C17 - pioptr->PIO_PPDER = PIO_PC17; // Enable pulldown on bit C17 - - pioptr = PIOA ; - pioptr->PIO_PER = PIO_PA8 ; // Enable bit A8 (Soft Power) - pioptr->PIO_ODR = PIO_PA8 ; // Set bit A8 as input - pioptr->PIO_PUER = PIO_PA8 ; // Enable PA8 pullup -} - -// Returns non-zero if power is switched off -uint32_t check_soft_power() -{ - if ( PIOC->PIO_PDSR & PIO_PC17 ) // Power on - { - return 1 ; - } - - if ( PIOA->PIO_PDSR & PIO_PA8 ) // Trainer plugged in - { - return 1 ; - } - - return 0 ; + configure_pins( PIO_PC17, PIN_ENABLE | PIN_INPUT | PIN_PORTC | PIN_NO_PULLUP | PIN_PULLDOWN ) ; + configure_pins( PIO_PA8, PIN_ENABLE | PIN_INPUT | PIN_PORTA | PIN_PULLUP ) ; // Enable bit A8 (Soft Power) } #endif -uint32_t check_power() +uint32_t check_soft_power() { if ( PIOC->PIO_PDSR & 0x02000000 ) { @@ -102,25 +78,25 @@ uint32_t check_power() } #ifdef REVB - if ( check_soft_power() == 0 ) // power now off + if ( PIOC->PIO_PDSR & PIO_PC17 ) // Power on { - return e_power_off ; + return e_power_on ; + } + + if ( PIOA->PIO_PDSR & PIO_PA8 ) // Trainer plugged in + { + return e_power_trainer ; } #endif - return e_power_on; + return e_power_off; } // turn off soft power void soft_power_off() { #ifdef REVB - register Pio *pioptr ; - - pioptr = PIOA ; - pioptr->PIO_PUDR = PIO_PA8 ; // Disble PA8 pullup - pioptr->PIO_OER = PIO_PA8 ; // Set bit A8 as input - pioptr->PIO_CODR = PIO_PA8 ; // Set bit A8 OFF, disables soft power switch + configure_pins( PIO_PA8, PIN_ENABLE | PIN_OUTPUT | PIN_LOW | PIN_PORTA | PIN_NO_PULLUP ) ; #endif } @@ -136,20 +112,11 @@ extern "C" void sam_boot( void ) ; // PC21, PC19, PC15 (PPM2 output) inline void config_free_pins() { - register Pio *pioptr ; - #ifdef REVB - pioptr = PIOB ; - pioptr->PIO_PER = 0x00004040L ; // Enable bits B14, 6 - pioptr->PIO_ODR = 0x00004040L ; // Set as input - pioptr->PIO_PUER = 0x00004040L ; // Enable pullups - - pioptr = PIOC ; - pioptr->PIO_PER = 0x00280000L ; // Enable bits C21, 19 - pioptr->PIO_ODR = 0x00280000L ; // Set as input - pioptr->PIO_PUER = 0x00280000L ; // Enable pullups + configure_pins( PIO_PB6 | PIO_PB14, PIN_ENABLE | PIN_INPUT | PIN_PORTB | PIN_PULLUP ) ; + configure_pins( PIO_PC19 | PIO_PC21, PIN_ENABLE | PIN_INPUT | PIN_PORTC | PIN_PULLUP ) ; #else - pioptr = PIOA ; + register Pio * pioptr = PIOA ; pioptr->PIO_PER = 0x03800000L ; // Enable bits A25,24,23 pioptr->PIO_ODR = 0x03800000L ; // Set as input pioptr->PIO_PUER = 0x03800000L ; // Enable pullups @@ -169,35 +136,28 @@ inline void config_free_pins() // Assumes PMC has already enabled clocks to ports inline void setup_switches() { - register Pio *pioptr ; - - pioptr = PIOA ; #ifdef REVB - pioptr->PIO_PER = 0x01808087 ; // Enable bits - pioptr->PIO_ODR = 0x01808087 ; // Set bits input - pioptr->PIO_PUER = 0x01808087 ; // Set bits with pullups + configure_pins( 0x01808087, PIN_ENABLE | PIN_INPUT | PIN_PORTA | PIN_PULLUP ) ; #else + register Pio *pioptr = PIOA ; pioptr->PIO_PER = 0xF8008184 ; // Enable bits pioptr->PIO_ODR = 0xF8008184 ; // Set bits input pioptr->PIO_PUER = 0xF8008184 ; // Set bits with pullups #endif - pioptr = PIOB ; + #ifdef REVB - pioptr->PIO_PER = 0x00000030 ; // Enable bits - pioptr->PIO_ODR = 0x00000030 ; // Set bits input - pioptr->PIO_PUER = 0x00000030 ; // Set bits with pullups + configure_pins( 0x00000030, PIN_ENABLE | PIN_INPUT | PIN_PORTB | PIN_PULLUP ) ; #else + pioptr = PIOB ; pioptr->PIO_PER = 0x00000010 ; // Enable bits pioptr->PIO_ODR = 0x00000010 ; // Set bits input pioptr->PIO_PUER = 0x00000010 ; // Set bits with pullups #endif - pioptr = PIOC ; #ifdef REVB - pioptr->PIO_PER = 0x91114900 ; // Enable bits - pioptr->PIO_ODR = 0x91114900 ; // Set bits input - pioptr->PIO_PUER = 0x91114900 ; // Set bits with pullups + configure_pins( 0x91114900, PIN_ENABLE | PIN_INPUT | PIN_PORTC | PIN_PULLUP ) ; #else + pioptr = PIOC ; pioptr->PIO_PER = 0x10014900 ; // Enable bits pioptr->PIO_ODR = 0x10014900 ; // Set bits input pioptr->PIO_PUER = 0x10014900 ; // Set bits with pullups @@ -220,13 +180,9 @@ inline void UART_Configure( uint32_t baudrate, uint32_t masterClock) { // const Pin pPins[] = CONSOLE_PINS; register Uart *pUart = CONSOLE_USART; - register Pio *pioptr ; /* Configure PIO */ - pioptr = PIOA ; - pioptr->PIO_ABCDSR[0] &= ~(PIO_PA9 | PIO_PA10) ; // Peripheral A - pioptr->PIO_ABCDSR[1] &= ~(PIO_PA9 | PIO_PA10) ; // Peripheral A - pioptr->PIO_PDR = (PIO_PA9 | PIO_PA10) ; // Assign to peripheral + configure_pins( (PIO_PA9 | PIO_PA10), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; /* Configure PMC */ PMC->PMC_PCER0 = 1 << CONSOLE_ID; @@ -254,13 +210,9 @@ inline void UART3_Configure( uint32_t baudrate, uint32_t masterClock) { // const Pin pPins[] = CONSOLE_PINS; register Uart *pUart = BT_USART; - register Pio *pioptr ; /* Configure PIO */ - pioptr = PIOB ; - pioptr->PIO_ABCDSR[0] &= ~(PIO_PB2 | PIO_PB3) ; // Peripheral A - pioptr->PIO_ABCDSR[1] &= ~(PIO_PB2 | PIO_PB3) ; // Peripheral A - pioptr->PIO_PDR = (PIO_PB2 | PIO_PB3) ; // Assign to peripheral + configure_pins( (PIO_PB2 | PIO_PB3), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTB | PIN_NO_PULLUP ) ; /* Configure PMC */ PMC->PMC_PCER0 = 1 << BT_ID; @@ -293,13 +245,9 @@ inline void UART2_Configure( uint32_t baudrate, uint32_t masterClock) { //// const Pin pPins[] = CONSOLE_PINS; register Usart *pUsart = SECOND_USART; - register Pio *pioptr ; /* Configure PIO */ - pioptr = PIOA ; - pioptr->PIO_ABCDSR[0] &= ~(PIO_PA5 | PIO_PA6) ; // Peripheral A - pioptr->PIO_ABCDSR[1] &= ~(PIO_PA5 | PIO_PA6) ; // Peripheral A - pioptr->PIO_PDR = (PIO_PA5 | PIO_PA6) ; // Assign to peripheral + configure_pins( (PIO_PA5 | PIO_PA6), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; // /* Configure PMC */ PMC->PMC_PCER0 = 1 << SECOND_ID; @@ -371,9 +319,6 @@ inline void start_timer2() inline void start_timer3() { register Tc *ptc ; - register Pio *pioptr ; - - pioptr = PIOC ; // Enable peripheral clock TC0 = bit 23 thru TC5 = bit 28 PMC->PMC_PCER0 |= 0x04000000L ; // Enable peripheral clock to TC3 @@ -385,9 +330,8 @@ inline void start_timer3() ptc->TC_CHANNEL[0].TC_CMR = 0x00090005 ; // 0000 0000 0000 1001 0000 0000 0000 0101, XC0, A rise, b fall ptc->TC_CHANNEL[0].TC_CCR = 5 ; // Enable clock and trigger it (may only need trigger) - pioptr->PIO_ABCDSR[0] |= 0x00800000 ; // Peripheral B = TIOA3 - pioptr->PIO_ABCDSR[1] &= ~0x00800000 ; // Peripheral B - pioptr->PIO_PDR = 0x00800000L ; // Disable bit C23 (TIOA3) Assign to peripheral + configure_pins( PIO_PC23, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_B | PIN_PORTC | PIN_PULLUP ) ; + NVIC_SetPriority( TC3_IRQn, 15 ) ; // Low ppiority interrupt NVIC_EnableIRQ(TC3_IRQn) ; ptc->TC_CHANNEL[0].TC_IER = TC_IER0_LDRAS ; @@ -547,7 +491,6 @@ inline void init_adc() // For testing, just drive it out with PWM void init_pwm() { - register Pio *pioptr ; register Pwm *pwmptr ; register uint32_t timer ; @@ -556,32 +499,19 @@ void init_pwm() MATRIX->CCFG_SYSIO |= 0x00000020L ; // Disable TDO let PB5 work! /* Configure PIO */ -#ifndef REVB - pioptr = PIOB ; +#ifdef REVB + configure_pins( PIO_PA16, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_C | PIN_PORTA | PIN_NO_PULLUP ) ; +#else + register Pio *pioptr = PIOB ; pioptr->PIO_PER = 0x00000020L ; // Enable bit B5 pioptr->PIO_ODR = 0x00000020L ; // set as input -#else - pioptr = PIOA ; - pioptr->PIO_ABCDSR[0] &= ~PIO_PA16 ; // Peripheral C - pioptr->PIO_ABCDSR[1] |= PIO_PA16 ; // Peripheral C - pioptr->PIO_PDR = PIO_PA16 ; // Disable bit A16 Assign to peripheral #endif - pioptr = PIOC ; - pioptr->PIO_ABCDSR[0] |= PIO_PC18 ; // Peripheral B - pioptr->PIO_ABCDSR[1] &= ~PIO_PC18 ; // Peripheral B - pioptr->PIO_PDR = PIO_PC18 ; // Disable bit C18 Assign to peripheral + configure_pins( PIO_PC18, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_B | PIN_PORTC | PIN_NO_PULLUP ) ; #ifdef REVB - pioptr->PIO_ABCDSR[0] |= PIO_PC15 ; // Peripheral B - pioptr->PIO_ABCDSR[1] &= ~PIO_PC15 ; // Peripheral B - pioptr->PIO_PDR = PIO_PC15 ; // Disable bit C15 Assign to peripheral -#endif - -#ifdef REVB - pioptr->PIO_ABCDSR[0] |= PIO_PC22 ; // Peripheral B - pioptr->PIO_ABCDSR[1] &= ~PIO_PC22 ; // Peripheral B - pioptr->PIO_PDR = PIO_PC22 ; // Disable bit C22 Assign to peripheral + configure_pins( PIO_PC15, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_B | PIN_PORTC | PIN_NO_PULLUP ) ; + configure_pins( PIO_PC22, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_B | PIN_PORTC | PIN_NO_PULLUP ) ; #endif // Configure clock - depends on MCK frequency @@ -649,6 +579,77 @@ void init_pwm() extern void start_sound(); // TODO elsewhere +void configure_pins( uint32_t pins, uint16_t config ) +{ + register Pio *pioptr ; + + pioptr = PIOA + ( ( config & PIN_PORT_MASK ) >> 6) ; + if ( config & PIN_PULLUP ) + { + pioptr->PIO_PPDDR = pins ; + pioptr->PIO_PUER = pins ; + } + else + { + pioptr->PIO_PUDR = pins ; + } + + if ( config & PIN_PULLDOWN ) + { + pioptr->PIO_PUDR = pins ; + pioptr->PIO_PPDER = pins ; + } + else + { + pioptr->PIO_PPDDR = pins ; + } + + if ( config & PIN_HIGH ) + { + pioptr->PIO_SODR = pins ; + } + else + { + pioptr->PIO_CODR = pins ; + } + + if ( config & PIN_INPUT ) + { + pioptr->PIO_ODR = pins ; + } + else + { + pioptr->PIO_OER = pins ; + } + + if ( config & PIN_PERI_MASK_L ) + { + pioptr->PIO_ABCDSR[0] |= pins ; + } + else + { + pioptr->PIO_ABCDSR[0] &= ~pins ; + } + if ( config & PIN_PERI_MASK_H ) + { + pioptr->PIO_ABCDSR[1] |= pins ; + } + else + { + pioptr->PIO_ABCDSR[1] &= ~pins ; + } + + if ( config & PIN_ENABLE ) + { + pioptr->PIO_PER = pins ; + } + else + { + pioptr->PIO_PDR = pins ; + } +} + + void board_init() { // register uint32_t goto_usb ; diff --git a/src/board_gruvin9x.cpp b/src/board_gruvin9x.cpp index 810b756ff..fe21c3f72 100644 --- a/src/board_gruvin9x.cpp +++ b/src/board_gruvin9x.cpp @@ -73,13 +73,13 @@ inline void board_init() } #endif -uint8_t check_power() +uint8_t check_soft_power() { #ifndef REV0 if ((PING & 0b00000010) && (~PINL & 0b01000000)) - return 1; + return e_power_off; #endif - return 0; + return e_power_on; } void soft_power_off() diff --git a/src/eeprom_arm.cpp b/src/eeprom_arm.cpp index 0bb309709..d2c9c3010 100644 --- a/src/eeprom_arm.cpp +++ b/src/eeprom_arm.cpp @@ -617,7 +617,6 @@ uint32_t spi_operation( register uint8_t *tx, register uint8_t *rx, register uin // Set clock to 3 MHz, AT25 device is rated to 70MHz, 18MHz would be better void init_spi() { - register Pio *pioptr ; register Spi *spiptr ; register uint32_t timer ; register uint8_t *p ; @@ -625,10 +624,7 @@ void init_spi() PMC->PMC_PCER0 |= 0x00200000L ; // Enable peripheral clock to SPI /* Configure PIO */ - pioptr = PIOA ; - pioptr->PIO_ABCDSR[0] &= ~0x00007800 ; // Peripheral A bits 14,13,12,11 - pioptr->PIO_ABCDSR[1] &= ~0x00007800 ; // Peripheral A - pioptr->PIO_PDR = 0x00007800 ; // Assign to peripheral + configure_pins( 0x00007800, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; spiptr = SPI ; timer = ( Master_frequency / 3000000 ) << 8 ; // Baud rate 3Mb/s diff --git a/src/lcd.cpp b/src/lcd.cpp index e3ba1299b..3fe7da403 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -681,10 +681,7 @@ void lcd_init() // ~/txt/flieger/ST7565RV17.pdf from http://www.glyn.de/content.asp?wdid=132&sid= #ifdef REVB - pioptr = PIOA ; - pioptr->PIO_PER = LCD_A0 ; // Enable bit 7 (LCD-A0) - pioptr->PIO_CODR = LCD_A0 ; - pioptr->PIO_OER = LCD_A0 ; // Set bit 7 output + configure_pins( LCD_A0, PIN_ENABLE | PIN_LOW | PIN_OUTPUT | PIN_PORTA | PIN_NO_PULLUP ) ; pioptr = PIOC ; pioptr->PIO_PER = 0x0C0030FFL ; // Enable bits 27,26,13,12,7-0 pioptr->PIO_CODR = LCD_E | LCD_RnW ; diff --git a/src/model_menus.cpp b/src/model_menus.cpp index a7580b295..338843ee8 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -394,7 +394,7 @@ void menuProcModel(uint8_t event) lcd_outdezNAtt(7*FW,0,g_eeGeneral.currModel+1,INVERS+LEADING0,2); uint8_t protocol = g_model.protocol; - MENU(STR_MENUSETUP, menuTabModel, e_Model, (protocol==PROTO_PPM||protocol==PROTO_FAAST||protocol==PROTO_DSM2||protocol==PROTO_PXX ? 12 : 11), {0,ZCHAR|(sizeof(g_model.name)-1),2,2,0,0,0,0,0,6,2,1}); + MENU(STR_MENUSETUP, menuTabModel, e_Model, (protocol==PROTO_PPM||protocol==PROTO_FAAST||protocol==PROTO_DSM2||protocol==PROTO_PXX ? 12 : 11), {0,ZCHAR|(sizeof(g_model.name)-1),2,2,0,0,0,0,0,NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1,2,1}); uint8_t sub = m_posVert; uint8_t y = 1*FH; @@ -469,7 +469,7 @@ void menuProcModel(uint8_t event) if(s_pgOfs NUM_POTS) idx = NUM_STICKS+2+3+NUM_PPM+g_model.thrTraceSrc; + if (g_model.thrTraceSrc > NUM_POTS) idx = NUM_STICKS+NUM_ROTARY_ENCODERS+2+3+NUM_PPM+g_model.thrTraceSrc; else if (g_model.thrTraceSrc > 0) idx = NUM_STICKS+g_model.thrTraceSrc; putsChnRaw(PARAM_OFS, y, idx, (sub==subN ? INVERS:0)); if (sub==subN) CHECK_INCDEC_MODELVAR(event, g_model.thrTraceSrc, 0, NUM_POTS+NUM_CHNOUT); @@ -485,13 +485,13 @@ void menuProcModel(uint8_t event) if(s_pgOfsfunc < NUM_CHNOUT) { func_displayed = 0; - putsChnRaw(14*FW-2, y, NUM_STICKS+NUM_POTS+2+3+NUM_PPM+sd->func+1, attr); + putsChnRaw(14*FW-2, y, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+2+3+NUM_PPM+sd->func+1, attr); } else if (sd->func < NUM_CHNOUT + NUM_STICKS + 1) { func_displayed = 1; diff --git a/src/myeeprom.h b/src/myeeprom.h index 6f0550f12..0f8b1c58c 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -436,6 +436,12 @@ enum Dsm2Variants { #define EXTDATA FrSkyData frsky #endif +#if defined(PCBV4) +#define BeepANACenter uint16_t +#else +#define BeepANACenter uint8_t +#endif + PACK(typedef struct t_ModelData { char name[10]; // 10 must be first for eeLoadModelName TimerData timers[MAX_TIMERS]; @@ -449,7 +455,7 @@ PACK(typedef struct t_ModelData { uint8_t extendedTrims:1; uint8_t spare2:1; int8_t ppmDelay; - uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7 + BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7 MixData mixData[MAX_MIXERS]; LimitData limitData[NUM_CHNOUT]; ExpoData expoData[MAX_EXPOS]; diff --git a/src/open9x.cpp b/src/open9x.cpp index c1fb9486b..8b6717342 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -712,7 +712,7 @@ void doSplash() if(keyDown() || (tsum!=inacSum)) return; //wait for key release - if (check_power()) return; // Usb on or power off + if (check_soft_power() > e_power_trainer) return; // Usb on or power off checkBacklight(); } @@ -762,7 +762,7 @@ void checkTHR() int16_t v = anaIn(thrchn); if (g_eeGeneral.throttleReversed) v = - v; - if (check_power()) return; // Usb on or power off + if (check_soft_power() > e_power_trainer) return; // Usb on or power off if(v<=lowLim || keyDown()) { clearKeyEvents(); @@ -803,7 +803,7 @@ void checkSwitches() first = false; } - if (check_power()) return; // Usb on or power off + if (check_soft_power() > e_power_trainer) return; // Usb on or power off checkBacklight(); @@ -825,7 +825,7 @@ void alert(const pm_char * s) sleep(1/*ms*/); #endif - if (check_power()) return; // Usb on or power off + if (check_soft_power() > e_power_trainer) return; // Usb on or power off if (keyDown()) return; // wait for key release @@ -1981,7 +1981,14 @@ void perMain() g_menuStack[g_menuStackPtr](evt); refreshDisplay(); -#if defined(PCBV4) +#if defined(PCBARM) + if ( check_soft_power() == e_power_trainer ) { // On trainer power + PIOC->PIO_PDR = PIO_PC22 ; // Disable bit C22 Assign to peripheral + } + else { + PIOC->PIO_PER = PIO_PC22 ; // Enable bit C22 as input + } +#elif defined(PCBV4) // PPM signal on phono-jack. In or out? ... if(checkSlaveMode()) { PORTG |= (1< e_power_trainer) break; #endif diff --git a/src/open9x.h b/src/open9x.h index 54bd5ce34..e0ee50a20 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -47,7 +47,7 @@ #endif #if defined(PCBARM) -#include "ersky9x/AT91SAM3S2.h" +#include "board_ersky9x.h" #endif #if defined(SIMU) @@ -470,18 +470,19 @@ uint8_t keyDown(); enum PowerState { e_power_on, + e_power_trainer, e_power_usb, e_power_off }; #if defined(PCBARM) uint32_t keyState(EnumKeys enuk); -uint32_t check_power(); +uint32_t check_soft_power(); #else #if defined(PCBV4) -uint8_t check_power(); +uint8_t check_soft_power(); #else -#define check_power() (e_power_on) +#define check_soft_power() (e_power_on) #endif bool keyState(EnumKeys enuk); diff --git a/src/pulses_arm.cpp b/src/pulses_arm.cpp index 34bb72023..a4ad23ffc 100644 --- a/src/pulses_arm.cpp +++ b/src/pulses_arm.cpp @@ -103,14 +103,11 @@ void disable_main_ppm() // TD is on PA17, peripheral A void init_ssc() { - register Pio *pioptr ; register Ssc *sscptr ; PMC->PMC_PCER0 |= 0x00400000L ; // Enable peripheral clock to SSC - pioptr = PIOA ; - pioptr->PIO_ABCDSR[0] &= ~0x00020000 ; // Peripheral A bit 17 - pioptr->PIO_ABCDSR[1] &= ~0x00020000 ; // Peripheral A - pioptr->PIO_PDR = 0x00020000 ; // Assign to peripheral + + configure_pins( PIO_PA17, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; sscptr = SSC ; sscptr->SSC_CMR = Master_frequency / (125000*2) ; // 8uS per bit @@ -126,7 +123,7 @@ void disable_ssc() // Revert back to pwm output pioptr = PIOA ; - pioptr->PIO_PER = 0x00020000L ; // Assign A17 to PIO + pioptr->PIO_PER = PIO_PA17 ; // Assign A17 to PIO sscptr = SSC ; sscptr->SSC_CR = SSC_CR_TXDIS ; diff --git a/src/simu.cpp b/src/simu.cpp index 8658052f4..a7b653119 100644 --- a/src/simu.cpp +++ b/src/simu.cpp @@ -333,7 +333,7 @@ void Open9xSim::refreshDiplay() }; static SwitchKey keys3[] = { -#if defined(JETI) || defined(FRSKY) || defined(NMEA) || defined(ARDUPILOT) +#if defined(PCBV4) || defined(JETI) || defined(FRSKY) || defined(NMEA) || defined(ARDUPILOT) { KEY_1, pinc, INP_C_ThrCt, 0 }, { KEY_6, pinc, INP_C_AileDR, 0 }, #else diff --git a/src/translations/en.h b/src/translations/en.h index ebb4a8e25..cd3a99d72 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -33,7 +33,11 @@ #define TR_VTRIMINC "Exp ""ExFine""Fine ""Medium""Coarse" #define LEN_RETA123 "\001" +#if defined(PCBV4) +#define TR_RETA123 "RETA123AB" +#else #define TR_RETA123 "RETA123" +#endif #define LEN_VPROTOS "\005" #define TR_VPROTOS "PPM\0 ""PXX\0 ""DSM2\0""PPM16""FUT\0 " diff --git a/src/translations/fr.h b/src/translations/fr.h index c4e29b2e1..26f469901 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -33,7 +33,11 @@ #define TR_VTRIMINC "Exp ""ExFin ""Fin ""Moyen ""Gros " #define LEN_RETA123 "\001" +#if defined(PCBV4) +#define TR_RETA123 "RETA123AB" +#else #define TR_RETA123 "RETA123" +#endif #define LEN_VPROTOS "\005" #define TR_VPROTOS "PPM\0 ""PXX\0 ""DSM2\0""PPM16""FUT\0 " @@ -97,10 +101,11 @@ #define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3" #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""A1\0 ""A2\0 ""Alt\0""Rpm\0""Fuel""t1\0 ""t2\0 ""Spd\0""Dist""Cell""Tx\0 ""Rx\0 ""AccX""AccY""AccZ""Hdg\0""VSpd""a1\0 ""a2\0 ""ALT\0""RPM\0""T1\0 ""T2\0 ""SPD\0""DIST""Tmr1""Tmr2""ACC\0""Time" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""Cell""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Acc\0""Time" #define LEN_VTELEMUNIT "\003" #define TR_VTELEMUNIT "v\0 ""A\0 ""-\0 ""kts""kmh""M/h""m\0 ""@\0 ""%\0" + #define STR_V (STR_VTELEMUNIT+1) #define STR_A (STR_VTELEMUNIT+4) diff --git a/src/translations/se.h b/src/translations/se.h index 7f46d9fd9..9017740e6 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -33,7 +33,11 @@ #define TR_VTRIMINC "Exp ""xFin ""Fin ""Medium""Grov " #define LEN_RETA123 "\001" +#if defined(PCBV4) +#define TR_RETA123 "RETA123AB" +#else #define TR_RETA123 "RETA123" +#endif #define LEN_VPROTOS "\005" #define TR_VPROTOS "PPM\0 ""PXX\0 ""DSM2\0""PPM16""FUT\0 " @@ -97,7 +101,7 @@ #define TR_FUNCSOUNDS "Varn1 ""Varn2 ""F\200r ""Ring ""SciFi ""Robot ""Pip ""Tada ""Syrsa ""Siren ""Alarm ""Ratata""Tick ""Vibr1 ""Vibr2 ""Vibr3 " #define LEN_VTELEMCHNS "\004" -#define TR_VTELEMCHNS "---\0""A1\0 ""A2\0 ""H\202jd""Varv""Tank""t1\0 ""t2\0 ""Fart""Avst""Batt""Tx\0 ""Rx\0 ""AccX""AccY""AccZ""Hdg\0""VSpd""a1\0 ""a2\0 ""H\205JD""VARV""T1\0 ""T2\0 ""H\205JD""AVST""Tmr1""Tmr2""ACC\0""Tid\0" +#define TR_VTELEMCHNS "---\0""Tmr1""Tmr2""A1\0 ""A2\0 ""Tx\0 ""Rx\0 ""Alt\0""Rpm\0""Tank""T1\0 ""T2\0 ""Spd\0""Dist""Cell""AccX""AccY""AccZ""Hdg\0""VSpd""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Acc\0""Tid\0" #define LEN_VTELEMUNIT "\003" #define TR_VTELEMUNIT "v\0 ""A\0 ""-\0 ""kts""kmh""M/h""m\0 ""@\0 ""%\0"