Fix and improve FYSETC LCD support (#13767)
This commit is contained in:
@ -94,3 +94,16 @@ public:
|
||||
: U8GLIB(&u8g_dev_tft_320x240_upscale_from_128x64, cs, rs, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
extern u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, u8g_dev_uc1701_mini12864_HAL_2x_hw_spi;
|
||||
|
||||
class U8GLIB_MINI12864_2X_HAL : public U8GLIB {
|
||||
public:
|
||||
U8GLIB_MINI12864_2X_HAL(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_MINI12864_2X_HAL(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
@ -66,42 +66,47 @@
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0E2, /* soft reset */
|
||||
0x040, /* set display start line to 0 */
|
||||
0x0A0, /* ADC set to reverse */
|
||||
0x0C8, /* common output mode */
|
||||
0x0A6, /* display normal, bit val 0: LCD pixel off. */
|
||||
0x0A2, /* LCD bias 1/9 */
|
||||
0x02F, /* all power control circuits on */
|
||||
0x0F8, /* set booster ratio to */
|
||||
0x000, /* 4x */
|
||||
0x023, /* set V0 voltage resistor ratio to large */
|
||||
0x081, /* set contrast */
|
||||
0x027, /* contrast value */
|
||||
0x0AC, /* indicator */
|
||||
0x000, /* disable */
|
||||
0x0AF, /* display on */
|
||||
0x0E2, /* soft reset */
|
||||
0x040, /* set display start line to 0 */
|
||||
0x0A0, /* ADC set to reverse */
|
||||
0x0C8, /* common output mode */
|
||||
0x0A6, /* display normal, bit val 0: LCD pixel off. */
|
||||
0x0A2, /* LCD bias 1/9 */
|
||||
0x02F, /* all power control circuits on */
|
||||
0x0F8, /* set booster ratio to */
|
||||
0x000, /* 4x */
|
||||
0x023, /* set V0 voltage resistor ratio to large */
|
||||
0x081, /* set contrast */
|
||||
0x027, /* contrast value */
|
||||
0x0AC, /* indicator */
|
||||
0x000, /* disable */
|
||||
0x0AF, /* display on */
|
||||
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x0A5, /* display all points, ST7565 */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x0A4, /* normal display */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0A5, /* display all points, ST7565 */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0A4, /* normal display */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr to 0 */
|
||||
0x000, /* set lower 4 bit of the col adr to 4 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr to 0 */
|
||||
0x000, /* set lower 4 bit of the col adr to 4 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
|
||||
|
@ -111,8 +111,8 @@
|
||||
// The MINIPanel display
|
||||
//#define U8G_CLASS U8GLIB_MINI12864
|
||||
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
|
||||
#define U8G_CLASS U8GLIB_MINI12864_2X
|
||||
#if ENABLED(FYSETC_MINI_12864) && DOGLCD_SCK > 0
|
||||
#define U8G_CLASS U8GLIB_MINI12864_2X_HAL
|
||||
#if BOTH(FYSETC_MINI_12864, FORCE_SOFT_SPI)
|
||||
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes SW-SPI
|
||||
#else
|
||||
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes HW-SPI
|
||||
|
@ -668,6 +668,7 @@ void MarlinUI::update() {
|
||||
|
||||
static uint16_t max_display_update_time = 0;
|
||||
static millis_t next_lcd_update_ms;
|
||||
millis_t ms = millis();
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
@ -729,11 +730,12 @@ void MarlinUI::update() {
|
||||
|
||||
refresh();
|
||||
init_lcd(); // May revive the LCD if static electricity killed it
|
||||
ms = millis();
|
||||
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // delay LCD update until after SD activity completes
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT && SD_DETECT_PIN
|
||||
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, next_lcd_update_ms)
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|| drawing_screen
|
||||
|
Reference in New Issue
Block a user