Pārlūkot izejas kodu

Prevent compilation of unused u8g-oriented code

Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
fb608938f8

+ 79
- 81
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp Parādīt failu

@@ -56,108 +56,106 @@
56 56
 
57 57
 */
58 58
 
59
-
60 59
 #ifdef __SAM3X8E__
61 60
 
62
-//  #include <inttypes.h>
63
-
64
-//  #include "src/core/macros.h"
65
-//  #include "Configuration.h"
66
-#include "../../Marlin.h"
67
-#include "../../inc/MarlinConfig.h"
68
-
69
-  #include <U8glib.h>
70
-
71
-  #define SPI_FULL_SPEED 0
72
-  #define SPI_HALF_SPEED 1
73
-  #define SPI_QUARTER_SPEED 2
74
-  #define SPI_EIGHTH_SPEED 3
75
-  #define SPI_SIXTEENTH_SPEED 4
76
-  #define SPI_SPEED_5 5
77
-  #define SPI_SPEED_6 6
78
-
79
-  void spiBegin();
80
-  void spiInit(uint8_t spiRate);
81
-  void spiSend(uint8_t b);
82
-  void spiSend(const uint8_t* buf, size_t n);
61
+#include "../../inc/MarlinConfigPre.h"
83 62
 
84
-  #include <Arduino.h>
85
-  #include "../../core/macros.h"
86
-  #include "fastio_Due.h"
63
+#if ENABLED(DOGLCD)
87 64
 
65
+#include <U8glib.h>
88 66
 
89
-  void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
90
-     PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
91
-       g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
92
-  }
93
-
94
-  void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
95
-    volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
96
-    uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
97
-    if (level) port->PIO_SODR = mask;
98
-    else port->PIO_CODR = mask;
99
-  }
67
+#include "../../Marlin.h"
100 68
 
101
-  uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
69
+#define SPI_FULL_SPEED 0
70
+#define SPI_HALF_SPEED 1
71
+#define SPI_QUARTER_SPEED 2
72
+#define SPI_EIGHTH_SPEED 3
73
+#define SPI_SIXTEENTH_SPEED 4
74
+#define SPI_SPEED_5 5
75
+#define SPI_SPEED_6 6
76
+
77
+void spiBegin();
78
+void spiInit(uint8_t spiRate);
79
+void spiSend(uint8_t b);
80
+void spiSend(const uint8_t* buf, size_t n);
81
+
82
+#include <Arduino.h>
83
+#include "fastio_Due.h"
84
+
85
+void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
86
+   PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
87
+     g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
88
+}
89
+
90
+void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
91
+  volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
92
+  uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
93
+  if (level) port->PIO_SODR = mask;
94
+  else port->PIO_CODR = mask;
95
+}
96
+
97
+uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
98
+{
99
+  switch(msg)
102 100
   {
103
-    switch(msg)
104
-    {
105
-      case U8G_COM_MSG_STOP:
106
-        break;
101
+    case U8G_COM_MSG_STOP:
102
+      break;
107 103
 
108
-      case U8G_COM_MSG_INIT:
109
-        u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_CS, 1);
110
-        u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_A0, 1);
104
+    case U8G_COM_MSG_INIT:
105
+      u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_CS, 1);
106
+      u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_A0, 1);
111 107
 
112
-        u8g_SetPIOutput_DUE_hw_spi(u8g, U8G_PI_CS);
113
-        u8g_SetPIOutput_DUE_hw_spi(u8g, U8G_PI_A0);
108
+      u8g_SetPIOutput_DUE_hw_spi(u8g, U8G_PI_CS);
109
+      u8g_SetPIOutput_DUE_hw_spi(u8g, U8G_PI_A0);
114 110
 
115
-        u8g_Delay(5);
111
+      u8g_Delay(5);
116 112
 
117
-        spiBegin();
113
+      spiBegin();
118 114
 
119
-        #ifndef SPI_SPEED
120
-          #define SPI_SPEED SPI_FULL_SPEED  // use same SPI speed as SD card
121
-        #endif
122
-        spiInit(2);
115
+      #ifndef SPI_SPEED
116
+        #define SPI_SPEED SPI_FULL_SPEED  // use same SPI speed as SD card
117
+      #endif
118
+      spiInit(2);
123 119
 
124
-        break;
120
+      break;
125 121
 
126
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
127
-        u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_A0, arg_val);
128
-        break;
122
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
123
+      u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_A0, arg_val);
124
+      break;
129 125
 
130
-      case U8G_COM_MSG_CHIP_SELECT:
131
-        u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_CS, (arg_val ? 0 : 1));
132
-        break;
126
+    case U8G_COM_MSG_CHIP_SELECT:
127
+      u8g_SetPILevel_DUE_hw_spi(u8g, U8G_PI_CS, (arg_val ? 0 : 1));
128
+      break;
133 129
 
