From 40583276ca3074dc3009e2bce4be0cbeae1a1157 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 15 Jan 2020 17:21:57 +0100 Subject: [PATCH] Add the definition LCD_VERTICAL_INVERT --- radio/src/gui/colorlcd/lcd.cpp | 6 +++--- radio/src/gui/colorlcd/lcd.h | 2 +- radio/src/targets/common/arm/stm32/timers_driver.cpp | 6 +++--- radio/src/targets/horus/hal.h | 3 +++ radio/src/targets/horus/lcd_driver.cpp | 6 +++--- radio/src/tests/lcd_480x272.cpp | 2 +- radio/src/thirdparty/libopenui | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/radio/src/gui/colorlcd/lcd.cpp b/radio/src/gui/colorlcd/lcd.cpp index 8ee12ea86..297193247 100644 --- a/radio/src/gui/colorlcd/lcd.cpp +++ b/radio/src/gui/colorlcd/lcd.cpp @@ -131,7 +131,7 @@ BitmapBuffer * lcd = &_lcd; void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color) { -#if defined(PCBX10) && !defined(SIMU) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); #endif @@ -145,7 +145,7 @@ void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, ui void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(PCBX10) && !defined(SIMU) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -159,7 +159,7 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(PCBX10) && !defined(SIMU) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); diff --git a/radio/src/gui/colorlcd/lcd.h b/radio/src/gui/colorlcd/lcd.h index a87eb77ce..a03d356fc 100644 --- a/radio/src/gui/colorlcd/lcd.h +++ b/radio/src/gui/colorlcd/lcd.h @@ -81,7 +81,7 @@ inline void lcdClear() lcd->clear(); } -#if defined(PCBX10) && !defined(SIMU) +#if defined(LCD_VERTICAL_INVERT) #define PIXEL_PTR(x, y) &displayBuf[(LCD_H*LCD_W-1) - (y)*LCD_W - (x)] #else #define PIXEL_PTR(x, y) &displayBuf[(y)*LCD_W + (x)] diff --git a/radio/src/targets/common/arm/stm32/timers_driver.cpp b/radio/src/targets/common/arm/stm32/timers_driver.cpp index f25cf483b..e245eb5ba 100644 --- a/radio/src/targets/common/arm/stm32/timers_driver.cpp +++ b/radio/src/targets/common/arm/stm32/timers_driver.cpp @@ -45,14 +45,14 @@ void init5msTimer() void stop5msTimer() { - INTERRUPT_xMS_TIMER->CR1 = 0 ; // stop timer - NVIC_DisableIRQ(INTERRUPT_xMS_IRQn) ; + INTERRUPT_xMS_TIMER->CR1 = 0; // stop timer + NVIC_DisableIRQ(INTERRUPT_xMS_IRQn); } // TODO use the same than board_sky9x.cpp void interrupt5ms() { - static uint8_t pre_scale; // Used to get 10 Hz counter + static uint8_t pre_scale; // Used to get 10 Hz counter ++pre_scale; diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index aaf03d28a..59309e03d 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -417,6 +417,9 @@ #define LCD_GPIO_NRST GPIOI #define LCD_GPIO_PIN_NRST GPIO_Pin_10 // PI.10 #endif +#if defined(PCBX10) && !defined(SIMU) + #define LCD_VERTICAL_INVERT +#endif #define LTDC_IRQ_PRIO 4 #define DMA_SCREEN_IRQ_PRIO 6 diff --git a/radio/src/targets/horus/lcd_driver.cpp b/radio/src/targets/horus/lcd_driver.cpp index 6e50f12d4..ca66b3e0c 100644 --- a/radio/src/targets/horus/lcd_driver.cpp +++ b/radio/src/targets/horus/lcd_driver.cpp @@ -357,7 +357,7 @@ void lcdInit() void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color) { -#if defined(PCBX10) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); #endif @@ -386,7 +386,7 @@ void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, ui void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(PCBX10) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); @@ -426,7 +426,7 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h) { -#if defined(PCBX10) +#if defined(LCD_VERTICAL_INVERT) x = destw - (x + w); y = desth - (y + h); srcx = srcw - (srcx + w); diff --git a/radio/src/tests/lcd_480x272.cpp b/radio/src/tests/lcd_480x272.cpp index 0362698e7..08877d4e5 100644 --- a/radio/src/tests/lcd_480x272.cpp +++ b/radio/src/tests/lcd_480x272.cpp @@ -41,7 +41,7 @@ void doPaint_colorlcd(QPainter & p) uint16_t previousColor = 0xFF; for (int y=0; y