Browse Source

Fix MKS_MINI_12864 init

See #13550

Co-Authored-By: DrDitto <drditto@users.noreply.github.com>
pull/1/head
Scott Lahteine 5 years ago
parent
commit
23bb40d0ea
  1. 85
      Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp

85
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp

@ -74,7 +74,8 @@
#define UC1701_V5_RATIO(N) (0x20 | ((N) & 0x7))
#define UC1701_CONTRAST(N) (0x81), (N)
#define UC1701_COLUMN_ADR(N) (0x10 | (((N) >> 4) & 0xF)), ((N) & 0xF)
#define UC1701_COLUMN_HI(N) (0x10 | (((N) >> 4) & 0xF))
#define UC1701_COLUMN_ADR(N) UC1701_COLUMN_HI(N), ((N) & 0xF)
#define UC1701_PAGE_ADR(N) (0xB0 | (N))
#define UC1701_START_LINE(N) (0x40 | (N))
#define UC1701_INDICATOR(N) (0xAC), (N)
@ -83,43 +84,57 @@
#define UC1701_BOOST_RATIO(N) (0xF8), (N)
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 */
UC1701_RESET(), /* soft reset */
UC1701_START_LINE(0), /* set display start line to 0 */
UC1701_ADC_REVERSE(0), /* ADC set to reverse */
UC1701_OUT_MODE(1), /* common output mode */
UC1701_INVERTED(0), /* display normal, bit val 0: LCD pixel off. */
UC1701_BIAS_MODE(0), /* LCD bias 1/9 */
UC1701_POWER_CONTROL(0x7), /* all power control circuits on */
UC1701_BOOST_RATIO(0x0), /* set booster ratio to 4x */
UC1701_V5_RATIO(3), /* set V0 voltage resistor ratio to large */
UC1701_CONTRAST(0x27), /* set contrast */
UC1701_INDICATOR(0), /* indicator */
UC1701_ON(1), /* display on */
U8G_ESC_CS(0), /* disable chip */
U8G_ESC_DLY(100), /* delay 100 ms */
U8G_ESC_CS(1), /* enable chip */
UC1701_ALL_PIX(1), /* 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 */
UC1701_ALL_PIX(0), /* normal display */
U8G_ESC_CS(0), /* disable chip */
U8G_ESC_END /* end of sequence */
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
UC1701_RESET(), // soft reset
UC1701_START_LINE(0), // set display start line to 0
UC1701_ADC_REVERSE(0), // ADC set to reverse
UC1701_OUT_MODE(1), // common output mode
UC1701_INVERTED(0), // display normal, bit val 0: LCD pixel off
UC1701_BIAS_MODE(0), // LCD bias 1/9
UC1701_POWER_CONTROL(0x7), // all power control circuits on
UC1701_BOOST_RATIO(0x0), // set booster ratio to 4x
UC1701_V5_RATIO(3), // set V0 voltage resistor ratio to large
UC1701_CONTRAST(0x27), // set contrast
UC1701_INDICATOR(0), // indicator disable
UC1701_ON(1), // display on
U8G_ESC_CS(0), // disable chip
U8G_ESC_DLY(100), // delay 100 ms
U8G_ESC_CS(1), // enable chip
UC1701_ALL_PIX(1), // 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
UC1701_ALL_PIX(0), // 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 */
UC1701_COLUMN_ADR(0), /* address 0 */
U8G_ESC_END /* end of sequence */
U8G_ESC_ADR(0), // instruction mode
U8G_ESC_CS(1), // enable chip
#if ENABLED(MKS_MINI_12864)
UC1701_START_LINE(0), // set display start line to 0
UC1701_ADC_REVERSE(0), // ADC set to reverse
UC1701_OUT_MODE(1), // common output mode
UC1701_INVERTED(0), // display normal, bit val 0: LCD pixel off
UC1701_BIAS_MODE(0), // LCD bias 1/9
UC1701_POWER_CONTROL(0x7),// all power control circuits on
UC1701_BOOST_RATIO(0x0), // set booster ratio to 4x
UC1701_V5_RATIO(3), // set V0 voltage resistor ratio to large
UC1701_INDICATOR(0), // indicator disable
UC1701_ON(1), // display on
UC1701_COLUMN_HI(0), // set upper 4 bit of the col adr to 0
#else
UC1701_COLUMN_ADR(0), // address 0
#endif
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) {

Loading…
Cancel
Save