134
-      case U8G_COM_MSG_RESET:
135
-        break;
130
+    case U8G_COM_MSG_RESET:
131
+      break;
136 132
 
137
-      case U8G_COM_MSG_WRITE_BYTE:
133
+    case U8G_COM_MSG_WRITE_BYTE:
138 134
 
139
-        spiSend((uint8_t)arg_val);
140
-        break;
135
+      spiSend((uint8_t)arg_val);
136
+      break;
141 137
 
142
-      case U8G_COM_MSG_WRITE_SEQ: {
143
-          uint8_t *ptr = (uint8_t*) arg_ptr;
144
-          while (arg_val > 0) {
145
-            spiSend(*ptr++);
146
-            arg_val--;
147
-          }
138
+    case U8G_COM_MSG_WRITE_SEQ: {
139
+        uint8_t *ptr = (uint8_t*) arg_ptr;
140
+        while (arg_val > 0) {
141
+          spiSend(*ptr++);
142
+          arg_val--;
148 143
         }
149
-        break;
150
-
151
-      case U8G_COM_MSG_WRITE_SEQ_P: {
152
-          uint8_t *ptr = (uint8_t*) arg_ptr;
153
-          while (arg_val > 0) {
154
-            spiSend(*ptr++);
155
-            arg_val--;
156
-          }
144
+      }
145
+      break;
146
+
147
+    case U8G_COM_MSG_WRITE_SEQ_P: {
148
+        uint8_t *ptr = (uint8_t*) arg_ptr;
149
+        while (arg_val > 0) {
150
+          spiSend(*ptr++);
151
+          arg_val--;
157 152
         }
158
-        break;
159
-    }
160
-    return 1;
153
+      }
154
+      break;
161 155
   }
156
+  return 1;
157
+}
158
+
159
+#endif  // DOGLCD
162 160
 
163 161
 #endif  //__SAM3X8E__

+ 7
- 2
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp Parādīt failu

@@ -55,9 +55,12 @@
55 55
 
56 56
 #ifdef ARDUINO_ARCH_SAM
57 57
 
58
+#include "../../inc/MarlinConfigPre.h"
59
+
60
+#if ENABLED(DOGLCD)
61
+
58 62
 #include <U8glib.h>
59 63
 #include <Arduino.h>
60
-#include "../../core/macros.h"
61 64
 #include "../Delay.h"
62 65
 
63 66
 void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
@@ -177,4 +180,6 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
177 180
   return 1;
178 181
 }
179 182
 
180
-#endif  //ARDUINO_ARCH_SAM
183
+#endif // DOGLCD
184
+
185
+#endif // ARDUINO_ARCH_SAM

+ 6
- 4
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp Parādīt failu

@@ -55,11 +55,11 @@
55 55
 
56 56
 #ifdef TARGET_LPC1768
57 57
 
58
-//#include <inttypes.h>
58
+#include "../../inc/MarlinConfigPre.h"
59 59
 
60
-//#include "src/core/macros.h"
61
-//#include "Configuration.h"
60
+#if ENABLED(DOGLCD)
62 61
 
62
+//#include <inttypes.h>
63 63
 #include <U8glib.h>
64 64
 
65 65
 #define SPI_FULL_SPEED 0
@@ -132,4 +132,6 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
132 132
   return 1;
133 133
 }
134 134
 
135
-#endif  //TARGET_LPC1768
135
+#endif // DOGLCD
136
+
137
+#endif // TARGET_LPC1768

+ 102
- 96
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp Parādīt failu

@@ -77,113 +77,119 @@
77 77
 
78 78
 #ifdef TARGET_LPC1768
79 79
 
80
-  #include <U8glib.h>
81
-
82
-  #define I2C_SLA         (0x3C*2)
83
-  //#define I2C_CMD_MODE  0x080
84
-  #define I2C_CMD_MODE    0x000
85
-  #define I2C_DATA_MODE   0x040
86
-
87
-  //#define U8G_I2C_OPT_FAST 16
88
-
89
-  uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
90
-    /* are we requested to set the a0 state? */
91
-    if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
92
-
93
-    /* setup bus, might be a repeated start */
94
-    if (u8g_i2c_start(I2C_SLA) == 0)
95
-      return 0;
96
-    if (u8g->pin_list[U8G_PI_A0_STATE] == 0 ) {
97
-      if (u8g_i2c_send_byte(I2C_CMD_MODE) == 0) return 0;
98
-    }
99
-    else if (u8g_i2c_send_byte(I2C_DATA_MODE) == 0)
100
-      return 0;
101
-
102
-    u8g->pin_list[U8G_PI_SET_A0] = 0;
103
-    return 1;
104
-  }
80
+#include "../../inc/MarlinConfigPre.h"
105 81
 
