Bläddra i källkod

Enable RRDFGSC on Due

Bob-the-Kuhn 6 år sedan
förälder
incheckning
a142fab155

+ 212
- 0
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp Visa fil

@@ -0,0 +1,212 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/*
24
+
25
+  based on u8g_com_st7920_hw_spi.c
26
+
27
+  Universal 8bit Graphics Library
28
+
29
+  Copyright (c) 2011, olikraus@gmail.com
30
+  All rights reserved.
31
+
32
+  Redistribution and use in source and binary forms, with or without modification,
33
+  are permitted provided that the following conditions are met:
34
+
35
+  * Redistributions of source code must retain the above copyright notice, this list
36
+    of conditions and the following disclaimer.
37
+
38
+  * Redistributions in binary form must reproduce the above copyright notice, this
39
+    list of conditions and the following disclaimer in the documentation and/or other
40
+    materials provided with the distribution.
41
+
42
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
43
+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
44
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
45
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46
+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
47
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
49
+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
50
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
51
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
52
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
54
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55
+
56
+*/
57
+
58
+#ifdef __SAM3X8E__
59
+
60
+  #include <U8glib.h>
61
+  #include <Arduino.h>
62
+  #include "../../core/macros.h"
63
+
64
+
65
+  void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
66
+     PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
67
+       g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
68
+  }
69
+
70
+
71
+  void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
72
+    volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
73
+    uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
74
+    if (level) port->PIO_SODR = mask;
75
+    else port->PIO_CODR = mask;
76
+  }
77
+
78
+
79
+#define nop() __asm__ __volatile__("nop;\n\t":::)
80
+
81
+void __delay_4cycles(uint32_t cy) __attribute__ ((weak));
82
+FORCE_INLINE void __delay_4cycles(uint32_t cy) { // +1 cycle
83
+  #if ARCH_PIPELINE_RELOAD_CYCLES<2
84
+    #define EXTRA_NOP_CYCLES "nop"
85
+  #else
86
+    #define EXTRA_NOP_CYCLES ""
87
+  #endif
88
+
89
+  __asm__ __volatile__(
90
+    ".syntax unified" "\n\t" // is to prevent CM0,CM1 non-unified syntax
91
+
92
+    "loop%=:" "\n\t"
93
+    " subs %[cnt],#1" "\n\t"
94
+    EXTRA_NOP_CYCLES "\n\t"
95
+    " bne loop%=" "\n\t"
96
+    : [cnt]"+r"(cy) // output: +r means input+output
97
+    : // input:
98
+    : "cc" // clobbers:
99
+  );
100
+}
101
+
102
+  Pio *SCK_pPio, *MOSI_pPio;
103
+  uint32_t SCK_dwMask, MOSI_dwMask;
104
+
105
+  static void spiSend_sw_DUE(uint8_t val)  // 800KHz
106
+  {
107
+    for (uint8_t i = 0; i < 8; i++) {
108
+      if (val & 0x80)
109
+        MOSI_pPio->PIO_SODR = MOSI_dwMask;
110
+      else
111
+        MOSI_pPio->PIO_CODR = MOSI_dwMask;
112
+      val = val << 1;
113
+      __delay_4cycles(2);
114
+      SCK_pPio->PIO_SODR = SCK_dwMask;
115
+      __delay_4cycles(22);
116
+      SCK_pPio->PIO_CODR = SCK_dwMask;
117
+    }
118
+  }
119
+
120
+  static uint8_t rs_last_state = 255;
121
+
122
+  static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val)
123
+  {
124
+    uint8_t i;
125
+
126
+    if ( rs != rs_last_state) {  // time to send a command/data byte
127
+      rs_last_state = rs;
128
+
129
+      if ( rs == 0 )
130
+        /* command */
131
+        spiSend_sw_DUE(0x0f8);
132
+      else
133
+         /* data */
134
+        spiSend_sw_DUE(0x0fa);
135
+
136
+      for( i = 0; i < 4; i++ )   // give the controller some time to process the data
137
+        u8g_10MicroDelay();      // 2 is bad, 3 is OK, 4 is safe
138
+    }
139
+
140
+    spiSend_sw_DUE(val & 0x0f0);
141
+    spiSend_sw_DUE(val << 4);
142
+  }
143
+
144
+
145
+  uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
146
+  {
147
+    switch(msg)
148
+    {
149
+      case U8G_COM_MSG_INIT:
150
+        SCK_pPio = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].pPort;
151
+        SCK_dwMask = g_APinDescription[u8g->pin_list[U8G_PI_SCK]].ulPin;
152
+        MOSI_pPio = g_APinDescription[u8g->pin_list[U8G_PI_MOSI]].pPort;
153
+        MOSI_dwMask = g_APinDescription[u8g->pin_list[U8G_PI_MOSI]].ulPin;
154
+
155
+        u8g_SetPILevel_DUE(u8g, U8G_PI_CS, 0);
156
+        u8g_SetPIOutput_DUE(u8g, U8G_PI_CS);
157
+        u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0);
158
+        u8g_SetPIOutput_DUE(u8g, U8G_PI_SCK);
159
+        u8g_SetPILevel_DUE(u8g, U8G_PI_MOSI, 0);
160
+        u8g_SetPILevel_DUE(u8g, U8G_PI_MOSI, 1);
161
+        u8g_SetPIOutput_DUE(u8g, U8G_PI_MOSI);
162
+        u8g_Delay(5);
163
+        u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
164
+        break;
165
+
166
+      case U8G_COM_MSG_STOP:
167
+        break;
168
+
169
+      case U8G_COM_MSG_RESET:
170
+         if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel_DUE(u8g, U8G_PI_RESET, arg_val);
171
+        break;
172
+
173
+      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
174
+        u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
175
+        break;
176
+
177
+      case U8G_COM_MSG_CHIP_SELECT:
178
+        if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS])
179
+          u8g_SetPILevel_DUE(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
180
+        break;
181
+
182
+      case U8G_COM_MSG_WRITE_BYTE:
183
+
184
+        u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], arg_val);
185
+        break;
186
+
187
+      case U8G_COM_MSG_WRITE_SEQ:
188
+        {
189
+          uint8_t *ptr = (uint8_t*) arg_ptr;
190
+          while( arg_val > 0 )
191
+          {
192
+            u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
193
+            arg_val--;
194
+          }
195
+        }
196
+        break;
197
+
198
+        case U8G_COM_MSG_WRITE_SEQ_P:
199
+        {
200
+          uint8_t *ptr = (uint8_t*) arg_ptr;
201
+          while( arg_val > 0 )
202
+          {
203
+            u8g_com_DUE_st7920_write_byte_sw_spi(u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
204
+            arg_val--;
205
+          }
206
+        }
207
+        break;
208
+    }
209
+    return 1;
210
+  }
211
+#pragma GCC reset_options
212
+#endif  //ARDUINO_ARCH_SAM

