Browse Source

Fix MKS_MINI_12864 init

See #13550

Co-Authored-By: DrDitto <drditto@users.noreply.github.com>
Scott Lahteine 5 years ago
parent
commit
23bb40d0ea
1 changed files with 50 additions and 35 deletions
  1. 50
    35
      Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp

+ 50
- 35
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp View File

@@ -74,7 +74,8 @@
74 74
 #define UC1701_V5_RATIO(N)       (0x20 | ((N) & 0x7))
75 75
 #define UC1701_CONTRAST(N)       (0x81), (N)
76 76
 
77
-#define UC1701_COLUMN_ADR(N)     (0x10 | (((N) >> 4) & 0xF)), ((N) & 0xF)
77
+#define UC1701_COLUMN_HI(N)      (0x10 | (((N) >> 4) & 0xF))
78
+#define UC1701_COLUMN_ADR(N)     UC1701_COLUMN_HI(N), ((N) & 0xF)
78 79
 #define UC1701_PAGE_ADR(N)       (0xB0 | (N))
79 80
 #define UC1701_START_LINE(N)     (0x40 | (N))
80 81
 #define UC1701_INDICATOR(N)      (0xAC), (N)
@@ -83,43 +84,57 @@
83 84
 #define UC1701_BOOST_RATIO(N)    (0xF8), (N)
84 85
 
85 86
 static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = {
86
-  U8G_ESC_CS(0),              /* disable chip */
87
-  U8G_ESC_ADR(0),             /* instruction mode */
88
-  U8G_ESC_RST(1),             /* do reset low pulse with (1*16)+2 milliseconds */
89
-  U8G_ESC_CS(1),              /* enable chip */
90
-
91
-  UC1701_RESET(),             /* soft reset */
92
-  UC1701_START_LINE(0),       /* set display start line to 0 */
93
-  UC1701_ADC_REVERSE(0),      /* ADC set to reverse */
94
-  UC1701_OUT_MODE(1),         /* common output mode */
95
-  UC1701_INVERTED(0),         /* display normal, bit val 0: LCD pixel off. */
96
-  UC1701_BIAS_MODE(0),        /* LCD bias 1/9 */
97
-  UC1701_POWER_CONTROL(0x7),  /* all power control circuits on */
98
-  UC1701_BOOST_RATIO(0x0),    /* set booster ratio to 4x */
99
-  UC1701_V5_RATIO(3),         /* set V0 voltage resistor ratio to large */
100
-  UC1701_CONTRAST(0x27),      /* set contrast */
101
-  UC1701_INDICATOR(0),        /* indicator */
102
-  UC1701_ON(1),               /* display on */
103
-
104
-  U8G_ESC_CS(0),              /* disable chip */
105
-  U8G_ESC_DLY(100),           /* delay 100 ms */
106
-  U8G_ESC_CS(1),              /* enable chip */
107
-
108
-  UC1701_ALL_PIX(1),          /* display all points, ST7565 */
109
-  U8G_ESC_CS(0),              /* disable chip */
110
-  U8G_ESC_DLY(100),           /* delay 100 ms */
111
-  U8G_ESC_DLY(100),           /* delay 100 ms */
112
-  U8G_ESC_CS(1),              /* enable chip */
113
-  UC1701_ALL_PIX(0),          /* normal display */
114
-  U8G_ESC_CS(0),              /* disable chip */
115
-  U8G_ESC_END                 /* end of sequence */
87
+  U8G_ESC_CS(0),              // disable chip
88
+  U8G_ESC_ADR(0),             // instruction mode
89
+  U8G_ESC_RST(1),             // do reset low pulse with (1*16)+2 milliseconds
90
+  U8G_ESC_CS(1),              // enable chip
91
+
92
+  UC1701_RESET(),             // soft reset
93
+  UC1701_START_LINE(0),       // set display start line to 0
94
+  UC1701_ADC_REVERSE(0),      // ADC set to reverse
95
+  UC1701_OUT_MODE(1),         // common output mode
96
+  UC1701_INVERTED(0),         // display normal, bit val 0: LCD pixel off
97
+  UC1701_BIAS_MODE(0),        // LCD bias 1/9
98
+  UC1701_POWER_CONTROL(0x7),  // all power control circuits on
99
+  UC1701_BOOST_RATIO(0x0),    // set booster ratio to 4x
100
+  UC1701_V5_RATIO(3),         // set V0 voltage resistor ratio to large
101
+  UC1701_CONTRAST(0x27),      // set contrast
102
+  UC1701_INDICATOR(0),        // indicator disable
103
+  UC1701_ON(1),               // display on
104
+
105
+  U8G_ESC_CS(0),              // disable chip
106
+  U8G_ESC_DLY(100),           // delay 100 ms
107
+  U8G_ESC_CS(1),              // enable chip
108
+
109
+  UC1701_ALL_PIX(1),          // display all points, ST7565
110
+  U8G_ESC_CS(0),              // disable chip
111
+  U8G_ESC_DLY(100),           // delay 100 ms
112
+  U8G_ESC_DLY(100),           // delay 100 ms
113
+  U8G_ESC_CS(1),              // enable chip
114
+  UC1701_ALL_PIX(0),          // normal display
115
+  U8G_ESC_CS(0),              // disable chip
116
+  U8G_ESC_END                 // end of sequence
116 117
 };
117 118
 
118 119
 static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
119
-  U8G_ESC_ADR(0),             /* instruction mode */
120
-  U8G_ESC_CS(1),              /* enable chip */
121
-  UC1701_COLUMN_ADR(0),       /* address 0 */
122
-  U8G_ESC_END                 /* end of sequence */
120
+  U8G_ESC_ADR(0),             // instruction mode
121
+  U8G_ESC_CS(1),              // enable chip
122
+  #if ENABLED(MKS_MINI_12864)
123
+    UC1701_START_LINE(0),     // set display start line to 0
124
+    UC1701_ADC_REVERSE(0),    // ADC set to reverse
125
+    UC1701_OUT_MODE(1),       // common output mode
126
+    UC1701_INVERTED(0),       // display normal, bit val 0: LCD pixel off
127
+    UC1701_BIAS_MODE(0),      // LCD bias 1/9
128
+    UC1701_POWER_CONTROL(0x7),// all power control circuits on
129
+    UC1701_BOOST_RATIO(0x0),  // set booster ratio to 4x
130
+    UC1701_V5_RATIO(3),       // set V0 voltage resistor ratio to large
131
+    UC1701_INDICATOR(0),      // indicator disable
132
+    UC1701_ON(1),             // display on
133
+    UC1701_COLUMN_HI(0),      // set upper 4 bit of the col adr to 0
134
+  #else
135
+    UC1701_COLUMN_ADR(0),     // address 0
136
+  #endif
137
+  U8G_ESC_END                 // end of sequence
123 138
 };
124 139
 
125 140
 uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {

Loading…
Cancel
Save