106
-  uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
107
-    switch(msg) {
108
-      case U8G_COM_MSG_INIT:
109
-        //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
110
-        //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
111
-        //u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: unknown mode */
112
-
113
-        u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
114
-        u8g_com_ssd_I2C_start_sequence(u8g);
115
-        break;
116
-
117
-      case U8G_COM_MSG_STOP:
118
-        break;
119
-
120
-      case U8G_COM_MSG_RESET:
121
-        /* Currently disabled, but it could be enable. Previous restrictions have been removed */
122
-        /* u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); */
123
-        break;
124
-
125
-      case U8G_COM_MSG_CHIP_SELECT:
126
-        u8g->pin_list[U8G_PI_A0_STATE] = 0;
127
-        u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again, also forces start condition */
128
-        if (arg_val == 0 ) {
129
-          /* disable chip, send stop condition */
130
-          u8g_i2c_stop();
131
-        }
132
-        else {
133
-          /* enable, do nothing: any byte writing will trigger the i2c start */
134
-        }
135
-        break;
82
+#if ENABLED(DOGLCD)
136 83
 
137
-      case U8G_COM_MSG_WRITE_BYTE:
138
-        //u8g->pin_list[U8G_PI_SET_A0] = 1;
139
-        //if (u8g_com_arduino_ssd_start_sequence(u8g) == 0)
140
-        //  return u8g_i2c_stop(), 0;
141
-        if (u8g_i2c_send_byte(arg_val) == 0)
142
-          return u8g_i2c_stop(), 0;
143
-        // u8g_i2c_stop();
144
-        break;
84
+#include <U8glib.h>
85
+
86
+#define I2C_SLA         (0x3C*2)
87
+//#define I2C_CMD_MODE  0x080
88
+#define I2C_CMD_MODE    0x000
89
+#define I2C_DATA_MODE   0x040
90
+
91
+//#define U8G_I2C_OPT_FAST 16
92
+
93
+uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
94
+  /* are we requested to set the a0 state? */
95
+  if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
145 96
 
146
-      case U8G_COM_MSG_WRITE_SEQ: {
97
+  /* setup bus, might be a repeated start */
98
+  if (u8g_i2c_start(I2C_SLA) == 0)
99
+    return 0;
100
+  if (u8g->pin_list[U8G_PI_A0_STATE] == 0 ) {
101
+    if (u8g_i2c_send_byte(I2C_CMD_MODE) == 0) return 0;
102
+  }
103
+  else if (u8g_i2c_send_byte(I2C_DATA_MODE) == 0)
104
+    return 0;
105
+
106
+  u8g->pin_list[U8G_PI_SET_A0] = 0;
107
+  return 1;
108
+}
109
+
110
+uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
111
+  switch(msg) {
112
+    case U8G_COM_MSG_INIT:
113
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
114
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
115
+      //u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: unknown mode */
116
+
117
+      u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
118
+      u8g_com_ssd_I2C_start_sequence(u8g);
119
+      break;
120
+
121
+    case U8G_COM_MSG_STOP:
122
+      break;
123
+
124
+    case U8G_COM_MSG_RESET:
125
+      /* Currently disabled, but it could be enable. Previous restrictions have been removed */
126
+      /* u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); */
127
+      break;
128
+
129
+    case U8G_COM_MSG_CHIP_SELECT:
130
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;
131
+      u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again, also forces start condition */
132
+      if (arg_val == 0 ) {
133
+        /* disable chip, send stop condition */
134
+        u8g_i2c_stop();
135
+      }
136
+      else {
137
+        /* enable, do nothing: any byte writing will trigger the i2c start */
138
+      }
139
+      break;
140
+
141
+    case U8G_COM_MSG_WRITE_BYTE:
142
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
143
+      //if (u8g_com_arduino_ssd_start_sequence(u8g) == 0)
144
+      //  return u8g_i2c_stop(), 0;
145
+      if (u8g_i2c_send_byte(arg_val) == 0)
146
+        return u8g_i2c_stop(), 0;
147
+      // u8g_i2c_stop();
148
+      break;
149
+
150
+    case U8G_COM_MSG_WRITE_SEQ: {
151
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
152
+      if (u8g_com_ssd_I2C_start_sequence(u8g) == 0)
153
+        return u8g_i2c_stop(), 0;
154
+
155
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
156
+        while (arg_val > 0) {
157
+          if (u8g_i2c_send_byte(*ptr++) == 0)
158
+            return u8g_i2c_stop(), 0;
159
+          arg_val--;
160
+        }
161
+      }
162
+      // u8g_i2c_stop();
163
+      break;
164
+
165
+    case U8G_COM_MSG_WRITE_SEQ_P: {
147 166
         //u8g->pin_list[U8G_PI_SET_A0] = 1;
148 167
         if (u8g_com_ssd_I2C_start_sequence(u8g) == 0)
149 168
           return u8g_i2c_stop(), 0;
150 169
 
151
-          register uint8_t *ptr = (uint8_t *)arg_ptr;
152
-          while (arg_val > 0) {
153
-            if (u8g_i2c_send_byte(*ptr++) == 0)
154
-              return u8g_i2c_stop(), 0;
155
-            arg_val--;
156
-          }
170
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
171
+        while (arg_val > 0) {
172
+          if (u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0)
173
+            return 0;
174
+          ptr++;
175
+          arg_val--;
157 176
         }
158
-        // u8g_i2c_stop();
159
-        break;
177
+      }
178
+      // u8g_i2c_stop();
179
+      break;
160 180
 
161
-      case U8G_COM_MSG_WRITE_SEQ_P: {
162
-          //u8g->pin_list[U8G_PI_SET_A0] = 1;
163
-          if (u8g_com_ssd_I2C_start_sequence(u8g) == 0)
164
-            return u8g_i2c_stop(), 0;
165
-
166
-          register uint8_t *ptr = (uint8_t *)arg_ptr;
167
-          while (arg_val > 0) {
168
-            if (u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0)
169
-              return 0;
170
-            ptr++;
171
-            arg_val--;
172
-          }
173
-        }
174
-        // u8g_i2c_stop();
175
-        break;
181
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
182
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
183
+      u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again */
176 184
 
177
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
178
-        u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
179
-        u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again */
185
+      u8g_i2c_start(0); // send slave address and write bit
186
+      u8g_i2c_send_byte(arg_val ? 0x40 : 0x80);  // Write to ? Graphics DRAM mode : Command mode
187
+      break;
180 188
 
181
-        u8g_i2c_start(0); // send slave address and write bit
182
-        u8g_i2c_send_byte(arg_val ? 0x40 : 0x80);  // Write to ? Graphics DRAM mode : Command mode
183
-        break;
189
+  } // switch
190
+  return 1;
191
+}
184 192
 
