LCD Size Defines (#15297)

This commit is contained in:
Robby Candra 2019-09-18 14:58:58 +07:00 committed by Scott Lahteine
parent b590ae4875
commit 787d522036
2 changed files with 16 additions and 6 deletions

View file

@ -60,6 +60,7 @@
#if HAS_GRAPHICAL_LCD && PIN_EXISTS(FSMC_CS)
#include "HAL_LCD_com_defines.h"
#include "ultralcd_DOGM.h"
#include <string.h>
@ -70,12 +71,12 @@
extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
#endif
#define WIDTH 128
#define HEIGHT 64
#define WIDTH LCD_PIXEL_WIDTH
#define HEIGHT LCD_PIXEL_HEIGHT
#define PAGE_HEIGHT 8
#define X_LO 32
#define Y_LO 32
#define X_LO LCD_PIXEL_OFFSET_X
#define Y_LO LCD_PIXEL_OFFSET_Y
#define X_HI (X_LO + 2 * WIDTH - 1)
#define Y_HI (Y_LO + 2 * HEIGHT - 1)
@ -142,8 +143,8 @@ static const uint8_t page_first_sequence[] = {
};
static const uint8_t clear_screen_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_WIDTH),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_HEIGHT),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};

View file

@ -145,6 +145,15 @@
#define LCD_PIXEL_HEIGHT 64
#endif
// LCD_FULL_PIXEL_WIDTH =
// LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X
#if ENABLED(FSMC_GRAPHICAL_TFT)
#define LCD_FULL_PIXEL_WIDTH 320
#define LCD_PIXEL_OFFSET_X 32
#define LCD_FULL_PIXEL_HEIGHT 240
#define LCD_PIXEL_OFFSET_Y 32
#endif
// For selective rendering within a Y range
#define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top?
#define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?