diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index f4a2bc7dc..e79d9f4ae 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -125,28 +125,6 @@ const uint8_t chout_ar[] = { //First number is 0..23 -> template setup, Second #define BC_BIT_REA (0x80) #define BC_BIT_REB (0x100) -// TODO remove this enum! -enum EnumKeys { - KEY_MENU, - KEY_EXIT, -#if defined(PCBACT) - KEY_CLR, - KEY_PAGE, - KEY_PLUS, /* Fake, used for rotary encoder */ - KEY_MINUS, /* Fake, used for rotary encoder */ -#elif defined(PCBX9D) - KEY_ENTER, - KEY_PAGE, - KEY_PLUS, - KEY_MINUS, -#else - KEY_DOWN, - KEY_UP, - KEY_RIGHT, - KEY_LEFT, -#endif -}; - #define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-." #define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*" diff --git a/radio/bootloader/Makefile b/radio/bootloader/Makefile index 3b87b4ff5..22b73105f 100644 --- a/radio/bootloader/Makefile +++ b/radio/bootloader/Makefile @@ -91,32 +91,19 @@ ifeq ($(RUN_FROM_FLASH), 1) CPPDEFS += -DPCBSKY UDEFS = -Dat91sam3s8 else - ifeq ($(PCB), X9D) - ARCH = ARM - LDSCRIPT = stm32_ramBoot.ld - TRGT = arm-none-eabi- - CPPDEFS += -DHSE_VALUE=12000000 - CPPDEFS += -DPCBX9D - FULL_PRJ = $(PROJECT)_ramBoot - EXTRAINCDIRS += include -# EXTRAINCDIRS += ../x9d - else ifeq ($(PCB), TARANIS) ARCH = ARM LDSCRIPT = stm32_ramBoot.ld TRGT = arm-none-eabi- CPPDEFS += -DHSE_VALUE=12000000 - CPPDEFS += -DPCBX9D CPPDEFS += -DPCBTARANIS FULL_PRJ = $(PROJECT)_ramBoot EXTRAINCDIRS += include # EXTRAINCDIRS += ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include endif - endif endif - # List all user C define here, like -D_DEBUG=1 # Define ASM defines here diff --git a/radio/bootloader/boot.cpp b/radio/bootloader/boot.cpp index ae8627f11..26d320632 100644 --- a/radio/bootloader/boot.cpp +++ b/radio/bootloader/boot.cpp @@ -58,7 +58,7 @@ #include "core_cm3.h" #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #include "stm32f2xx.h" #include "stm32f2xx_flash.h" #include "i2c_ee.h" @@ -96,7 +96,7 @@ extern void usbMassStorage( void ) ; #define DISPLAY_CHAR_WIDTH 21 #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define BOOT_KEY_UP KEY_PLUS #define BOOT_KEY_DOWN KEY_MINUS #define BOOT_KEY_LEFT KEY_MENU @@ -208,12 +208,12 @@ static bool usbPlugged(void) return PIOC->PIO_PDSR & 0x02000000 ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS return GPIOA->IDR & 0x0200 ; #endif } -#ifdef PCBX9D +#ifdef PCBTARANIS extern "C" { USB_OTG_CORE_HANDLE USB_OTG_dev; @@ -399,7 +399,7 @@ extern "C" void TC2_IRQHandler() } #endif -#ifdef PCBX9D +#ifdef PCBTARANIS void init10msTimer() { // Timer14 @@ -686,7 +686,7 @@ uint8_t flashFile( uint32_t index ) if ( Valid == 2 ) { lcd_puts_Pleft( 3*FH,"NOT A VALID FIRMWARE") ; -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 6*FH,"\015[EXIT]") ; #else lcd_puts_Pleft( 6*FH,"\007[EXIT]") ; @@ -700,7 +700,7 @@ uint8_t flashFile( uint32_t index ) } lcd_putsn_P( 0, 2*FH, Filenames[index], DISPLAY_CHAR_WIDTH ) ; -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 6*FH,"\010[ENTER]\021[EXIT]") ; lcd_puts_Pleft( 5*FH,"\010YES\021NO") ; #else @@ -736,7 +736,7 @@ int main() { uint32_t i ; uint8_t index = 0 ; -#ifdef PCBX9D +#ifdef PCBTARANIS uint8_t TenCount = 2 ; #endif uint8_t maxhsize = DISPLAY_CHAR_WIDTH ; @@ -745,7 +745,7 @@ int main() uint32_t nameCount = 0 ; uint32_t vpos = 0 ; uint32_t hpos = 0 ; -#ifdef PCBX9D +#ifdef PCBTARANIS uint32_t firmwareAddress = 0x08000000 ; #endif #ifdef PCBSKY @@ -753,7 +753,7 @@ int main() #endif uint32_t firmwareWritten = 0 ; -#ifdef PCBX9D +#ifdef PCBTARANIS wdt_reset() ; RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN ; // Enable portA clock #endif @@ -776,7 +776,7 @@ extern uint8_t OptrexDisplay ; OptrexDisplay = 1 ; #endif lcd_clear() ; -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 0, "\006Boot Loader" ) ; #endif refreshDisplay() ; @@ -785,7 +785,7 @@ extern uint8_t OptrexDisplay ; refreshDisplay() ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS init_keys() ; I2C_EE_Init() ; init_hw_timer() ; @@ -805,7 +805,7 @@ extern uint8_t OptrexDisplay ; FlashSize = ( (chip_id >> 8 ) & 0x000F ) == 9 ? 256 : 512 ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS FlashSize = 512 ; #endif @@ -817,7 +817,7 @@ extern uint8_t OptrexDisplay ; } #endif -#ifdef PCBX9D +#ifdef PCBTARANIS // SD card detect pin configure_pins( GPIO_Pin_CP, PIN_PORTD | PIN_INPUT | PIN_PULLUP ) ; disk_initialize( 0 ) ; @@ -855,7 +855,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY lcd_puts_Pleft( 0, "Boot Loader" ) ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 0, "\006Boot Loader" ) ; #endif @@ -864,7 +864,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY lcd_puts_Pleft( 0, "\014Ready" ) ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 0, "\022Ready" ) ; #endif @@ -878,7 +878,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY lcd_puts_Pleft( 3*FH, "\010BUSY" ) ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 3*FH, "\016BUSY" ) ; #endif if ( usbPlugged() == 0 ) @@ -923,7 +923,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY lcd_puts_Pleft( 16, "\005No Firmware" ) ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS lcd_puts_Pleft( 16, "\013No Firmware" ) ; #endif } @@ -1045,7 +1045,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY firmwareAddress = 0x00408000 ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS firmwareAddress = 0x08008000 ; #endif firmwareWritten = 0 ; @@ -1106,13 +1106,13 @@ extern uint8_t OptrexDisplay ; } } -#ifdef PCBX9D +#ifdef PCBTARANIS if ( --TenCount == 0 ) { TenCount = 2 ; #endif refreshDisplay() ; -#ifdef PCBX9D +#ifdef PCBTARANIS } #endif if ( PowerUpDelay < 20 ) // 200 mS @@ -1124,7 +1124,7 @@ extern uint8_t OptrexDisplay ; #ifdef PCBSKY sd_poll_10mS() ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS sdPoll10ms() ; #endif } diff --git a/radio/bootloader/driversboot.cpp b/radio/bootloader/driversboot.cpp index a848981b0..ca3c917d9 100644 --- a/radio/bootloader/driversboot.cpp +++ b/radio/bootloader/driversboot.cpp @@ -27,7 +27,7 @@ #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #include "radio.h" #include "hal.h" #include "stm32f2xx.h" diff --git a/radio/bootloader/include/diskio.h b/radio/bootloader/include/diskio.h index d36db188d..b05e8073c 100644 --- a/radio/bootloader/include/diskio.h +++ b/radio/bootloader/include/diskio.h @@ -41,7 +41,8 @@ #ifdef PCBSKY #include "board.h" #endif -#ifdef PCBX9D + +#ifdef PCBTARANIS #include "stm32f2xx.h" #endif @@ -133,10 +134,6 @@ void disk_timerproc (void); volatile extern BYTE Timer1, Timer2; /* 100Hz decrement timer */ #endif -//#ifdef PCBX9D -//volatile extern DWORD Timer1, Timer2; /* 100Hz decrement timer */ -//#endif - //------------------------------------------------------------------------------ /// Detect if SD card is connected //------------------------------------------------------------------------------ @@ -164,7 +161,7 @@ extern uint32_t sd_acmd6( void ) ; extern uint32_t sd_acmd51( uint32_t *presult ) ; extern uint32_t sd_cmd13( uint32_t *status) ; extern void sd_poll_10mS( void ) ; -#ifdef PCBX9D +#ifdef PCBTARANIS extern void sdPoll10ms( void ) ; extern void sdInit( void ) ; #endif diff --git a/radio/bootloader/include/ersky9x.h b/radio/bootloader/include/ersky9x.h index 207188b22..e0e0b8640 100644 --- a/radio/bootloader/include/ersky9x.h +++ b/radio/bootloader/include/ersky9x.h @@ -33,7 +33,7 @@ #ifdef PCBSKY #define wdt_reset() (WDT->WDT_CR = 0xA5000001) #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define wdt_reset() (IWDG->KR = 0x0000AAAAL) #endif #endif @@ -83,7 +83,7 @@ extern const char * const Swedish[] ; #define pgm_read_byte(p) (*(p)) -#ifdef PCBX9D +#ifdef PCBTARANIS #define NUMBER_ANALOG 9 #else #ifdef REVX @@ -132,7 +132,7 @@ enum EnumKeys { SW_Trainer #endif -#ifdef PCBX9D +#ifdef PCBTARANIS SW_SA0, SW_SA1, SW_SA2, @@ -197,7 +197,7 @@ enum EnumKeys { #define MAX_SKYDRSWITCH (1+SW_Trainer-SW_ThrCt+1+NUM_SKYCSW) #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define SW_BASE SW_SA0 #define SW_BASE_DIAG SW_SA0 #define MAX_PSWITCH (SW_SH2-SW_SA0+1) // 9 physical switches @@ -238,7 +238,7 @@ enum EnumKeys { #ifdef PCBSKY #define CSW_INDEX 9 // Index of first custom switch #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define CSW_INDEX 22 // Index of first custom switch #endif @@ -312,7 +312,7 @@ enum EnumKeys { #define MIX_CYC2 11 #define MIX_CYC3 12 #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define MIX_P3 7 #define MIX_P4 8 #define MIX_MAX 9 @@ -497,7 +497,7 @@ extern uint8_t convert_mode_helper(uint8_t x) ; #define BACKLIGHT_OFF (PWM->PWM_CH_NUM[0].PWM_CDTY = 100) #endif -#ifdef PCBX9D +#ifdef PCBTARANIS extern void backlight_on( void ) ; extern void backlight_off( void ) ; #define BACKLIGHT_ON backlight_on() @@ -731,13 +731,13 @@ extern struct t_p1 P1values ; #ifdef PCBSKY extern uint16_t ResetReason ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS extern uint32_t ResetReason ; #endif extern uint8_t unexpectedShutdown ; extern uint8_t SdMounted ; -#ifdef PCBX9D +#ifdef PCBTARANIS #include "stm32f2xx.h" #include "rtc.h" #include "stm32f2xx_rtc.h" @@ -749,7 +749,7 @@ void rtcInit( void ) ; extern void setVolume( uint8_t value ) ; extern uint8_t HoldVolume ; -#ifdef PCBX9D +#ifdef PCBTARANIS #define INTERNAL_MODULE 0 #define EXTERNAL_MODULE 1 #define TRAINER_MODULE 2 diff --git a/radio/bootloader/include/lcd.h b/radio/bootloader/include/lcd.h index cbea7fd2e..a9e39d09e 100644 --- a/radio/bootloader/include/lcd.h +++ b/radio/bootloader/include/lcd.h @@ -21,7 +21,7 @@ #ifndef lcd_h #define lcd_h -#ifdef PCBX9D +#ifdef PCBTARANIS #define DISPLAY_W 212 #define DISPLAY_H 64 #endif @@ -110,7 +110,7 @@ extern void putsTime(uint8_t x,uint8_t y,int16_t tme,uint8_t att,uint8_t att2) ; extern void putsVolts(uint8_t x,uint8_t y, uint8_t volts, uint8_t att) ; extern void putsVBat(uint8_t x,uint8_t y,uint8_t att) ; -#ifdef PCBX9D +#ifdef PCBTARANIS extern void backlight_set( uint16_t brightness ) ; #endif diff --git a/radio/bootloader/include/logicio.h b/radio/bootloader/include/logicio.h index aa2720a24..a8b004eca 100644 --- a/radio/bootloader/include/logicio.h +++ b/radio/bootloader/include/logicio.h @@ -13,7 +13,7 @@ * ****************************************************************************/ -#ifdef PCBX9D +#ifdef PCBTARANIS #define PIN_MODE_MASK 0x0003 #define PIN_INPUT 0x0000 #define PIN_OUTPUT 0x0001 @@ -117,7 +117,7 @@ extern void config_free_pins( void ) ; #define GPIO_SetBits( port, bits ) (port->BSRRL = bits) #define GPIO_ReadInputDataBit( port, bit) ( (port->IDR & bit) ? Bit_SET : Bit_RESET) -#ifdef PCBX9D +#ifdef PCBTARANIS uint32_t switchPosition( uint32_t swtch ) ; #endif diff --git a/radio/bootloader/include/radio.h b/radio/bootloader/include/radio.h index dc6e1993c..afc5e5b46 100644 --- a/radio/bootloader/include/radio.h +++ b/radio/bootloader/include/radio.h @@ -5,7 +5,7 @@ #ifdef PCBSKY #define wdt_reset() (WDT->WDT_CR = 0xA5000001) #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #define wdt_reset() (IWDG->KR = 0x0000AAAAL) #endif @@ -43,7 +43,7 @@ enum EnumKeys { } ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS enum EnumKeys { KEY_MENU , KEY_EXIT , diff --git a/radio/bootloader/include/timers.h b/radio/bootloader/include/timers.h index 9352f1c5a..d617d0df4 100644 --- a/radio/bootloader/include/timers.h +++ b/radio/bootloader/include/timers.h @@ -25,7 +25,7 @@ extern void stop_timer0( void ) ; extern void init_pwm( void ) ; #endif -#ifdef PCBX9D +#ifdef PCBTARANIS extern uint32_t Peri1_frequency ; extern uint32_t Peri2_frequency ; extern uint32_t Timer_mult1 ; diff --git a/radio/bootloader/lcdboot.cpp b/radio/bootloader/lcdboot.cpp index 741f80002..06d23bffe 100644 --- a/radio/bootloader/lcdboot.cpp +++ b/radio/bootloader/lcdboot.cpp @@ -28,7 +28,7 @@ //#include "myeeprom.h" #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #include "radio.h" #endif @@ -48,7 +48,7 @@ uint8_t Lcd_lastPos ; uint8_t DisplayBuf[DISPLAY_W*DISPLAY_H/8] ; #define DISPLAY_END (DisplayBuf+sizeof(DisplayBuf)) -#ifdef PCBX9D +#ifdef PCBTARANIS #define X9D_OFFSET 0 #define DISPLAY_START (DisplayBuf + X9D_OFFSET) #else diff --git a/radio/bootloader/logicioboot.cpp b/radio/bootloader/logicioboot.cpp index cc6be1b84..67f44866a 100644 --- a/radio/bootloader/logicioboot.cpp +++ b/radio/bootloader/logicioboot.cpp @@ -25,7 +25,7 @@ #include "drivers.h" #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #include "stm32f2xx.h" #include "stm32f2xx_gpio.h" #include "radio.h" @@ -118,7 +118,7 @@ void configure_pins( uint32_t pins, uint16_t config ) #endif -#ifdef PCBX9D +#ifdef PCBTARANIS void configure_pins( uint32_t pins, uint16_t config ) { uint32_t address ; @@ -389,7 +389,7 @@ uint32_t initReadTrims( void ) } #endif // PCBSKY -#ifdef PCBX9D +#ifdef PCBTARANIS void init_keys() { // Buttons PE10, 11, 12, PD2, 3, 7 @@ -453,5 +453,5 @@ void setup_switches() } -#endif // PCBX9D +#endif // PCBTARANIS diff --git a/radio/bootloader/power.cpp b/radio/bootloader/power.cpp index 9d3ef80ef..5873d62e1 100644 --- a/radio/bootloader/power.cpp +++ b/radio/bootloader/power.cpp @@ -38,7 +38,7 @@ #endif -#ifdef PCBX9D +#ifdef PCBTARANIS #include "stm32f2xx_gpio.h" #include "stm32f2xx_rcc.h" #include "hal.h" @@ -80,7 +80,7 @@ void soft_power_off() #endif -#ifdef PCBX9D +#ifdef PCBTARANIS void soft_power_off() { diff --git a/radio/src/loadboot.cpp b/radio/src/loadboot.cpp index 9093076e8..b06241019 100644 --- a/radio/src/loadboot.cpp +++ b/radio/src/loadboot.cpp @@ -54,21 +54,16 @@ #ifdef PCBTARANIS #include "stm32f2xx.h" #include "stm32f2xx_gpio.h" -#else - #ifdef PCBX9D - #include "x9d\stm32f2xx.h" - #include "x9d\stm32f2xx_gpio.h" - #endif #endif -#if defined(PCBX9D) || defined(PCBTARANIS) +#if defined(PCBTARANIS) void bwdt_reset() { - IWDG->KR = 0xAAAA ; // reload + IWDG->KR = 0xAAAA ; // reload } #endif -#if defined(PCBX9D) || defined(PCBTARANIS) +#if defined(PCBTARANIS) __attribute__ ((section(".bootrodata"), used)) void _bootStart( void ) ; @@ -80,7 +75,7 @@ const uint32_t BootVectors[] = { } ; #endif -#if defined(PCBX9D) || defined(PCBTARANIS) +#if defined(PCBTARANIS) __attribute__ ((section(".bootrodata.*"), used)) #endif @@ -93,7 +88,7 @@ const uint8_t BootCode[] = { } ; -#if defined(PCBX9D) || defined(PCBTARANIS) +#if defined(PCBTARANIS) __attribute__ ((section(".bootrodata"), used))