185
-    } // switch
186
-    return 1;
187
-  }
193
+#endif // DOGLCD
188 194
 
189 195
 #endif // TARGET_LPC1768

+ 12
- 6
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction Parādīt failu

@@ -61,16 +61,20 @@
61 61
 
62 62
 #ifdef TARGET_LPC1768
63 63
 
64
-  #include <U8glib.h>
64
+#include "../../inc/MarlinConfigPre.h"
65
+
66
+#if ENABLED(DOGLCD)
67
+
68
+#include <U8glib.h>
65 69
 
66 70
 //void pinMode(int16_t pin, uint8_t mode);
67 71
 //void digitalWrite(int16_t pin, uint8_t pin_status);
68 72
 
69 73
 
70
-  #define I2C_SLA         (0x3C*2)
71
-  //#define I2C_CMD_MODE  0x080
72
-  #define I2C_CMD_MODE    0x000
73
-  #define I2C_DATA_MODE   0x040
74
+#define I2C_SLA         (0x3C*2)
75
+//#define I2C_CMD_MODE  0x080
76
+#define I2C_CMD_MODE    0x000
77
+#define I2C_DATA_MODE   0x040
74 78
 
75 79
 //static uint8_t I2C_speed; // 3 - 400KHz, 13 - 100KHz
76 80
 //#define SPEED_400KHz 3
@@ -245,4 +249,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
245 249
   return 1;
246 250
 }
247 251
 
248
-#endif  // TARGET_LPC1768
252
+#endif // DOGLCD
253
+
254
+#endif // TARGET_LPC1768

+ 82
- 85
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp Parādīt failu

@@ -55,103 +55,100 @@
55 55
 
56 56
 #ifdef TARGET_LPC1768
57 57
 
58
-  //#include <inttypes.h>
59
-  //#include "src/core/macros.h"
60
-  //#include "Configuration.h"
58
+#include "../../inc/MarlinConfigPre.h"
61 59
 
62
-  #include <U8glib.h>
63
-  #include "../Delay.h"
60
+#if ENABLED(DOGLCD)
64 61
 
65
-  #define SPI_FULL_SPEED 0
66
-  #define SPI_HALF_SPEED 1
67
-  #define SPI_QUARTER_SPEED 2
68
-  #define SPI_EIGHTH_SPEED 3
69
-  #define SPI_SIXTEENTH_SPEED 4
70
-  #define SPI_SPEED_5 5
71
-  #define SPI_SPEED_6 6
62
+//#include <inttypes.h>
63
+#include <U8glib.h>
64
+#include "../Delay.h"
72 65
 
66
+#define SPI_FULL_SPEED 0
67
+#define SPI_HALF_SPEED 1
68
+#define SPI_QUARTER_SPEED 2
69
+#define SPI_EIGHTH_SPEED 3
70
+#define SPI_SIXTEENTH_SPEED 4
71
+#define SPI_SPEED_5 5
72
+#define SPI_SPEED_6 6
73 73
 
