@@ -24,17 +24,18 @@ static inline lcd_pixel_type min(lcd_pixel_type a, lcd_pixel_type b) {
2424 return b;
2525}
2626
27- #if defined(LCD_ROTATE_180 )
28- #define FILLRECT (X,Y,W,H,C ) \
29- { \
30- lcd_pixel_type x0 = LCD_WIDTH - (X) - (W) - 1 ; \
31- lcd_pixel_type y0 = LCD_HEIGHT - (Y) - (H) - 1 ; \
32- GUI_FillRectColor (x0, y0, x0 + W, y0 + H, C); \
33- }
27+ #if defined(LCD_MIRROR_HORIZONTALLY )
28+ #define _X (X,W ) (LCD_WIDTH - (X) - (W) - 1 )
29+ # else
30+ # define _X ( X,W ) (X)
31+ # endif
32+ # if defined(LCD_MIRROR_VERTICALLY)
33+ # define _Y ( Y,H ) (LCD_HEIGHT - (Y) - (H) - 1 )
3434#else
35- #define FILLRECT (X,Y,W,H,C ) \
36- GUI_FillRectColor (X, Y, X + W, Y + H, C);
35+ #define _Y (Y,H ) (Y)
3736#endif
37+ #define FILLRECT (X,Y,W,H,C ) \
38+ GUI_FillRectColor (_X(X,W), _Y(Y,H), _X(X,W) + W, _Y(Y,H) + H, C);
3839
3940void clearDisplay () {
4041 // Clear ST7920 gui rect
@@ -141,7 +142,7 @@ int main(void)
141142 st7920Emulator.reset (false );
142143
143144 // Add first part of header line
144- FILLRECT (0 , 7 , ( LCD_WIDTH - sizeof (pTitle) / 5 * 6 ) / 2 - 1 , 1 , LCD_COLOR_FOREGROUND);
145+ FILLRECT (0 , 7 , LCD_WIDTH / 2 - sizeof (pTitle) / 5 * 3 - 1 , 1 , LCD_COLOR_FOREGROUND);
145146
146147 // Init slave SPI
147148 ui32SpiActivated = 0 ;
@@ -172,7 +173,7 @@ int main(void)
172173#endif
173174
174175 // Add second part of header line
175- FILLRECT (( LCD_WIDTH + sizeof (pTitle) / 5 * 6 ) / 2 , 7 , ( LCD_WIDTH - sizeof (pTitle) / 5 * 6 ) / 2 , 1 , LCD_COLOR_FOREGROUND);
176+ FILLRECT (LCD_WIDTH / 2 + sizeof (pTitle) / 5 * 3 , 7 , LCD_WIDTH / 2 - sizeof (pTitle) / 5 * 3 , 1 , LCD_COLOR_FOREGROUND);
176177
177178 // Variables for SPI data received indicator
178179#if defined(SPI_DATA_RECEIVED_INDICATOR)
0 commit comments