diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 6f928f9b0..0d53b7ea3 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -917,27 +917,27 @@ inline int divRoundClosest(const int n, const int d) #define calc100to256_16Bits(x) calc100to256(x) #define calc100toRESX_16Bits(x) calc100toRESX(x) -inline int calc100to256(register int x) +inline int calc100to256(int x) { return divRoundClosest(x*256, 100); } -inline int calc100toRESX(register int x) +inline int calc100toRESX(int x) { return divRoundClosest(x*RESX, 100); } -inline int calc1000toRESX(register int x) +inline int calc1000toRESX(int x) { return divRoundClosest(x*RESX, 1000); } -inline int calcRESXto1000(register int x) +inline int calcRESXto1000(int x) { return divRoundClosest(x*1000, RESX); } -inline int calcRESXto100(register int x) +inline int calcRESXto100(int x) { return divRoundClosest(x*100, RESX); } diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index d65e3763b..b368531a3 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -27,6 +27,13 @@ extern "C" { #endif +#if __clang__ +// clang is very picky about the use of "register" +// Tell clang to ignore the warnings for the following files +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" +#endif + #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" @@ -44,7 +51,12 @@ extern "C" { #include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_tim.h" #include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dma2d.h" #include "STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries/STM32F4xx_StdPeriph_Driver/inc/misc.h" +#if __clang__ +// Restore warnings about registers +#pragma clang diagnostic pop +#endif + #if !defined(SIMU) #include "usbd_cdc_core.h" #include "usbd_msc_core.h" diff --git a/radio/src/targets/horus/keys_driver.cpp b/radio/src/targets/horus/keys_driver.cpp index 0a78d6082..7d9b8635d 100644 --- a/radio/src/targets/horus/keys_driver.cpp +++ b/radio/src/targets/horus/keys_driver.cpp @@ -93,7 +93,7 @@ uint8_t keyDown() void checkRotaryEncoder() { - register uint32_t newpos = ROTARY_ENCODER_POSITION(); + uint32_t newpos = ROTARY_ENCODER_POSITION(); if (newpos != rotencPosition) { if ((rotencPosition & 0x01) ^ ((newpos & 0x02) >> 1)) { --rotencValue[0]; @@ -108,7 +108,7 @@ void checkRotaryEncoder() /* TODO common to ARM */ void readKeysAndTrims() { - register uint32_t i; + uint32_t i; uint8_t index = 0; uint32_t in = readKeys(); @@ -161,7 +161,7 @@ uint8_t keyState(uint8_t index) uint32_t switchState(uint8_t index) { - register uint32_t xxx = 0; + uint32_t xxx = 0; switch (index) { ADD_3POS_CASE(A, 0); diff --git a/radio/src/targets/sky9x/adc_driver.cpp b/radio/src/targets/sky9x/adc_driver.cpp index a3d735270..c1096b632 100644 --- a/radio/src/targets/sky9x/adc_driver.cpp +++ b/radio/src/targets/sky9x/adc_driver.cpp @@ -43,8 +43,8 @@ const char ana_direction[NUMBER_ANALOG] = {1, 1, 0, 1 ,0 ,1 ,0, 0, 0}; // TRGEN = 0 (software trigger only) void adcInit() { - register Adc *padc ; - register uint32_t timer ; + Adc *padc ; + uint32_t timer ; timer = ( Master_frequency / (3600000*2) ) << 8 ; // Enable peripheral clock ADC = bit 29 @@ -65,9 +65,9 @@ void adcInit() // Documented bug, must do them 1 by 1 void adcSingleRead() { - register Adc *padc; - register uint32_t y; - register uint32_t x; + Adc *padc; + uint32_t y; + uint32_t x; for (uint8_t i=0; i<4; i++) padc = ADC; diff --git a/radio/src/targets/sky9x/audio_driver.cpp b/radio/src/targets/sky9x/audio_driver.cpp index 35f0b674c..de814b3a8 100644 --- a/radio/src/targets/sky9x/audio_driver.cpp +++ b/radio/src/targets/sky9x/audio_driver.cpp @@ -31,8 +31,8 @@ const int8_t volumeScale[VOLUME_LEVEL_MAX+1] = void setSampleRate(uint32_t frequency) { - register Tc *ptc ; - register uint32_t timer ; + Tc *ptc ; + uint32_t timer ; timer = Master_frequency / (8 * frequency) ; // MCK/8 and 100 000 Hz if (timer > 65535) @@ -50,8 +50,8 @@ void setSampleRate(uint32_t frequency) // Start TIMER1 at 100000Hz, used for DACC trigger void dacTimerStart() { - register Tc *ptc ; - register uint32_t timer ; + Tc *ptc ; + uint32_t timer ; // Enable peripheral clock TC0 = bit 23 thru TC5 = bit 28 PMC->PMC_PCER0 |= 0x01000000L ; // Enable peripheral clock to TC1 @@ -78,7 +78,7 @@ void dacInit() PMC->PMC_PCER0 |= 0x40000000L ; // Enable peripheral clock to DAC - register Dacc *dacptr = DACC; + Dacc *dacptr = DACC; #if defined(REVA) dacptr->DACC_MR = 0x0B010215L ; // 0000 1011 0000 0001 0000 0010 0001 0101 @@ -137,7 +137,7 @@ extern "C" void DAC_IRQHandler() // Sound routines void audioInit() { - register Pio *pioptr ; + Pio *pioptr ; dacInit() ; diff --git a/radio/src/targets/sky9x/board.cpp b/radio/src/targets/sky9x/board.cpp index a48aa463a..b778a6a47 100644 --- a/radio/src/targets/sky9x/board.cpp +++ b/radio/src/targets/sky9x/board.cpp @@ -50,7 +50,7 @@ extern "C" void sam_boot( void ) ; inline void config_free_pins() { #if defined(REVA) - register Pio * pioptr = PIOA ; + 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 @@ -73,7 +73,7 @@ inline void config_free_pins() inline void setup_switches() { #if defined(REVA) - register Pio *pioptr = PIOA ; + Pio *pioptr = PIOA ; pioptr->PIO_PER = 0xF8008184 ; // Enable bits pioptr->PIO_ODR = 0xF8008184 ; // Set bits input pioptr->PIO_PUER = 0xF8008184 ; // Set bits with pullups @@ -97,7 +97,7 @@ inline void setup_switches() #if !defined(SIMU) inline void UART3_Configure(uint32_t baudrate, uint32_t masterClock) { - register Uart *pUart = BT_USART; + Uart *pUart = BT_USART; /* Configure PIO */ configure_pins( (PIO_PB2 | PIO_PB3), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTB | PIN_NO_PULLUP ) ; @@ -139,7 +139,7 @@ void UART3_Stop() // This was 6 MHz, we may need to slow it to TIMER_CLOCK2 (MCK/8=4.5 MHz) inline void start_timer0() { - register Tc *ptc ; + Tc *ptc ; // Enable peripheral clock TC0 = bit 23 thru TC5 = bit 28 PMC->PMC_PCER0 |= 0x00800000L ; // Enable peripheral clock to TC0 @@ -158,8 +158,8 @@ inline void start_timer0() // Starts TIMER2 at 200Hz, commentd out drive of TIOA2 (A26, EXT2) inline void start_timer2() { - register Tc *ptc ; - register uint32_t timer ; + Tc *ptc ; + uint32_t timer ; // Enable peripheral clock TC0 = bit 23 thru TC5 = bit 28 PMC->PMC_PCER0 |= 0x02000000L ; // Enable peripheral clock to TC2 @@ -195,7 +195,7 @@ void interrupt5ms() extern "C" void TC2_IRQHandler() { - register uint32_t dummy; + uint32_t dummy; /* Clear status bit to acknowledge interrupt */ dummy = TC0->TC_CHANNEL[2].TC_SR; @@ -220,8 +220,8 @@ extern "C" void TC2_IRQHandler() // For testing, just drive it out with PWM void init_pwm() { - register Pwm *pwmptr ; - register uint32_t timer ; + Pwm *pwmptr ; + uint32_t timer ; PMC->PMC_PCER0 |= ( 1 << ID_PWM ) ; // Enable peripheral clock to PWM @@ -229,7 +229,7 @@ void init_pwm() /* Configure PIO */ #if defined(REVA) - register Pio *pioptr = PIOB ; + Pio *pioptr = PIOB ; pioptr->PIO_PER = 0x00000020L ; // Enable bit B5 pioptr->PIO_ODR = 0x00000020L ; // set as input #else @@ -299,7 +299,7 @@ void init_pwm() void configure_pins( uint32_t pins, uint16_t config ) { - register Pio *pioptr ; + Pio *pioptr ; pioptr = PIOA + ( ( config & PIN_PORT_MASK ) >> 6) ; if ( config & PIN_PULLUP ) @@ -374,8 +374,8 @@ void opentxBootloader(); #if !defined(AR9X) void i2cInit() { - register Pio *pioptr; - register uint32_t timing; + Pio *pioptr; + uint32_t timing; PMC->PMC_PCER0 |= 0x00080000L ; // Enable peripheral clock to TWI0 @@ -410,7 +410,7 @@ void boardInit() } } - register Pio *pioptr ; + Pio *pioptr ; ResetReason = RSTC->RSTC_SR; @@ -547,7 +547,7 @@ uint8_t getTemperature() void setSticksGain(uint8_t gains) { - register Adc *padc ; + Adc *padc ; uint32_t gain ; uint32_t offset ; diff --git a/radio/src/targets/sky9x/board_lowlevel.c b/radio/src/targets/sky9x/board_lowlevel.c index d01d18a90..3d01a54ff 100644 --- a/radio/src/targets/sky9x/board_lowlevel.c +++ b/radio/src/targets/sky9x/board_lowlevel.c @@ -111,8 +111,8 @@ static uint32_t BOARD_ConfigurePmc(void) #undef CLOCK_TIMEOUT #define CLOCK_TIMEOUT 0xFFFFFFFF - register uint32_t timeout = 0 ; - register Pmc *pmcptr ; + uint32_t timeout = 0 ; + Pmc *pmcptr ; pmcptr = PMC ; @@ -179,8 +179,8 @@ static uint32_t BOARD_ConfigurePmc(void) void revert_osc() { - register uint32_t timeout = 0; - register Pmc *pmcptr; + uint32_t timeout = 0; + Pmc *pmcptr; pmcptr = PMC; diff --git a/radio/src/targets/sky9x/crt.c b/radio/src/targets/sky9x/crt.c index a42d12128..a9e8640a1 100644 --- a/radio/src/targets/sky9x/crt.c +++ b/radio/src/targets/sky9x/crt.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. + */ + #define __CRT_C__ #include @@ -71,9 +71,9 @@ extern uint32_t Master_frequency ; void ResetHandler (void) { { - register uint32_t *pSrc; - register uint32_t *pDest; - register uint32_t m_freq ; + uint32_t *pSrc; + uint32_t *pDest; + uint32_t m_freq ; /* * Call the SystemInit code from CMSIS interface if available. diff --git a/radio/src/targets/sky9x/eeprom_driver.cpp b/radio/src/targets/sky9x/eeprom_driver.cpp index 92d3c120b..2951573f1 100644 --- a/radio/src/targets/sky9x/eeprom_driver.cpp +++ b/radio/src/targets/sky9x/eeprom_driver.cpp @@ -28,10 +28,10 @@ uint8_t eepromIsTransferComplete() return Spi_complete; } -uint32_t eepromTransmitData(register uint8_t *command, register uint8_t *tx, register uint8_t *rx, register uint32_t comlen, register uint32_t count) +uint32_t eepromTransmitData(uint8_t *command, uint8_t *tx, uint8_t *rx, uint32_t comlen, uint32_t count) { - register Spi * spiptr = SPI; - register uint32_t condition; + Spi * spiptr = SPI; + uint32_t condition; static uint8_t discard_rx_command[4]; if (comlen > 4) { @@ -76,8 +76,8 @@ uint32_t eepromTransmitData(register uint8_t *command, register uint8_t *tx, reg uint8_t eepromTransmitByte(uint8_t out, bool skipFirst) { - register Spi * spiptr = SPI; - register uint32_t delay; + Spi * spiptr = SPI; + uint32_t delay; spiptr->SPI_CR = 1; // Enable (void) spiptr->SPI_RDR; // Dump any rx data @@ -172,8 +172,8 @@ void eepromBlockErase(uint32_t address) // Set clock to 3 MHz, AT25 device is rated to 70MHz, 18MHz would be better void eepromInit() { - register Spi * spiptr = SPI; - register uint32_t timer; + Spi * spiptr = SPI; + uint32_t timer; PMC->PMC_PCER0 |= 0x00200000L; // Enable peripheral clock to SPI /* Configure PIO */ @@ -190,7 +190,7 @@ void eepromInit() extern "C" void SPI_IRQHandler() { - register Spi * spiptr = SPI; + Spi * spiptr = SPI; SPI->SPI_IDR = 0x07FF; // All interrupts off spiptr->SPI_CR = 2; // Disable (void) spiptr->SPI_RDR; // Dump any rx data diff --git a/radio/src/targets/sky9x/haptic_driver.cpp b/radio/src/targets/sky9x/haptic_driver.cpp index 7e1ce448a..f6b50b2e1 100644 --- a/radio/src/targets/sky9x/haptic_driver.cpp +++ b/radio/src/targets/sky9x/haptic_driver.cpp @@ -30,7 +30,7 @@ void hapticOff() // pwmPercent 0-100 void hapticOn( uint32_t pwmPercent ) { - register Pwm *pwmptr ; + Pwm *pwmptr ; pwmptr = PWM ; diff --git a/radio/src/targets/sky9x/i2c_driver.cpp b/radio/src/targets/sky9x/i2c_driver.cpp index 7a4d4c75d..d98520169 100644 --- a/radio/src/targets/sky9x/i2c_driver.cpp +++ b/radio/src/targets/sky9x/i2c_driver.cpp @@ -51,7 +51,7 @@ bool i2cInit() //Enable Peripheral Clock PMC->PMC_PCER0 |= 0x00080000L; //Enable TWI PIOs - register Pio *pioptr; + Pio *pioptr; pioptr = PIOA; pioptr->PIO_ABCDSR[0] &= ~0x00000018; // Peripheral A pioptr->PIO_ABCDSR[1] &= ~0x00000018; // Peripheral A diff --git a/radio/src/targets/sky9x/keys_driver.cpp b/radio/src/targets/sky9x/keys_driver.cpp index 75c04f49b..9d999d33f 100644 --- a/radio/src/targets/sky9x/keys_driver.cpp +++ b/radio/src/targets/sky9x/keys_driver.cpp @@ -32,8 +32,8 @@ // LCD pins 5 DOWN, 4 RIGHT, 3 LEFT, 1 UP uint32_t readKeys() { - register uint32_t x; - register uint32_t result = 0; + uint32_t x; + uint32_t result = 0; x = lcdLock ? lcdInputs : PIOC->PIO_PDSR; // 6 LEFT, 5 RIGHT, 4 DOWN, 3 UP () x = ~x; @@ -73,7 +73,7 @@ uint32_t readKeys() uint32_t readTrims() { - register uint32_t result = 0; + uint32_t result = 0; if (~TRIMS_GPIO_REG_LHL & TRIMS_GPIO_PIN_LHL) result |= 0x01; @@ -107,7 +107,7 @@ uint8_t keyDown() void readKeysAndTrims() { - register uint32_t i; + uint32_t i; #if ROTARY_ENCODERS > 0 keys[BTN_REa].input(REA_DOWN()); @@ -135,8 +135,8 @@ uint8_t keyState(uint8_t index) uint32_t switchState(uint8_t index) { - register uint32_t a = PIOA->PIO_PDSR; - register uint32_t c = PIOC->PIO_PDSR; + uint32_t a = PIOA->PIO_PDSR; + uint32_t c = PIOC->PIO_PDSR; uint32_t xxx = 0; diff --git a/radio/src/targets/sky9x/lcd_driver.cpp b/radio/src/targets/sky9x/lcd_driver.cpp index 2b4957ce3..90f843c73 100644 --- a/radio/src/targets/sky9x/lcd_driver.cpp +++ b/radio/src/targets/sky9x/lcd_driver.cpp @@ -71,7 +71,7 @@ const uint8_t Lcd_lookup[] = void lcdSendCtl(uint8_t val) { - register Pio *pioptr; + Pio *pioptr; #if defined(REVA) pioptr = PIOC; @@ -112,7 +112,7 @@ void lcdSendCtl(uint8_t val) void lcdInit() { - register Pio *pioptr; + Pio *pioptr; // /home/thus/txt/datasheets/lcd/KS0713.pdf // ~/txt/flieger/ST7565RV17.pdf from http://www.glyn.de/content.asp?wdid=132&sid= @@ -191,7 +191,7 @@ void lcdInit() void lcdSetRefVolt(uint8_t val) { - register Pio *pioptr; + Pio *pioptr; pioptr = PIOC; // read the inputs, and lock the LCD lines @@ -221,14 +221,14 @@ void lcdSetRefVolt(uint8_t val) void lcdRefresh() { - register Pio *pioptr; - register uint8_t *p = displayBuf; - register uint32_t y; - register uint32_t x; - register uint32_t z; - register uint32_t ebit; + Pio *pioptr; + uint8_t *p = displayBuf; + uint32_t y; + uint32_t x; + uint32_t z; + uint32_t ebit; #if defined(REVA) - register uint8_t *lookup; + uint8_t *lookup; lookup = (uint8_t *) Lcd_lookup; #endif diff --git a/radio/src/targets/sky9x/pulses_driver.cpp b/radio/src/targets/sky9x/pulses_driver.cpp index 057284ef0..340f01526 100644 --- a/radio/src/targets/sky9x/pulses_driver.cpp +++ b/radio/src/targets/sky9x/pulses_driver.cpp @@ -22,7 +22,7 @@ void setExternalModulePolarity() { - register Pwm * pwmptr = PWM; + Pwm * pwmptr = PWM; pwmptr->PWM_CH_NUM[3].PWM_CDTYUPD = GET_PPM_DELAY(EXTERNAL_MODULE) * 2; // Duty in half uS if (GET_PPM_POLARITY(EXTERNAL_MODULE)) pwmptr->PWM_CH_NUM[3].PWM_CMR &= ~0x00000200; // CPOL @@ -32,7 +32,7 @@ void setExternalModulePolarity() void setExtraModulePolarity() { - register Pwm * pwmptr = PWM; + Pwm * pwmptr = PWM; pwmptr->PWM_CH_NUM[1].PWM_CDTYUPD = GET_PPM_DELAY(EXTRA_MODULE) * 2; // Duty in half uS if (GET_PPM_POLARITY(EXTRA_MODULE)) pwmptr->PWM_CH_NUM[1].PWM_CMR &= ~0x00000200; // CPOL @@ -42,7 +42,7 @@ void setExtraModulePolarity() void module_output_active() { - register Pio *pioptr = PIOA; + Pio *pioptr = PIOA; pioptr->PIO_ABCDSR[0] &= ~PIO_PA17; // Peripheral C pioptr->PIO_ABCDSR[1] |= PIO_PA17; // Peripheral C pioptr->PIO_PDR = PIO_PA17; // Disable bit A17 Assign to peripheral @@ -61,7 +61,7 @@ void module_output_active() void init_main_ppm(uint32_t period, uint32_t out_enable) { - register Pwm * pwmptr; + Pwm * pwmptr; setupPulsesPPMModule(EXTERNAL_MODULE); @@ -86,7 +86,7 @@ void init_main_ppm(uint32_t period, uint32_t out_enable) void disable_main_ppm() { - register Pio * pioptr = PIOA; + Pio * pioptr = PIOA; pioptr->PIO_PER = PIO_PA17; // Assign A17 to PIO PWM->PWM_IDR1 = PWM_IDR1_CHID3; } @@ -95,7 +95,7 @@ void init_second_ppm(uint32_t period) { #if !defined(REVA) // PWM1 for PPM2 - register Pwm * pwmptr = PWM; + Pwm * pwmptr = PWM; configure_pins(PIO_PC15, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_B | PIN_PORTC | PIN_NO_PULLUP ); pwmptr->PWM_CH_NUM[1].PWM_CMR = 0x0000000B; // CLKB if (!GET_PPM_POLARITY(EXTRA_MODULE)) { @@ -113,7 +113,7 @@ void init_second_ppm(uint32_t period) void disable_second_ppm() { #if !defined(REVA) - register Pio * pioptr = PIOC; + Pio * pioptr = PIOC; pioptr->PIO_PER = PIO_PC15; // Assign C17 to PIO PWM->PWM_IDR1 = PWM_IDR1_CHID1; #endif @@ -163,7 +163,7 @@ void disable_ppm(uint32_t port) // TD is on PA17, peripheral A void init_ssc() { - register Ssc * sscptr; + Ssc * sscptr; PMC->PMC_PCER0 |= 0x00400000L; // Enable peripheral clock to SSC @@ -185,8 +185,8 @@ void init_ssc() void disable_ssc() { - register Pio *pioptr; - register Ssc *sscptr; + Pio *pioptr; + Ssc *sscptr; // Revert back to pwm output pioptr = PIOA; @@ -243,7 +243,7 @@ void disable_dsm2(uint32_t port) #if !defined(SIMU) extern "C" void PWM_IRQHandler(void) { - register Pwm * pwmptr = PWM; + Pwm * pwmptr = PWM; uint32_t reason = pwmptr->PWM_ISR1; uint32_t period; @@ -266,7 +266,7 @@ extern "C" void PWM_IRQHandler(void) } else { // Kick off serial output here - register Ssc * sscptr = SSC; + Ssc * sscptr = SSC; sscptr->SSC_TPR = CONVERT_PTR_UINT(modulePulsesData[EXTERNAL_MODULE].pxx.pulses); sscptr->SSC_TCR = (uint8_t *)modulePulsesData[EXTERNAL_MODULE].pxx.ptr - (uint8_t *)modulePulsesData[EXTERNAL_MODULE].pxx.pulses; sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers @@ -290,7 +290,7 @@ extern "C" void PWM_IRQHandler(void) } else { // Kick off serial output here - register Ssc * sscptr = SSC; + Ssc * sscptr = SSC; sscptr->SSC_TPR = CONVERT_PTR_UINT(modulePulsesData[EXTERNAL_MODULE].dsm2.pulses); sscptr->SSC_TCR = (uint8_t *)modulePulsesData[EXTERNAL_MODULE].dsm2.ptr - (uint8_t *)modulePulsesData[EXTERNAL_MODULE].dsm2.pulses; sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers diff --git a/radio/src/targets/sky9x/rotenc_driver.cpp b/radio/src/targets/sky9x/rotenc_driver.cpp index 9b5048f51..b4b66f63c 100644 --- a/radio/src/targets/sky9x/rotenc_driver.cpp +++ b/radio/src/targets/sky9x/rotenc_driver.cpp @@ -37,7 +37,7 @@ void rotencEnd() volatile uint32_t Rotary_position ; extern "C" void PIOC_IRQHandler() { - register uint32_t dummy; + uint32_t dummy; dummy = PIOC->PIO_ISR ; // Read and clear status register (void) dummy ; // Discard value - prevents compiler warning diff --git a/radio/src/targets/sky9x/serial2_driver.cpp b/radio/src/targets/sky9x/serial2_driver.cpp index f207ab165..e3243188a 100644 --- a/radio/src/targets/sky9x/serial2_driver.cpp +++ b/radio/src/targets/sky9x/serial2_driver.cpp @@ -62,7 +62,7 @@ uint8_t serial2TracesEnabled() */ void SECOND_UART_Configure(uint32_t baudrate, uint32_t masterClock) { - register Uart *pUart = SECOND_SERIAL_UART; + Uart *pUart = SECOND_SERIAL_UART; /* Configure PIO */ configure_pins( (PIO_PA9 | PIO_PA10), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; diff --git a/radio/src/targets/sky9x/telemetry_driver.cpp b/radio/src/targets/sky9x/telemetry_driver.cpp index b96a52405..d2eedb469 100644 --- a/radio/src/targets/sky9x/telemetry_driver.cpp +++ b/radio/src/targets/sky9x/telemetry_driver.cpp @@ -36,7 +36,7 @@ uint16_t DsmRxTimeout; // Uses PA5 and PA6 (RXD and TXD) void UART2_Configure(uint32_t baudrate, uint32_t masterClock, int mode) { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; // Configure PIO configure_pins( (PIO_PA5 | PIO_PA6), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ; @@ -66,7 +66,7 @@ void UART2_Configure(uint32_t baudrate, uint32_t masterClock, int mode) void UART2_timeout_enable() { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; pUsart->US_CR = US_CR_STTTO ; pUsart->US_RTOR = 115 ; // Bits @ 115200 ~= 1mS pUsart->US_IER = US_IER_TIMEOUT ; @@ -76,7 +76,7 @@ void UART2_timeout_enable() void UART2_timeout_disable() { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; pUsart->US_RTOR = 0 ; pUsart->US_IDR = US_IDR_TIMEOUT ; NVIC_DisableIRQ(USART0_IRQn); @@ -84,14 +84,14 @@ void UART2_timeout_disable() extern "C" void USART0_IRQHandler() { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; pUsart->US_CR = US_CR_STTTO ; // Clears timeout bit DsmRxTimeout = 1; } void startPdcUsartReceive() { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; TelemetryInBuffer.outPtr = TelemetryInBuffer.fifo ; #ifndef SIMU pUsart->US_RPR = (uint32_t)TelemetryInBuffer.fifo ; @@ -105,7 +105,7 @@ void startPdcUsartReceive() void rxPdcUsart( void (*pChProcess)(uint8_t x) ) { #if !defined(SIMU) - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; uint8_t *ptr ; uint8_t *endPtr ; @@ -137,7 +137,7 @@ void rxPdcUsart( void (*pChProcess)(uint8_t x) ) uint32_t txPdcUsart(uint8_t *buffer, uint32_t size) { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; if ( pUsart->US_TNCR == 0 ) { @@ -153,7 +153,7 @@ uint32_t txPdcUsart(uint8_t *buffer, uint32_t size) uint32_t telemetryTransmitPending() { - register Usart *pUsart = SECOND_USART; + Usart *pUsart = SECOND_USART; uint32_t x ; __disable_irq() ; diff --git a/radio/src/targets/sky9x/trainer_driver.cpp b/radio/src/targets/sky9x/trainer_driver.cpp index 5cba603df..151be4b30 100644 --- a/radio/src/targets/sky9x/trainer_driver.cpp +++ b/radio/src/targets/sky9x/trainer_driver.cpp @@ -23,7 +23,7 @@ // Start TIMER3 for input capture inline void start_timer3() { - register Tc *ptc ; + Tc *ptc ; // Enable peripheral clock TC0 = bit 23 thru TC5 = bit 28 PMC->PMC_PCER0 |= 0x04000000L ; // Enable peripheral clock to TC3 @@ -45,8 +45,8 @@ inline void start_timer3() // Start Timer4 to provide 0.5uS clock for input capture void start_timer4() { - register Tc *ptc ; - register uint32_t timer ; + Tc *ptc ; + uint32_t timer ; timer = Master_frequency / (2*2000000) ; // MCK/2 and 2MHz diff --git a/radio/src/targets/taranis/audio_driver.cpp b/radio/src/targets/taranis/audio_driver.cpp index e50409efc..d30ffc4ee 100644 --- a/radio/src/targets/taranis/audio_driver.cpp +++ b/radio/src/targets/taranis/audio_driver.cpp @@ -25,7 +25,7 @@ const AudioBuffer * nextBuffer = 0; void setSampleRate(uint32_t frequency) { - register uint32_t timer = (PERI1_FREQUENCY * TIMER_MULT_APB1) / frequency - 1 ; // MCK/8 and 100 000 Hz + uint32_t timer = (PERI1_FREQUENCY * TIMER_MULT_APB1) / frequency - 1 ; // MCK/8 and 100 000 Hz AUDIO_TIMER->CR1 &= ~TIM_CR1_CEN ; AUDIO_TIMER->CNT = 0 ; diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index f079f176b..01052a69f 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -27,6 +27,13 @@ extern "C" { #endif +#if __clang__ +// clang is very picky about the use of "register" +// tell it to ignore for the STM32 includes instead of modyfing the orginal files +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-register" +#endif + #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" @@ -59,6 +66,11 @@ extern "C" { #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h" #endif +#if __clang__ +// Restore warnings about registers +#pragma clang diagnostic pop +#endif + #if !defined(SIMU) #include "usbd_cdc_core.h" #include "usbd_msc_core.h" diff --git a/radio/src/targets/taranis/keys_driver.cpp b/radio/src/targets/taranis/keys_driver.cpp index 59e73b6b9..f4c1b47f4 100644 --- a/radio/src/targets/taranis/keys_driver.cpp +++ b/radio/src/targets/taranis/keys_driver.cpp @@ -88,7 +88,7 @@ uint8_t keyDown() #if defined(ROTARY_ENCODER_NAVIGATION) void checkRotaryEncoder() { - register uint32_t newpos = ROTARY_ENCODER_POSITION(); + uint32_t newpos = ROTARY_ENCODER_POSITION(); if (newpos != rotencPosition) { if ((rotencPosition & 0x01) ^ ((newpos & 0x02) >> 1)) { --rotencValue[0]; @@ -168,7 +168,7 @@ uint8_t keyState(uint8_t index) uint32_t switchState(uint8_t index) { - register uint32_t xxx = 0; + uint32_t xxx = 0; switch (index) { ADD_3POS_CASE(A, 0);