74
-  void spiBegin();
75
-  void spiInit(uint8_t spiRate);
76
-  void spiSend(uint8_t b);
77
-  void spiSend(const uint8_t* buf, size_t n);
74
+void spiBegin();
75
+void spiInit(uint8_t spiRate);
76
+void spiSend(uint8_t b);
77
+void spiSend(const uint8_t* buf, size_t n);
78 78
 
79
+static uint8_t rs_last_state = 255;
79 80
 
80
-  static uint8_t rs_last_state = 255;
81
+static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val) {
82
+  uint8_t i;
81 83
 
82
-  static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val)
83
-  {
84
-    uint8_t i;
84
+  if ( rs != rs_last_state) {  // time to send a command/data byte
85
+    rs_last_state = rs;
85 86
 
86
-    if ( rs != rs_last_state) {  // time to send a command/data byte
87
-      rs_last_state = rs;
87
+    if ( rs == 0 )
88
+      /* command */
89
+      spiSend(0x0F8);
90
+    else
91
+       /* data */
92
+      spiSend(0x0FA);
88 93
 
89
-      if ( rs == 0 )
90
-        /* command */
91
-        spiSend(0x0F8);
92
-      else
93
-         /* data */
94
-        spiSend(0x0FA);
95
-
96
-      DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
97
-    }
98
-
99
-    spiSend(val & 0x0F0);
100
-    spiSend(val << 4);
94
+    DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
101 95
   }
102 96
 
103
-
104
-  uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
105
-  {
106
-    switch(msg)
107
-    {
108
-      case U8G_COM_MSG_INIT:
109
-        u8g_SetPILevel(u8g, U8G_PI_CS, 0);
110
-        u8g_SetPIOutput(u8g, U8G_PI_CS);
111
-        u8g_Delay(5);
112
-        spiBegin();
113
-        spiInit(SPI_EIGHTH_SPEED);  // ST7920 max speed is about 1.1 MHz
114
-        u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
115
-        break;
116
-
117
-      case U8G_COM_MSG_STOP:
118
-        break;
119
-
120
-      case U8G_COM_MSG_RESET:
121
-        u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
122
-        break;
123
-
124
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
125
-        u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
126
-        break;
127
-
128
-      case U8G_COM_MSG_CHIP_SELECT:
129
-        u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
130
-        break;
131
-
132
-      case U8G_COM_MSG_WRITE_BYTE:
133
-        u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
134
-        break;
135
-
136
-      case U8G_COM_MSG_WRITE_SEQ: {
137
-          uint8_t *ptr = (uint8_t*) arg_ptr;
138
-          while (arg_val > 0) {
139
-            u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
140
-            arg_val--;
141
-          }
97
+  spiSend(val & 0x0F0);
98
+  spiSend(val << 4);
99
+}
100
+
101
+uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
102
+  switch(msg) {
103
+    case U8G_COM_MSG_INIT:
104
+      u8g_SetPILevel(u8g, U8G_PI_CS, 0);
105
+      u8g_SetPIOutput(u8g, U8G_PI_CS);
106
+      u8g_Delay(5);
107
+      spiBegin();
108
+      spiInit(SPI_EIGHTH_SPEED);  // ST7920 max speed is about 1.1 MHz
109
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
110
+      break;
111
+
112
+    case U8G_COM_MSG_STOP:
113
+      break;
114
+
115
+    case U8G_COM_MSG_RESET:
116
+      u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
117
+      break;
118
+
119
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
120
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
121
+      break;
122
+
123
+    case U8G_COM_MSG_CHIP_SELECT:
124
+      u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
125
+      break;
126
+
127
+    case U8G_COM_MSG_WRITE_BYTE:
128
+      u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
129
+      break;
130
+
131
+    case U8G_COM_MSG_WRITE_SEQ: {
132
+        uint8_t *ptr = (uint8_t*) arg_ptr;
133
+        while (arg_val > 0) {
134
+          u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
135
+          arg_val--;
142 136
         }
143
-        break;
144
-
145
-        case U8G_COM_MSG_WRITE_SEQ_P: {
146
-          uint8_t *ptr = (uint8_t*) arg_ptr;
147
-          while (arg_val > 0) {
148
-            u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
149
-            arg_val--;
150
-          }
137
+      }
138
+      break;
139
+
140
+      case U8G_COM_MSG_WRITE_SEQ_P: {
141
+        uint8_t *ptr = (uint8_t*) arg_ptr;
142
+        while (arg_val > 0) {
143
+          u8g_com_LPC1768_st7920_write_byte_hw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
144
+          arg_val--;
151 145
         }
152
-        break;
153
-    }
154
-    return 1;
146
+      }
147
+      break;
155 148
   }
149
+  return 1;
150
+}
151
+
152
+#endif // DOGLCD
156 153
 
157
-#endif  // TARGET_LPC1768
154
+#endif // TARGET_LPC1768

+ 85
- 80
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp Parādīt failu

@@ -55,97 +55,102 @@
55 55
 
56 56
 #ifdef TARGET_LPC1768
57 57
 
58
-  #include <U8glib.h>
59
-  #include "SoftwareSPI.h"
60
-  #include "../Delay.h"
58
+#include "../../inc/MarlinConfigPre.h"
61 59
 
62
-  #define SPI_SPEED 3  // About 1 MHz
60
+#if ENABLED(DOGLCD)
63 61
 
64
-  static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
65
-  static uint8_t SPI_speed = 0;
66
-  static uint8_t rs_last_state = 255;
62
+#include <U8glib.h>
63
+#include "SoftwareSPI.h"
64
+#include "../Delay.h"
67 65
 
68
-  static void u8g_com_LPC1768_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val)
69
-  {
70
-    uint8_t i;
66
+#define SPI_SPEED 3  // About 1 MHz
67
+
68
+static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL;
69
+static uint8_t SPI_speed = 0;
70
+static uint8_t rs_last_state = 255;
71 71
 
72
-    if ( rs != rs_last_state) {  // time to send a command/data byte
73
-      rs_last_state = rs;
72
+static void u8g_com_LPC1768_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
73
+  uint8_t i;
74 74
 
75
-      if ( rs == 0 )
76
-        /* command */
77
-        swSpiTransfer(0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
78
-      else
79
-         /* data */
80
-         swSpiTransfer(0x0FA, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
75
+  if (rs != rs_last_state) {  // time to send a command/data byte
76
+    rs_last_state = rs;
81 77
 
82
-      DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
83
-    }
78
+    if (rs == 0)
79
+      /* command */
80
+      swSpiTransfer(0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
81
+    else
82
+       /* data */
83
+       swSpiTransfer(0x0FA, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
84 84
 
85
-    swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
86
-    swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
85
+    DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
87 86
   }
88 87
 
89
-  uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
88
+  swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
89
+  swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL);
90
+}
91
+
92
+uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
93
+{
94
+  switch(msg)
90 95
   {
91
-    switch(msg)
92
-    {
93
-      case U8G_COM_MSG_INIT:
94
-        SCK_pin_ST7920_HAL = u8g->pin_list[U8G_PI_SCK];
95
-        MOSI_pin_ST7920_HAL_HAL = u8g->pin_list[U8G_PI_MOSI];
96
-
97
-        u8g_SetPIOutput(u8g, U8G_PI_CS);
98
-        u8g_SetPIOutput(u8g, U8G_PI_SCK);
99
-        u8g_SetPIOutput(u8g, U8G_PI_MOSI);
100
-        u8g_Delay(5);
101
-
102
-        SPI_speed = swSpiInit(SPI_SPEED, SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL);
103
-
104
-        u8g_SetPILevel(u8g, U8G_PI_CS, 0);
105
-        u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
106
-        u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
107
-
108
-        u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
109
-        break;
110
-
111
-      case U8G_COM_MSG_STOP:
112
-        break;
113
-
114
-      case U8G_COM_MSG_RESET:
115
-         if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
116
-        break;
117
-
118
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
119
-        u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
120
-        break;
121
-
122
-      case U8G_COM_MSG_CHIP_SELECT:
123
-        if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS]) u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
124
-        break;
125
-
126
-      case U8G_COM_MSG_WRITE_BYTE:
127
-        u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
128
-        break;
129
-
130
-      case U8G_COM_MSG_WRITE_SEQ: {
131
-          uint8_t *ptr = (uint8_t*) arg_ptr;
132
-          while (arg_val > 0) {
133
-            u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
134
-            arg_val--;
135
-          }
96
+    case U8G_COM_MSG_INIT:
97
+      SCK_pin_ST7920_HAL = u8g->pin_list[U8G_PI_SCK];
98
+      MOSI_pin_ST7920_HAL_HAL = u8g->pin_list[U8G_PI_MOSI];
99
+
100
+      u8g_SetPIOutput(u8g, U8G_PI_CS);
101
+      u8g_SetPIOutput(u8g, U8G_PI_SCK);
102
+      u8g_SetPIOutput(u8g, U8G_PI_MOSI);
103
+      u8g_Delay(5);
104
+
105
+      SPI_speed = swSpiInit(SPI_SPEED, SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL);
106
+
107
+      u8g_SetPILevel(u8g, U8G_PI_CS, 0);
108
+      u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
109
+      u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
110
+
111
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
112
+      break;
113
+
114
+    case U8G_COM_MSG_STOP:
115
+      break;
116
+
117
+    case U8G_COM_MSG_RESET:
118
+       if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
119
+      break;
120
+
121
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
122
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
123
+      break;
124
+
125
+    case U8G_COM_MSG_CHIP_SELECT:
126
+      if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS]) u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
127
+      break;
128
+
129
+    case U8G_COM_MSG_WRITE_BYTE:
130
+      u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
131
+      break;
132
+
133
+    case U8G_COM_MSG_WRITE_SEQ: {
134
+        uint8_t *ptr = (uint8_t*) arg_ptr;
135
+        while (arg_val > 0) {
136
+          u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
137
+          arg_val--;
136 138
         }
137
-        break;
138
-
139
-        case U8G_COM_MSG_WRITE_SEQ_P: {
140
-          uint8_t *ptr = (uint8_t*) arg_ptr;
141
-          while (arg_val > 0) {
142
-            u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
143
-            arg_val--;
144
-          }
139
+      }
140
+      break;
141
+
142
+      case U8G_COM_MSG_WRITE_SEQ_P: {
143
+        uint8_t *ptr = (uint8_t*) arg_ptr;
144
+        while (arg_val > 0) {
145
+          u8g_com_LPC1768_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
146
+          arg_val--;
145 147
         }
146
-        break;
147
-    }
148
-    return 1;
148
+      }
149
+      break;
149 150
   }
151
+  return 1;
152
+}
153
+
154
+#endif // DOGLCD
150 155
 
151
-#endif  //TARGET_LPC1768
156
+#endif // TARGET_LPC1768

+ 6
- 0
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp Parādīt failu

@@ -55,6 +55,10 @@
55 55
 
56 56
 #ifdef TARGET_LPC1768
57 57
 
58
+#include "../../inc/MarlinConfigPre.h"
59
+
60
+#if ENABLED(DOGLCD)
61
+
58 62
 #include <U8glib.h>
59 63
 #include "SoftwareSPI.h"
60 64
 
@@ -120,4 +124,6 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
120 124
   return 1;
121 125
 }
122 126
 
127
+#endif // DOGLCD
128
+
123 129
 #endif // TARGET_LPC1768

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp Parādīt failu

@@ -65,7 +65,7 @@
65 65
  * beginning.
66 66
  */
67 67
 
68
-#include "../../inc/MarlinConfig.h"
68
+#include "../../inc/MarlinConfigPre.h"
69 69
 
70 70
 #if ENABLED(DOGLCD)
71 71
 

+ 26
- 27
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp Parādīt failu

@@ -67,43 +67,43 @@
67 67
 
68 68
 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
69 69
 static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
70
-   U8G_ESC_CS(0),       // disable chip
71
-    U8G_ESC_ADR(0),     // instruction mode
72
-    U8G_ESC_CS(1),      // enable chip
73
-    U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
70
+  U8G_ESC_CS(0),       // disable chip
71
+  U8G_ESC_ADR(0),     // instruction mode
72
+  U8G_ESC_CS(1),      // enable chip
73
+  U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
74 74
 
75
-    0x0A2,              // 0x0A2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
76
-    0x0A0,              // Normal ADC Select (according to Displaytech 64128N datasheet)
75
+  0x0A2,              // 0x0A2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
76
+  0x0A0,              // Normal ADC Select (according to Displaytech 64128N datasheet)
77 77
 
78
-    0x0C8,              // common output mode: set scan direction normal operation/SHL Select, 0x0C0 --> SHL = 0, normal, 0x0C8 --> SHL = 1
79
-    0x040,              // Display start line for Displaytech 64128N
78
+  0x0C8,              // common output mode: set scan direction normal operation/SHL Select, 0x0C0 --> SHL = 0, normal, 0x0C8 --> SHL = 1
79
+  0x040,              // Display start line for Displaytech 64128N
80 80
 
81
-    0x028 | 0x04,       // power control: turn on voltage converter
82
-    U8G_ESC_DLY(50),    // delay 50 ms
81
+  0x028 | 0x04,       // power control: turn on voltage converter
82
+  U8G_ESC_DLY(50),    // delay 50 ms
83 83
 
84
-    0x028 | 0x06,       // power control: turn on voltage regulator
85
-    U8G_ESC_DLY(50),    // delay 50 ms
84
+  0x028 | 0x06,       // power control: turn on voltage regulator
85
+  U8G_ESC_DLY(50),    // delay 50 ms
86 86
 
87
-    0x028 | 0x07,       // power control: turn on voltage follower
88
-    U8G_ESC_DLY(50),    // delay 50 ms
87
+  0x028 | 0x07,       // power control: turn on voltage follower
88
+  U8G_ESC_DLY(50),    // delay 50 ms
89 89
 
90
-    0x010,              // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
90
+  0x010,              // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
91 91
 
92
-    0x0A6,              // display normal, bit val 0: LCD pixel off.
92
+  0x0A6,              // display normal, bit val 0: LCD pixel off.
93 93
 
94
-    0x081,              // set contrast
95
-    0x01E,              // Contrast value. Setting for controlling brightness of Displaytech 64128N
94
+  0x081,              // set contrast
95
+  0x01E,              // Contrast value. Setting for controlling brightness of Displaytech 64128N
96 96
 
97 97
 
98
-    0x0AF,              // display on
98
+  0x0AF,              // display on
99 99
 
100
-    U8G_ESC_DLY(100),   // delay 100 ms
101
-    0x0A5,              // display all points, ST7565
102
-    U8G_ESC_DLY(100),   // delay 100 ms
103
-    U8G_ESC_DLY(100),   // delay 100 ms
104
-    0x0A4,              // normal display
105
-    U8G_ESC_CS(0),      // disable chip
106
-    U8G_ESC_END         // end of sequence
100
+  U8G_ESC_DLY(100),   // delay 100 ms
101
+  0x0A5,              // display all points, ST7565
102
+  U8G_ESC_DLY(100),   // delay 100 ms
103
+  U8G_ESC_DLY(100),   // delay 100 ms
104
+  0x0A4,              // normal display
105
+  U8G_ESC_CS(0),      // disable chip
106
+  U8G_ESC_END         // end of sequence
107 107
 };