+ 0
- 8
Marlin/src/lcd/dogm/HAL_LCD_class_defines.h Visa fil

@@ -62,14 +62,6 @@ class U8GLIB_ST7920_128X64_RRD : public U8GLIB
62 62
 };
63 63
 
64 64
 
65
-extern u8g_dev_t u8g_dev_st7920_128x64_custom_sw_spi;
66
-class U8GLIB_ST7920_128X64_CUSTOM_SW_SPI : public U8GLIB {
67
-  public:
68
-    U8GLIB_ST7920_128X64_CUSTOM_SW_SPI()
69
-    : U8GLIB(&u8g_dev_st7920_128x64_custom_sw_spi)
70
-    {  }
71
-};
72
-
73 65
 extern u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire;
74 66
 class U8GLIB_SH1106_128X64_2X_I2C_2_WIRE : public U8GLIB {
75 67
   public:

+ 7
- 2
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h Visa fil

@@ -31,8 +31,13 @@
31 31
   uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
32 32
   #define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn
33 33
 
34
-  uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
35
-  #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
34
+  #ifdef __SAM3X8E__
35
+    uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
36
+    #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn
37
+  #else
38
+    uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
39
+    #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
40
+  #endif
36 41
 
37 42
   uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
38 43
   #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn

+ 0
- 276
Marlin/src/lcd/dogm/u8g_dev_st7920_128_64_sw_spi.cpp Visa fil

@@ -1,276 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-/*
24
- * PLEASE NOTE >>>
25
- *  We need our custom implementation for Software SPI, as the default implementation
26
- * of U8GLIB, when running in an ARM based board, is too fast and the display will not
27
- * recognize commands and/or data at such speeds. This implementation autoderives the
28
- * required delays to get the maximum possible performance by using the F_CPU macro that
29
- * specifies the CPU speed. According to the ST7920 datasheet, the maximum SCLK is 1MHz.
30
- */
31
-
32
-#ifndef ULCDST7920_SWSPI_H
33
-#define ULCDST7920_SWSPI_H
34
-
35
-#include "../../inc/MarlinConfig.h"
36
-
37
-#if ENABLED(U8GLIB_ST7920)
38
-
39
-#include <U8glib.h>
40
-#include "HAL_LCD_com_defines.h"
41
-
42
-#define ST7920_CLK_PIN  LCD_PINS_D4
43
-#define ST7920_DAT_PIN  LCD_PINS_ENABLE
44
-#define ST7920_CS_PIN   LCD_PINS_RS
45
-
46
-//#define PAGE_HEIGHT 8   //128 byte framebuffer
47
-#define PAGE_HEIGHT 16    //256 byte framebuffer
48
-//#define PAGE_HEIGHT 32  //512 byte framebuffer
49
-
50
-#define LCD_PIXEL_WIDTH 128
51
-#define LCD_PIXEL_HEIGHT 64
52
-
53
-//set optimization so ARDUINO optimizes this file
54
-#pragma GCC optimize (3)
55
-
56
-/* ---------------- Delay Cycles routine -------------- */
57
-
58
-#ifdef __arm__
59
-/* https://blueprints.launchpad.net/gcc-arm-embedded/+spec/delay-cycles */
60
-
61
-#define nop() __asm__ __volatile__("nop;\n\t":::)
62
-
63
-FORCE_INLINE static void __delay_4cycles(uint32_t cy) { // +1 cycle
64
-  #if ARCH_PIPELINE_RELOAD_CYCLES<2
65
-    #define EXTRA_NOP_CYCLES "nop"
66
-  #else
67
-    #define EXTRA_NOP_CYCLES ""
68
-  #endif
69
-
70
-  __asm__ __volatile__(
71
-    ".syntax unified" "\n\t" // is to prevent CM0,CM1 non-unified syntax
72
-
73
-    "loop%=:" "\n\t"
74
-    " subs %[cnt],#1" "\n\t"
75
-    EXTRA_NOP_CYCLES "\n\t"
76
-    " bne loop%=" "\n\t"
77
-    : [cnt]"+r"(cy) // output: +r means input+output
78
-    : // input:
79
-    : "cc" // clobbers:
80
-  );
81
-}
82
-
83
-FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
84
-
85
-  if (__builtin_constant_p(x)) {
86
-
87
-    #define MAXNOPS 4
88
-
89
-    if (x <= (MAXNOPS)) {
90
-      switch(x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); }
91
-    }
92
-    else { // because of +1 cycle inside delay_4cycles
93
-      const uint32_t rem = (x - 1) % (MAXNOPS);
94
-      switch(rem) { case 3: nop(); case 2: nop(); case 1: nop(); }
95
-      if ((x = (x - 1) / (MAXNOPS)))
96
-        __delay_4cycles(x); // if need more then 4 nop loop is more optimal
97
-    }
98
-  }
99
-  else
100
-    __delay_4cycles(x / 4);
101
-  }
102
-
103
-#ifdef __TEST_DELAY
104
-
105
-  void calibrateTimer() {
106
-
107
-    // Use DWT to calibrate cycles
108
-    uint32_t count = 0;
109
-
110
-    // addresses of registers
111
-    volatile uint32_t *DWT_CONTROL = (uint32_t *)0xE0001000,
112
-                      *DWT_CYCCNT = (uint32_t *)0xE0001004,
113
-                      *DEMCR = (uint32_t *)0xE000EDFC;
114
-
115
-    cli();
116
-
117
-    // enable the use DWT
118
-    *DEMCR = *DEMCR | 0x01000000;
119
-
120
-    // Reset cycle counter
121
-    *DWT_CYCCNT = 0;
122
-
123
-    // enable cycle counter
124
-    *DWT_CONTROL = *DWT_CONTROL | 1;
125
-
126
-    // Perform a delay of 10000 cycles
127
-    DELAY_CYCLES(10000U);
128
-
129
-    // number of cycles stored in count variable
130
-    count = *DWT_CYCCNT;
131
-
132
-    sei();
133
-
134
-    SERIAL_ECHO_START();
135
-    SERIAL_ECHOLNPAIR("calibrated Cycles: ", (int)count);
136
-  }
137
-
138
-#endif // __TEST_DELAY
139
-
140
-#elif defined(__AVR__)
141
-  #define DELAY_CYCLES(cycles) __builtin_avr_delay_cycles(cycles)
142
-#else
143
-  #error "DELAY_CYCLES not implemented for this architecture."
144
-#endif
145
-
146
-/* ---------------- Delay in nanoseconds and in microseconds */
147
-
148
-#define DELAY_NS(x) DELAY_CYCLES( (x) * (F_CPU/1000000) / 1000)
149
-#define DELAY_US(x) DELAY_CYCLES( (x) * (F_CPU/1000000))
150
-
151
-/* ---------------- ST7920 commands ------------------------ */
152
-
153
-#ifdef __arm__
154
-
155
-  /* ARM: Plain implementation is more than enough */
156
-  static void ST7920_SWSPI_SND_8BIT(uint8_t val) {
157
-    uint8_t n = 8;
158
-    do {
159
-      WRITE(ST7920_CLK_PIN, LOW);
160
-      WRITE(ST7920_DAT_PIN, val & 0x80);
161
-      DELAY_NS(700); /* RE-ARM requires 700ns to be stable, RAMPS4DUE works with 500ns */
162
-      WRITE(ST7920_CLK_PIN, HIGH);
163
-      DELAY_NS(700); /* RE-ARM requires 700ns to be stable, RAMPS4DUE works with 500ns */
164
-      val <<= 1;
165
-    } while (--n);
166
-  }
167
-
168
-#else // !ARM
169
-
170
-  /* AVR: Unrolling loop makes sense */
171
-  #define ST7920_SND_BIT(nr)              \
172
-    WRITE(ST7920_CLK_PIN, LOW);           \
173
-    WRITE(ST7920_DAT_PIN, TEST(val, nr)); \
174
-    DELAY_NS(700);                        \
175
-    WRITE(ST7920_CLK_PIN, HIGH);          \
176
-    DELAY_NS(700);
177
-
178
-  static void ST7920_SWSPI_SND_8BIT(const uint8_t val) {
179
-    ST7920_SND_BIT(7); // MSBit
180
-    ST7920_SND_BIT(6); //
181
-    ST7920_SND_BIT(5); //
182
-    ST7920_SND_BIT(4); //
183
-    ST7920_SND_BIT(3); //
184
-    ST7920_SND_BIT(2); //
185
-    ST7920_SND_BIT(1); //
186
-    ST7920_SND_BIT(0); // LSBit
187
-  }
188
-
189
-#endif // !ARM
190
-
191
-#define ST7920_CS()              { WRITE(ST7920_CS_PIN,1); DELAY_NS(200); }
192
-#define ST7920_NCS()             { WRITE(ST7920_CS_PIN,0); }
193
-#define ST7920_SET_CMD()         { ST7920_SWSPI_SND_8BIT(0xF8); DELAY_US(3); }
194
-#define ST7920_SET_DAT()         { ST7920_SWSPI_SND_8BIT(0xFA); DELAY_US(3); }
195
-#define ST7920_WRITE_BYTE(a)     { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u)); DELAY_US(3); }
196
-#define ST7920_WRITE_BYTES(p,l)  { for (uint8_t i = l + 1; --i;) { ST7920_SWSPI_SND_8BIT(*p&0xF0); ST7920_SWSPI_SND_8BIT(*p<<4); p++; } DELAY_US(3); }
197
-
198
-
199
-uint8_t u8g_dev_st7920_custom_sw_spi_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
200
-
201
-  uint8_t i, y;
202
-  switch (msg) {
203
-    case U8G_DEV_MSG_INIT: {
204
-
205
-      /* Set to output and write */
206
-      OUT_WRITE(ST7920_CS_PIN, LOW);
207
-      OUT_WRITE(ST7920_DAT_PIN, LOW);
208
-      OUT_WRITE(ST7920_CLK_PIN, HIGH);
209
-
210
-      ST7920_CS();
211
-      u8g_Delay(120);                //initial delay for boot up
212
-
213
-      ST7920_SET_CMD();
214
-      ST7920_WRITE_BYTE(0x08);       //display off, cursor+blink off
215
-      ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
216
-      u8g_Delay(15);                 //delay for CGRAM clear
217
-      ST7920_WRITE_BYTE(0x3E);       //extended mode + GDRAM active
218
-      for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM
219
-        ST7920_WRITE_BYTE(0x80 | y); //set y
220
-        ST7920_WRITE_BYTE(0x80);     //set x = 0
221
-        ST7920_SET_DAT();
222
-        for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments
223
-          ST7920_WRITE_BYTE(0);
224
-        ST7920_SET_CMD();
225
-      }
226
-
227
-      ST7920_WRITE_BYTE(0x0C);       //display on, cursor+blink off
228
-      ST7920_NCS();
229
-    }
230
-    break;
231
-
232
-    case U8G_DEV_MSG_STOP:
233
-      break;
234
-
235
-    case U8G_DEV_MSG_PAGE_NEXT: {
236
-      u8g_pb_t* pb = (u8g_pb_t*)(dev->dev_mem);
237
-      y = pb->p.page_y0;
238
-      uint8_t* ptr = (uint8_t*)pb->buf;
239
-
240
-      ST7920_CS();
241
-      for (i = 0; i < PAGE_HEIGHT; i ++) {
242
-        ST7920_SET_CMD();
243
-        if (y < 32) {
244
-          ST7920_WRITE_BYTE(0x80 | y);   //y
245
-          ST7920_WRITE_BYTE(0x80);       //x=0
246
-        }
247
-        else {
248
-          ST7920_WRITE_BYTE(0x80 | (y - 32)); //y
249
-          ST7920_WRITE_BYTE(0x80 | 8);   //x=64
250
-        }
251
-        ST7920_SET_DAT();
252
-        ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); //ptr is incremented inside of macro
253
-        y++;
254
-      }
255
-
256
-      ST7920_NCS();
257
-    }
258
-    break;
259
-  }
260
-  #if PAGE_HEIGHT == 8
261
-    return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
262
-  #elif PAGE_HEIGHT == 16
263
-    return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
264
-  #else
265
-    return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg);
266
-  #endif
267
-}
268
-
269
-static uint8_t   u8g_dev_st7920_128x64_custom_sw_spi_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U8G_NOCOMMON;
270
-static u8g_pb_t  u8g_dev_st7920_128x64_custom_sw_spi_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_custom_sw_spi_buf};
271
-u8g_dev_t u8g_dev_st7920_128x64_custom_sw_spi = {u8g_dev_st7920_custom_sw_spi_128x64_fn, &u8g_dev_st7920_128x64_custom_sw_spi_pb, &u8g_com_null_fn};
272
-
273
-#pragma GCC reset_options
274
-
275
-#endif // U8GLIB_ST7920
276
-#endif // ULCDST7920_SWSPI_H

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp Visa fil

@@ -199,7 +199,7 @@ U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev
199 199
 u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_HW_SPI };
200 200
 
201 201
 
202
-#ifdef U8G_HAL_LINKS
202
+#if defined(U8G_HAL_LINKS) || defined(__SAM3X8E__)
203 203
   // Also use this device for HAL version of rrd class. This results in the same device being used
204 204
   // for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.
205 205
   u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };

+ 1
- 1
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp Visa fil

@@ -27,7 +27,7 @@
27 27
 
28 28
 #if ENABLED(U8GLIB_ST7920)
29 29
 
30
-#ifndef U8G_HAL_LINKS
30
+#if !(defined(U8G_HAL_LINKS) || defined(__SAM3X8E__))
31 31
 
32 32
 #define ST7920_CLK_PIN  LCD_PINS_D4
33 33
 #define ST7920_DAT_PIN  LCD_PINS_ENABLE

+ 1
- 3
Marlin/src/lcd/ultralcd_impl_DOGM.h Visa fil

@@ -169,9 +169,6 @@
169 169
   #else
170 170
     U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card)
171 171
   #endif
172
-#elif ENABLED(U8GLIB_ST7920) && defined(__arm__)
173
-  // RepRap Discount Full Graphics Smart Controller on an ARM target
174
-    U8GLIB_ST7920_128X64_CUSTOM_SW_SPI u8g;
175 172
 
176 173
 #elif ENABLED(U8GLIB_ST7920)
177 174
   // RepRap Discount Full Graphics Smart Controller
@@ -190,6 +187,7 @@
190 187
   // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
191 188
     //U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);  // 8 stripes
192 189
     U8GLIB_LM6059_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
190
+    
193 191
 #elif ENABLED(U8GLIB_ST7565_64128N)
194 192
   // The MaKrPanel, Mini Viki, and Viki 2.0, ST7565 controller
195 193
     //U8GLIB_64128N_2X_HAL u8g(DOGLCD_CS, DOGLCD_A0);  // using HW-SPI

+ 1
- 0
platformio.ini Visa fil

@@ -95,6 +95,7 @@ framework   = arduino
95 95
 board       = due
96 96
 build_flags = ${common.build_flags} -I $BUILDSRC_DIR
97 97
 lib_deps    = ${common.lib_deps}
98
+lib_ignore  = TMC26XStepper
98 99
 src_filter  = ${common.default_src_filter}
99 100
 
100 101
 #

Laddar…
Avbryt
Spara