108 108
 
109 109
 static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
@@ -211,7 +211,6 @@ uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
211 211
   return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
212 212
 }
213 213
 
214
-
215 214
 U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
216 215
 
217 216
 uint8_t u8g_dev_st7565_64128n_HAL_2x_buf[WIDTH*2] U8G_NOCOMMON ;

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp Parādīt failu

@@ -53,7 +53,7 @@
53 53
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 54
  */
55 55
 
56
-#include "../../inc/MarlinConfig.h"
56
+#include "../../inc/MarlinConfigPre.h"
57 57
 
58 58
 #if ENABLED(DOGLCD)
59 59
 

+ 5
- 9
Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp Parādīt failu

@@ -57,7 +57,7 @@
57 57
 
58 58
 */
59 59
 
60
-#include "../../inc/MarlinConfig.h"
60
+#include "../../inc/MarlinConfigPre.h"
61 61
 
62 62
 #if ENABLED(DOGLCD)
63 63
 
@@ -108,10 +108,8 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
108 108
   U8G_ESC_END                /* end of sequence */
109 109
 };
110 110
 
111
-uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
112
-{
113
-  switch(msg)
114
-  {
111
+uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
112
+  switch(msg) {
115 113
     case U8G_DEV_MSG_INIT:
116 114
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
117 115
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);
@@ -140,10 +138,8 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
140 138
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
141 139
 }
142 140
 
143
-uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
144
-{
145
-  switch(msg)
146
-  {
141
+uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
142
+  switch(msg) {
147 143
     case U8G_DEV_MSG_INIT:
148 144
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
149 145
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);

+ 2
- 1
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp Parādīt failu

@@ -24,12 +24,13 @@
24 24
 // file u8g_dev_st7920_128x64_HAL.cpp for the HAL version.
25 25
 
26 26
 #include "../../inc/MarlinConfig.h"
27
-#include "../../HAL/Delay.h"
28 27
 
29 28
 #if ENABLED(U8GLIB_ST7920)
30 29
 
31 30
 #if !(defined(U8G_HAL_LINKS) || defined(__SAM3X8E__))
32 31
 
32
+#include "../../HAL/Delay.h"
33
+
33 34
 #define ST7920_CLK_PIN  LCD_PINS_D4
34 35
 #define ST7920_DAT_PIN  LCD_PINS_ENABLE
35 36
 #define ST7920_CS_PIN   LCD_PINS_RS

+ 5
- 8
Marlin/src/lcd/lcdprint_u8g.cpp Parādīt failu

@@ -8,11 +8,8 @@
8 8
  */
9 9
 
10 10
 #include "../inc/MarlinConfigPre.h"
11
-#include "../inc/MarlinConfig.h"
12 11
 
13
-#define USE_LCDPRINT_U8G ENABLED(ULTRA_LCD) && ENABLED(DOGLCD)
14
-
15
-#if USE_LCDPRINT_U8G
12
+#if ENABLED(DOGLCD)
16 13
 
17 14
 #include <U8glib.h>
18 15
 extern U8GLIB *pu8g;
@@ -72,9 +69,9 @@ int lcd_put_u8str_max_rom(const char * utf8_str_P, pixel_len_t max_length) {
72 69
   return ret;
73 70
 }
74 71
 
75
-#else // !USE_LCDPRINT_U8G
72
+#else // !ULTRA_LCD
76 73
 
77
-#define _lcd_write(a) TRACE("Write LCD: %c (%d)", (a), (int)(a));
78
-#define _lcd_setcursor(col, row) TRACE("Set cursor LCD: (%d,%d)", (col), (row));
74
+  #define _lcd_write(a) TRACE("Write LCD: %c (%d)", (a), (int)(a));
75
+  #define _lcd_setcursor(col, row) TRACE("Set cursor LCD: (%d,%d)", (col), (row));
79 76
 
80
-#endif // !USE_LCDPRINT_U8G
77
+#endif // !ULTRA_LCD

Notiek ielāde…
Atcelt
Saglabāt