Przeglądaj źródła

Fix up various spacing, comments, and typos

Scott Lahteine 7 lat temu
rodzic
commit
ca577c1638

+ 2
- 2
Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp Wyświetl plik

@@ -93,11 +93,11 @@
93 93
       #define MAXNOPS 4
94 94
 
95 95
       if (x <= (MAXNOPS)) {
96
-        switch(x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); }
96
+        switch (x) { case 4: nop(); case 3: nop(); case 2: nop(); case 1: nop(); }
97 97
       }
98 98
       else { // because of +1 cycle inside delay_4cycles
99 99
         const uint32_t rem = (x - 1) % (MAXNOPS);
100
-        switch(rem) { case 3: nop(); case 2: nop(); case 1: nop(); }
100
+        switch (rem) { case 3: nop(); case 2: nop(); case 1: nop(); }
101 101
         if ((x = (x - 1) / (MAXNOPS)))
102 102
           __delay_4cycles(x); // if need more then 4 nop loop is more optimal
103 103
       }

+ 32
- 34
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp Wyświetl plik

@@ -20,40 +20,38 @@
20 20
  *
21 21
  */
22 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
-*/
23
+/**
24
+ * Based on u8g_com_st7920_hw_spi.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
57 55
 
58 56
 #ifdef ARDUINO_ARCH_SAM
59 57
 

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp Wyświetl plik

@@ -218,7 +218,7 @@ bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min /* = 1 */, uint32_t max /* =
218 218
   pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));  // Sometimes the upper byte is garbled
219 219
 
220 220
 ////  direct control PWM code
221
-  switch(pin) {
221
+  switch (pin) {
222 222
     case P1_23:                                       // MKS Sbase Servo 0, PWM1 channel 4  (J3-8 PWM1.4)
223 223
       direct_table[P1_23_PWM_channel - 1].min = min;
224 224
       direct_table[P1_23_PWM_channel - 1].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN);
@@ -298,7 +298,7 @@ bool LPC1768_PWM_detach_pin(pin_t pin) {
298 298
   pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));
299 299
 
300 300
 ////  direct control PWM code
301
-  switch(pin) {
301
+  switch (pin) {
302 302
     case P1_23:                                       // MKS Sbase Servo 0, PWM1 channel 4  (J3-8 PWM1.4)
303 303
       if (!direct_table[P1_23_PWM_channel - 1].assigned) return false;
304 304
       CBI(LPC_PWM1->PCR, 8 + P1_23_PWM_channel);      // disable PWM1 module control of this pin
@@ -373,7 +373,7 @@ bool LPC1768_PWM_write(pin_t pin, uint32_t value) {
373 373
   pin = GET_PIN_MAP_PIN(GET_PIN_MAP_INDEX(pin & 0xFF));
374 374
 
375 375
 ////  direct control PWM code
376
-  switch(pin) {
376
+  switch (pin) {
377 377
     case P1_23:                                                           // MKS Sbase Servo 0, PWM1 channel 4  (J3-8 PWM1.4)
378 378
       if (!direct_table[P1_23_PWM_channel - 1].assigned) return false;
379 379
       LPC_PWM1->PCR |=  _BV(8 + P1_23_PWM_channel); // enable PWM1 module control of this pin

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/arduino.cpp Wyświetl plik

@@ -70,7 +70,7 @@ extern "C" void delay(const int msec) {
70 70
 }
71 71
 
72 72
 // IO functions
73
-// As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2)
73
+// As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2)
74 74
 void pinMode(const pin_t pin, const uint8_t mode) {
75 75
   if (!VALID_PIN(pin)) return;
76 76
 

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.c Wyświetl plik

@@ -54,7 +54,7 @@ uint8_t LPC1768_PIN_PIN(const uint8_t pin);
54 54
 #endif
55 55
 
56 56
 // I/O functions
57
-// As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2)
57
+// As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2)
58 58
 void pinMode_LCD(uint8_t pin, uint8_t mode) {
59 59
   #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
60 60
   #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))

+ 105
- 112
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp Wyświetl plik

@@ -20,123 +20,116 @@
20 20
  *
21 21
  */
22 22
 
23
-
24
-/*
25
-
26
-  based on u8g_com_msp430_hw_spi.c
27
-
28
-  Universal 8bit Graphics Library
29
-
30
-  Copyright (c) 2012, olikraus@gmail.com
31
-  All rights reserved.
32
-
33
-  Redistribution and use in source and binary forms, with or without modification,
34
-  are permitted provided that the following conditions are met:
35
-
36
-  * Redistributions of source code must retain the above copyright notice, this list
37
-  of conditions and the following disclaimer.
38
-
39
-  * Redistributions in binary form must reproduce the above copyright notice, this
40
-  list of conditions and the following disclaimer in the documentation and/or other
41
-  materials provided with the distribution.
42
-
43
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
44
-  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
45
-  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
47
-  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
48
-  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
-  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
-  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
-  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55
-  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
-
57
-*/
58
-
23
+/**
24
+ * Based on u8g_com_msp430_hw_spi.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
59 55
 
60 56
 #ifdef TARGET_LPC1768
61 57
 
62
-  //#include <inttypes.h>
63
-
64
-  //#include "src/core/macros.h"
65
-  //#include "Configuration.h"
66
-
67
-  #include <U8glib.h>
68
-
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
-
83
-  uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
84
-  {
85
-    switch(msg)
86
-    {
87
-      case U8G_COM_MSG_STOP:
88
-        break;
89
-
90
-      case U8G_COM_MSG_INIT:
91
-        u8g_SetPILevel(u8g, U8G_PI_CS, 1);
92
-        u8g_SetPILevel(u8g, U8G_PI_A0, 1);
93
-        u8g_SetPILevel(u8g, U8G_PI_RESET, 1);
94
-        u8g_SetPIOutput(u8g, U8G_PI_CS);
95
-        u8g_SetPIOutput(u8g, U8G_PI_A0);
96
-        u8g_SetPIOutput(u8g, U8G_PI_RESET);
97
-        u8g_Delay(5);
98
-        spiBegin();
99
-        #ifndef SPI_SPEED
100
-          #define SPI_SPEED SPI_FULL_SPEED  // use same SPI speed as SD card
101
-        #endif
102
-        spiInit(SPI_SPEED);
103
-        break;
104
-
105
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
106
-        u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
107
-        break;
108
-
109
-      case U8G_COM_MSG_CHIP_SELECT:
110
-        u8g_SetPILevel(u8g, U8G_PI_CS, (arg_val ? 0 : 1));
111
-        break;
112
-
113
-      case U8G_COM_MSG_RESET:
114
-        u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
115
-        break;
116
-
117
-      case U8G_COM_MSG_WRITE_BYTE:
118
-        spiSend((uint8_t)arg_val);
119
-        break;
120
-
121
-      case U8G_COM_MSG_WRITE_SEQ: {
122
-          uint8_t *ptr = (uint8_t*) arg_ptr;
123
-          while (arg_val > 0) {
124
-            spiSend(*ptr++);
125
-            arg_val--;
126
-          }
58
+//#include <inttypes.h>
59
+
60
+//#include "src/core/macros.h"
61
+//#include "Configuration.h"
62
+
63
+#include <U8glib.h>
64
+
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
72
+
73
+void spiBegin();
74
+void spiInit(uint8_t spiRate);
75
+void spiSend(uint8_t b);
76
+void spiSend(const uint8_t* buf, size_t n);
77
+
78
+uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
79
+  switch (msg) {
80
+    case U8G_COM_MSG_STOP:
81
+      break;
82
+
83
+    case U8G_COM_MSG_INIT:
84
+      u8g_SetPILevel(u8g, U8G_PI_CS, 1);
85
+      u8g_SetPILevel(u8g, U8G_PI_A0, 1);
86
+      u8g_SetPILevel(u8g, U8G_PI_RESET, 1);
87
+      u8g_SetPIOutput(u8g, U8G_PI_CS);
88
+      u8g_SetPIOutput(u8g, U8G_PI_A0);
89
+      u8g_SetPIOutput(u8g, U8G_PI_RESET);
90
+      u8g_Delay(5);
91
+      spiBegin();
92
+      #ifndef SPI_SPEED
93
+        #define SPI_SPEED SPI_FULL_SPEED  // use same SPI speed as SD card
94
+      #endif
95
+      spiInit(SPI_SPEED);
96
+      break;
97
+
98
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
99
+      u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
100
+      break;
101
+
102
+    case U8G_COM_MSG_CHIP_SELECT:
103
+      u8g_SetPILevel(u8g, U8G_PI_CS, (arg_val ? 0 : 1));
104
+      break;
105
+
106
+    case U8G_COM_MSG_RESET:
107
+      u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
108
+      break;
109
+
110
+    case U8G_COM_MSG_WRITE_BYTE:
111
+      spiSend((uint8_t)arg_val);
112
+      break;
113
+
114
+    case U8G_COM_MSG_WRITE_SEQ: {
115
+        uint8_t *ptr = (uint8_t*) arg_ptr;
116
+        while (arg_val > 0) {
117
+          spiSend(*ptr++);
118
+          arg_val--;
127 119
         }
128
-        break;
129
-
130
-      case U8G_COM_MSG_WRITE_SEQ_P: {
131
-          uint8_t *ptr = (uint8_t*) arg_ptr;
132
-          while (arg_val > 0) {
133
-            spiSend(*ptr++);
134
-            arg_val--;
135
-          }
120
+      }
121
+      break;
122
+
123
+    case U8G_COM_MSG_WRITE_SEQ_P: {
124
+        uint8_t *ptr = (uint8_t*) arg_ptr;
125
+        while (arg_val > 0) {
126
+          spiSend(*ptr++);
127
+          arg_val--;
136 128
         }
137
-        break;
138
-    }
139
-    return 1;
129
+      }
130
+      break;
140 131
   }
132
+  return 1;
133
+}
141 134
 
142 135
 #endif  //TARGET_LPC1768

+ 82
- 95
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp Wyświetl plik

@@ -20,60 +20,60 @@
20 20
  *
21 21
  */
22 22
 
23
+/**
24
+ * Based on u8g_com_arduino_ssd_i2c.c
25
+ *
26
+ * COM interface for Arduino (AND ATmega) and the SSDxxxx chip (SOLOMON) variant
27
+ * I2C protocol
28
+ *
29
+ * ToDo: Rename this to u8g_com_avr_ssd_i2c.c
30
+ *
31
+ * Universal 8bit Graphics Library
32
+ *
33
+ * Copyright (c) 2011, olikraus@gmail.com
34
+ * All rights reserved.
35
+ *
36
+ * Redistribution and use in source and binary forms, with or without modification,
37
+ * are permitted provided that the following conditions are met:
38
+ *
39
+ *  * Redistributions of source code must retain the above copyright notice, this list
40
+ *    of conditions and the following disclaimer.
41
+ *
42
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
43
+ *    list of conditions and the following disclaimer in the documentation and/or other
44
+ *    materials provided with the distribution.
45
+ *
46
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
47
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
48
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
49
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
51
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
56
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
58
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59
+ */
23 60
 
24
-/*
25
-
26
-  based on u8g_com_arduino_ssd_i2c.c
27
-
28
-  com interface for arduino (AND atmega) and the SSDxxxx chip (SOLOMON) variant
29
-  I2C protocol
30
-
31
-  ToDo: Rename this to u8g_com_avr_ssd_i2c.c
32
-
33
-  Universal 8bit Graphics Library
34
-
35
-  Copyright (c) 2012, olikraus@gmail.com
36
-  All rights reserved.
37
-
38
-  Redistribution and use in source and binary forms, with or without modification,
39
-  are permitted provided that the following conditions are met:
40
-
41
-  * Redistributions of source code must retain the above copyright notice, this list
42
-  of conditions and the following disclaimer.
43
-
44
-  * Redistributions in binary form must reproduce the above copyright notice, this
45
-  list of conditions and the following disclaimer in the documentation and/or other
46
-  materials provided with the distribution.
47
-
48
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
49
-  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
50
-  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
51
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
52
-  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
53
-  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
55
-  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
57
-  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
58
-  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
59
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
60
-  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61
-
62
-  Special pin usage:
63
-  U8G_PI_I2C_OPTION additional options
64
-  U8G_PI_A0_STATE used to store the last value of the command/data register selection
65
-  U8G_PI_SET_A0   1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
66
-  U8G_PI_SCL    clock line (NOT USED)
67
-  U8G_PI_SDA    data line (NOT USED)
68
-
69
-  U8G_PI_RESET    reset line (currently disabled, see below)
70
-
71
-  Protocol:
72
-  SLA, Cmd/Data Selection, Arguments
73
-  The command/data register is selected by a special instruction byte, which is sent after SLA
74
-
75
-  The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
76
-*/
61
+/**
62
+ * Special pin usage:
63
+ * U8G_PI_I2C_OPTION additional options
64
+ * U8G_PI_A0_STATE used to store the last value of the command/data register selection
65
+ * U8G_PI_SET_A0   1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
66
+ * U8G_PI_SCL    clock line (NOT USED)
67
+ * U8G_PI_SDA    data line (NOT USED)
68
+ *
69
+ * U8G_PI_RESET    reset line (currently disabled, see below)
70
+ *
71
+ * Protocol:
72
+ * SLA, Cmd/Data Selection, Arguments
73
+ * The command/data register is selected by a special instruction byte, which is sent after SLA
74
+ *
75
+ * The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
76
+ */
77 77
 
78 78
 #ifdef TARGET_LPC1768
79 79
 
@@ -84,36 +84,27 @@
84 84
   #define I2C_CMD_MODE    0x000
85 85
   #define I2C_DATA_MODE   0x040
86 86
 
87
-//    #define U8G_I2C_OPT_FAST 16
87
+  //#define U8G_I2C_OPT_FAST 16
88 88
 
89
-  uint8_t  u8g_com_ssd_I2C_start_sequence(u8g_t *u8g)
90
-  {
89
+  uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) {
91 90
     /* are we requested to set the a0 state? */
92
-    if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
93
-      return 1;
91
+    if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
94 92
 
95 93
     /* setup bus, might be a repeated start */
96
-    if ( u8g_i2c_start(I2C_SLA) == 0 )
94
+    if (u8g_i2c_start(I2C_SLA) == 0)
97 95
       return 0;
98
-    if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
99
-    {
100
-      if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
101
-        return 0;
102
-    }
103
-    else
104
-    {
105
-      if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
106
-        return 0;
96
+    if (u8g->pin_list[U8G_PI_A0_STATE] == 0 ) {
97
+      if (u8g_i2c_send_byte(I2C_CMD_MODE) == 0) return 0;
107 98
     }
99
+    else if (u8g_i2c_send_byte(I2C_DATA_MODE) == 0)
100
+      return 0;
108 101
 
109 102
     u8g->pin_list[U8G_PI_SET_A0] = 0;
110
-      return 1;
103
+    return 1;
111 104
   }
112 105
 
113
-  uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
114
-  {
115
-    switch(msg)
116
-    {
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) {
117 108
       case U8G_COM_MSG_INIT:
118 109
         //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
119 110
         //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
@@ -134,34 +125,32 @@
134 125
       case U8G_COM_MSG_CHIP_SELECT:
135 126
         u8g->pin_list[U8G_PI_A0_STATE] = 0;
136 127
         u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again, also forces start condition */
137
-        if ( arg_val == 0 )
138
-        {
128
+        if (arg_val == 0 ) {
139 129
           /* disable chip, send stop condition */
140 130
           u8g_i2c_stop();
141 131
         }
142
-        else
143
-        {
132
+        else {
144 133
           /* enable, do nothing: any byte writing will trigger the i2c start */
145 134
         }
146 135
         break;
147 136
 
148 137
       case U8G_COM_MSG_WRITE_BYTE:
149 138
         //u8g->pin_list[U8G_PI_SET_A0] = 1;
150
-//          if ( u8g_com_arduino_ssd_start_sequence(u8g) == 0 )
151
-//            return u8g_i2c_stop(), 0;
152
-        if ( u8g_i2c_send_byte(arg_val) == 0 )
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)
153 142
           return u8g_i2c_stop(), 0;
154 143
         // u8g_i2c_stop();
155 144
         break;
156 145
 
157
-      case U8G_COM_MSG_WRITE_SEQ:
146
+      case U8G_COM_MSG_WRITE_SEQ: {
158 147
         //u8g->pin_list[U8G_PI_SET_A0] = 1;
159
-        if ( u8g_com_ssd_I2C_start_sequence(u8g) == 0 )
148
+        if (u8g_com_ssd_I2C_start_sequence(u8g) == 0)
160 149
           return u8g_i2c_stop(), 0;
161
-        {
150
+
162 151
           register uint8_t *ptr = (uint8_t *)arg_ptr;
163 152
           while (arg_val > 0) {
164
-            if ( u8g_i2c_send_byte(*ptr++) == 0 )
153
+            if (u8g_i2c_send_byte(*ptr++) == 0)
165 154
               return u8g_i2c_stop(), 0;
166 155
             arg_val--;
167 156
           }
@@ -169,14 +158,14 @@
169 158
         // u8g_i2c_stop();
170 159
         break;
171 160
 
172
-      case U8G_COM_MSG_WRITE_SEQ_P:
173
-        //u8g->pin_list[U8G_PI_SET_A0] = 1;
174
-        if ( u8g_com_ssd_I2C_start_sequence(u8g) == 0 )
175
-          return u8g_i2c_stop(), 0;
176
-        {
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
+
177 166
           register uint8_t *ptr = (uint8_t *)arg_ptr;
178 167
           while (arg_val > 0) {
179
-            if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
168
+            if (u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0)
180 169
               return 0;
181 170
             ptr++;
182 171
             arg_val--;
@@ -190,12 +179,10 @@
190 179
         u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again */
191 180
 
192 181
         u8g_i2c_start(0); // send slave address and write bit
193
-        if (arg_val)
194
-          u8g_i2c_send_byte(0x40);  // write to graphics DRAM mode
195
-        else
196
-          u8g_i2c_send_byte(0x80);  //command mode
182
+        u8g_i2c_send_byte(arg_val ? 0x40 : 0x80);  // Write to ? Graphics DRAM mode : Command mode
197 183
         break;
198
-    }
184
+
185
+    } // switch
199 186
     return 1;
200 187
   }
201 188
 

+ 138
- 170
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction Wyświetl plik

@@ -20,47 +20,44 @@
20 20
  *
21 21
  */
22 22
 
23
-/*  based on U8G2 code
24
-
25
-  u8x8_byte.c
26
-
27
-  Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
28
-
29
-  Copyright (c) 2016, 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
-*/
23
+/**
24
+ * Based on U8G2 code - u8x8_byte.c
25
+ *
26
+ * Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
27
+ *
28
+ * Copyright (c) 2016, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
58 55
 
59
-/*
60
-  software i2c,
61
-  ignores ACK response (which is anyway not provided by some displays)
62
-  also does not allow reading from the device
63
-*/
56
+/**
57
+ * Software i2c,
58
+ * ignores ACK response (which is anyway not provided by some displays)
59
+ * also does not allow reading from the device
60
+ */
64 61
 
65 62
 #ifdef TARGET_LPC1768
66 63
 
@@ -80,17 +77,13 @@ void delayMicroseconds(uint32_t us);
80 77
 //#define SPEED_400KHz 3
81 78
 //#define SPEED_100KHz 13
82 79
 
83
-
84 80
 //    #define U8G_I2C_OPT_FAST 16
85 81
 
86
-
87
-
88 82
 uint8_t SCL_pin_HAL_LPC1768_sw_I2C, SCL_port_HAL_LPC1768_sw_I2C, SDA_pin_HAL_LPC1768_sw_I2C, SDA_port_HAL_LPC1768_sw_I2C;
89 83
 
90 84
 #define SPI_SPEED 2  //20: 200KHz 5:750KHz 2:3-4MHz
91 85
 
92 86
 uint8_t u8g_i2c_send_byte_sw(uint8_t data) {
93
-{
94 87
   for (uint8_t i = 0; i < 9; i++) {   // 1 extra bit for the ack/nak
95 88
 
96 89
     if (val & 0x80)
@@ -118,14 +111,13 @@ uint8_t u8g_i2c_send_byte_sw(uint8_t data) {
118 111
       LPC_GPIO(SCL_port_HAL_LPC1768_sw_I2C)->FIOCLR = LPC_PIN(SCL_pin_HAL_LPC1768_sw_I2C);
119 112
       LPC_GPIO(SCL_port_HAL_LPC1768_sw_I2C)->FIOCLR = LPC_PIN(SCL_pin_HAL_LPC1768_sw_I2C);
120 113
     }
121
-    val = val << 1;
114
+    val <<= 1;
122 115
   }
123 116
   return 1;
124 117
 }
125 118
 
126 119
 
127 120
 uint8_t u8g_i2c_start_sw(uint8_t sla) {  // assert start condition and then send slave address with write bit
128
-{
129 121
   /* send the start condition, both lines go from 1 to 0 */
130 122
 
131 123
   LPC_GPIO(SDA_port_HAL_LPC1768_sw_I2C)->FIOCLR = LPC_PIN(SDA_pin_HAL_LPC1768_sw_I2C);
@@ -143,139 +135,115 @@ uint8_t u8g_i2c_start_sw(uint8_t sla) {  // assert start condition and then send
143 135
 }
144 136
 
145 137
 
146
-void u8g_i2c_stop_sw(void) {
147
-}
138
+void u8g_i2c_stop_sw(void) { }
148 139
 
149
-void u8g_i2c_init_sw(uint8_t clock_option) {
150
-  u8g_i2c_start(0); // send slave address and write bit
151
-}
140
+void u8g_i2c_init_sw(uint8_t clock_option) { u8g_i2c_start(0); } // send slave address and write bit
152 141
 
142
+uint8_t  u8g_com_ssd_I2C_start_sequence_sw(u8g_t *u8g) {
143
+  /* are we requested to set the a0 state? */
144
+  if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1;
153 145
 
146
+  /* setup bus, might be a repeated start */
147
+  if (u8g_i2c_start(I2C_SLA) == 0) return 0;
148
+  if (u8g->pin_list[U8G_PI_A0_STATE] == 0) {
149
+    if (u8g_i2c_send_byte(I2C_CMD_MODE) == 0) return 0;
150
+  }
151
+  else if (u8g_i2c_send_byte(I2C_DATA_MODE) == 0) return 0;
154 152
 
155
-  uint8_t  u8g_com_ssd_I2C_start_sequence_sw(u8g_t *u8g)
156
-  {
157
-    /* are we requested to set the a0 state? */
158
-    if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
159
-      return 1;
153
+  u8g->pin_list[U8G_PI_SET_A0] = 0;
160 154
 
161
-    /* setup bus, might be a repeated start */
162
-    if ( u8g_i2c_start(I2C_SLA) == 0 )
163
-      return 0;
164
-    if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
165
-    {
166
-      if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
167
-        return 0;
168
-    }
169
-    else
170
-    {
171
-      if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
172
-        return 0;
173
-    }
174
-
175
-    u8g->pin_list[U8G_PI_SET_A0] = 0;
176
-      return 1;
177
-  }
155
+  return 1;
156
+}
178 157
 
179
-  uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
180
-  {
181
-    switch(msg)
182
-    {
183
-      case U8G_COM_MSG_INIT:
184
-
185
-        #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
186
-        #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
187
-        SCL_pin_HAL_LPC1768_sw_I2C = LPC1768_PIN_PIN(u8g->pin_list[U8G_PI_SCL]);
188
-        SCL_port_HAL_LPC1768_sw_I2C = LPC1768_PIN_PORT(u8g->pin_list[U8G_PI_SCL]);
189
-        SDA_pin_HAL_LPC1768_sw_I2C = LPC1768_PIN_PIN(u8g->pin_list[U8G_PI_SDA]);
190
-        SDA_port_HAL_LPC1768_sw_I2C = LPC1768_PIN_PORT(u8g->pin_list[U8G_PI_SDA]);
191
-        // As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2)
192
-        #define OUPUT 0x1
193
-        u8g_SetPIOutput(u8g, U8G_PI_SCL);
194
-        u8g_SetPIOutput(u8g, U8G_PI_SDA);
195
-        if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS])  u8g_SetPIOutput(u8g, U8G_PI_CS);
196
-        if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_A0])  u8g_SetPIOutput(u8g, U8G_PI_A0);
197
-        if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET])  u8g_SetPIOutput(u8g, U8G_PI_RESET);
198
-
199
-        //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
200
-        //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
201
-        //u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: unknown mode */
202
-
203
-        u8g_i2c_init_sw(u8g->pin_list[U8G_PI_I2C_OPTION]);
204
-        u8g_com_ssd_I2C_start_sequence_sw((u8g);
205
-        break;
206
-
207
-      case U8G_COM_MSG_STOP:
208
-        break;
209
-
210
-      case U8G_COM_MSG_RESET:
211
-        break;
212
-
213
-      case U8G_COM_MSG_CHIP_SELECT:
214
-        u8g->pin_list[U8G_PI_A0_STATE] = 0;
215
-        u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again, also forces start condition */
216
-        if ( arg_val == 0 )
217
-        {
218
-          /* disable chip, send stop condition */
219
-          u8g_i2c_stop_sw();
220
-        }
221
-        else
222
-        {
223
-          /* enable, do nothing: any byte writing will trigger the i2c start */
224
-        }
225
-        break;
226
-
227
-      case U8G_COM_MSG_WRITE_BYTE:
228
-        //u8g->pin_list[U8G_PI_SET_A0] = 1;
229
-//          if ( u8g_com_arduino_ssd_start_sequence(u8g) == 0 )
230
-//            return u8g_i2c_stop(), 0;
231
-        if ( u8g_i2c_send_byte_sw(arg_val) == 0 )
232
-          return u8g_i2c_stop_sw(), 0;
158
+uint8_t u8g_com_HAL_LPC1768_ssd_sw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
159
+  switch (msg) {
160
+    case U8G_COM_MSG_INIT:
161
+
162
+      #define LPC1768_PIN_PORT(pin) ((uint8_t)((pin >> 5) & 0b111))
163
+      #define LPC1768_PIN_PIN(pin) ((uint8_t)(pin & 0b11111))
164
+      SCL_pin_HAL_LPC1768_sw_I2C = LPC1768_PIN_PIN(u8g->pin_list[U8G_PI_SCL]);
165
+      SCL_port_HAL_LPC1768_sw_I2C = LPC1768_PIN_PORT(u8g->pin_list[U8G_PI_SCL]);
166
+      SDA_pin_HAL_LPC1768_sw_I2C = LPC1768_PIN_PIN(u8g->pin_list[U8G_PI_SDA]);
167
+      SDA_port_HAL_LPC1768_sw_I2C = LPC1768_PIN_PORT(u8g->pin_list[U8G_PI_SDA]);
168
+      // As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2)
169
+      #define OUTPUT 0x1
170
+      u8g_SetPIOutput(u8g, U8G_PI_SCL);
171
+      u8g_SetPIOutput(u8g, U8G_PI_SDA);
172
+      if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_CS])  u8g_SetPIOutput(u8g, U8G_PI_CS);
173
+      if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_A0])  u8g_SetPIOutput(u8g, U8G_PI_A0);
174
+      if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET])  u8g_SetPIOutput(u8g, U8G_PI_RESET);
175
+
176
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
177
+      //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
178
+      //u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: unknown mode */
179
+
180
+      u8g_i2c_init_sw(u8g->pin_list[U8G_PI_I2C_OPTION]);
181
+      u8g_com_ssd_I2C_start_sequence_sw(u8g);
182
+      break;
183
+
184
+    case U8G_COM_MSG_STOP: break;
185
+
186
+    case U8G_COM_MSG_RESET: break;
187
+
188
+    case U8G_COM_MSG_CHIP_SELECT:
189
+      u8g->pin_list[U8G_PI_A0_STATE] = 0;
190
+      u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again, also forces start condition */
191
+      if (arg_val == 0) {
192
+        /* disable chip, send stop condition */
193
+        u8g_i2c_stop_sw();
194
+      }
195
+      else {
196
+        /* enable, do nothing: any byte writing will trigger the i2c start */
197
+      }
198
+      break;
199
+
200
+    case U8G_COM_MSG_WRITE_BYTE:
201
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
202
+      //if (u8g_com_arduino_ssd_start_sequence(u8g) == 0)
203
+      //  return u8g_i2c_stop(), 0;
204
+      if (u8g_i2c_send_byte_sw(arg_val) == 0)
205
+        return u8g_i2c_stop_sw(), 0;
233 206
         // u8g_i2c_stop();
234
-        break;
235
-
236
-      case U8G_COM_MSG_WRITE_SEQ:
237
-        //u8g->pin_list[U8G_PI_SET_A0] = 1;
238
-        if ( u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0 )
239
-          return u8g_i2c_stop_sw(), 0;
240
-        {
241
-          register uint8_t *ptr = (uint8_t *)arg_ptr;
242
-          while (arg_val > 0) {
243
-            if ( u8g_i2c_send_byte_sw(*ptr++) == 0 )
244
-              return u8g_i2c_stop_sw(), 0;
245
-            arg_val--;
246
-          }
207
+      break;
208
+
209
+    case U8G_COM_MSG_WRITE_SEQ: {
210
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
211
+      if (u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0)
212
+        return u8g_i2c_stop_sw(), 0;
213
+
214
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
215
+        while (arg_val > 0) {
216
+          if (u8g_i2c_send_byte_sw(*ptr++) == 0)
217
+            return u8g_i2c_stop_sw(), 0;
218
+          arg_val--;
247 219
         }
248
-        // u8g_i2c_stop();
249
-        break;
250
-
251
-      case U8G_COM_MSG_WRITE_SEQ_P:
252
-        //u8g->pin_list[U8G_PI_SET_A0] = 1;
253
-        if ( u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0 )
254
-          return u8g_i2c_stop_sw(), 0;
255
-        {
256
-          register uint8_t *ptr = (uint8_t *)arg_ptr;
257
-          while (arg_val > 0) {
258
-            if ( u8g_i2c_send_byte_sw(u8g_pgm_read(ptr)) == 0 )
259
-              return 0;
260
-            ptr++;
261
-            arg_val--;
262
-          }
220
+      }
221
+      // u8g_i2c_stop();
222
+      break;
223
+
224
+    case U8G_COM_MSG_WRITE_SEQ_P: {
225
+      //u8g->pin_list[U8G_PI_SET_A0] = 1;
226
+      if (u8g_com_ssd_I2C_start_sequence_sw(u8g) == 0)
227
+        return u8g_i2c_stop_sw(), 0;
228
+
229
+        register uint8_t *ptr = (uint8_t *)arg_ptr;
230
+        while (arg_val > 0) {
231
+          if (u8g_i2c_send_byte_sw(u8g_pgm_read(ptr)) == 0) return 0;
232
+          ptr++;
233
+          arg_val--;
263 234
         }
264
-        // u8g_i2c_stop();
265
-        break;
266
-
267
-      case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
268
-        u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
269
-        u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again */
270
-
271
-        u8g_i2c_start_sw(0); // send slave address and write bit
272
-        if (arg_val)
273
-          u8g_i2c_send_byte_sw(0x40);  // write to graphics DRAM mode
274
-        else
275
-          u8g_i2c_send_byte_sw(0x80);  //command mode
276
-        break;
277
-    }
278
-    return 1;
235
+      }
236
+      // u8g_i2c_stop();
237
+      break;
238
+
239
+    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
240
+      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
241
+      u8g->pin_list[U8G_PI_SET_A0] = 1;   /* force a0 to set again */
242
+      u8g_i2c_start_sw(0); // send slave address and write bit
243
+      u8g_i2c_send_byte_sw(arg_val ? 0x40 : 0x80);  // Write to ? Graphics DRAM mode : Command mode
244
+      break;
279 245
   }
246
+  return 1;
247
+}
280 248
 
281 249
 #endif  // TARGET_LPC1768

+ 32
- 34
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp Wyświetl plik

@@ -20,40 +20,38 @@
20 20
  *
21 21
  */
22 22
 
23
-/*
24
-
25
-  based on u8g_com_LPC1768_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
-*/
23
+/**
24
+ * Based on u8g_com_LPC1768_st7920_hw_spi.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
57 55
 
58 56
 #ifdef TARGET_LPC1768
59 57
 

+ 32
- 34
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp Wyświetl plik

@@ -20,40 +20,38 @@
20 20
  *
21 21
  */
22 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
-*/
23
+/**
24
+ * Based on u8g_com_st7920_hw_spi.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
57 55
 
58 56
 #ifdef TARGET_LPC1768
59 57
 

+ 35
- 40
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_sw_spi.cpp Wyświetl plik

@@ -20,40 +20,38 @@
20 20
  *
21 21
  */
22 22
 
23
-/*
24
-
25
-  adapted from u8g_com_std_sw_spi.c
26
-
27
-  Universal 8bit Graphics Library
28
-
29
-  Copyright (c) 2015, 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
-*/
23
+/**
24
+ * Based on u8g_com_std_sw_spi.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2015, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
57 55
 
58 56
 #ifdef TARGET_LPC1768
59 57
 
@@ -64,15 +62,12 @@
64 62
 
65 63
 static uint8_t SPI_speed = 0;
66 64
 
67
-static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val)
68
-{
65
+static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
69 66
   swSpiTransfer(val, SPI_speed, clockPin, -1, dataPin);
70 67
 }
71 68
 
72
-uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
73
-{
74
-  switch(msg)
75
-  {
69
+uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
70
+  switch(msg) {
76 71
     case U8G_COM_MSG_INIT:
77 72
       u8g_SetPIOutput(u8g, U8G_PI_SCK);
78 73
       u8g_SetPIOutput(u8g, U8G_PI_MOSI);

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Wyświetl plik

@@ -513,7 +513,7 @@
513 513
           }
514 514
           else {
515 515
             const float cvf = parser.value_float();
516
-            switch((int)truncf(cvf * 10.0) - 30) {   // 3.1 -> 1
516
+            switch ((int)truncf(cvf * 10.0) - 30) {   // 3.1 -> 1
517 517
               #if ENABLED(UBL_G29_P31)
518 518
                 case 1: {
519 519
 

+ 6
- 6
Marlin/src/feature/tmc_util.cpp Wyświetl plik

@@ -314,7 +314,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
314 314
 
315 315
   #if ENABLED(HAVE_TMC2130)
316 316
     static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) {
317
-      switch(i) {
317
+      switch (i) {
318 318
         case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
319 319
         case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break;
320 320
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
@@ -323,7 +323,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
323 323
       }
324 324
     }
325 325
     static void tmc_parse_drv_status(TMC2130Stepper &st, const TMC_drv_status_enum i) {
326
-      switch(i) {
326
+      switch (i) {
327 327
         case TMC_STALLGUARD: if (st.stallguard()) SERIAL_CHAR('X'); break;
328 328
         case TMC_SG_RESULT:  SERIAL_PRINT(st.sg_result(), DEC);   break;
329 329
         case TMC_FSACTIVE:   if (st.fsactive())   SERIAL_CHAR('X'); break;
@@ -333,7 +333,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
333 333
   #endif
334 334
   #if ENABLED(HAVE_TMC2208)
335 335
     static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
336
-      switch(i) {
336
+      switch (i) {
337 337
         case TMC_TSTEP: { uint32_t data = 0; st.TSTEP(&data); SERIAL_PROTOCOL(data); break; }
338 338
         case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
339 339
         case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
@@ -343,7 +343,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
343 343
       }
344 344
     }
345 345
     static void tmc_parse_drv_status(TMC2208Stepper &st, const TMC_drv_status_enum i) {
346
-      switch(i) {
346
+      switch (i) {
347 347
         case TMC_T157: if (st.t157()) SERIAL_CHAR('X'); break;
348 348
         case TMC_T150: if (st.t150()) SERIAL_CHAR('X'); break;
349 349
         case TMC_T143: if (st.t143()) SERIAL_CHAR('X'); break;
@@ -356,7 +356,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
356 356
   template <typename TMC>
357 357
   static void tmc_status(TMC &st, const TMC_AxisEnum axis, const TMC_debug_enum i, const float spmm) {
358 358
     SERIAL_ECHO('\t');
359
-    switch(i) {
359
+    switch (i) {
360 360
       case TMC_CODES: _tmc_say_axis(axis); break;
361 361
       case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
362 362
       case TMC_CURRENT: SERIAL_ECHO(st.getCurrent()); break;
@@ -401,7 +401,7 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
401 401
   template <typename TMC>
402 402
   static void tmc_parse_drv_status(TMC &st, const TMC_AxisEnum axis, const TMC_drv_status_enum i) {
403 403
     SERIAL_CHAR('\t');
404
-    switch(i) {
404
+    switch (i) {
405 405
       case TMC_DRV_CODES:     _tmc_say_axis(axis);  break;
406 406
       case TMC_STST:          if (st.stst())         SERIAL_CHAR('X'); break;
407 407
       case TMC_OLB:           if (st.olb())          SERIAL_CHAR('X'); break;

+ 102
- 131
Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp Wyświetl plik

@@ -20,42 +20,38 @@
20 20
  *
21 21
  */
22 22
 
23
-
24
-/*
25
-
26
-  u8g_dev_ssd1306_128x64.c
27
-
28
-  Universal 8bit Graphics Library
29
-
30
-  Copyright (c) 2011, olikraus@gmail.com
31
-  All rights reserved.
32
-
33
-  Redistribution and use in source and binary forms, with or without modification,
34
-  are permitted provided that the following conditions are met:
35
-
36
-  * Redistributions of source code must retain the above copyright notice, this list
37
-    of conditions and the following disclaimer.
38
-
39
-  * Redistributions in binary form must reproduce the above copyright notice, this
40
-    list of conditions and the following disclaimer in the documentation and/or other
41
-    materials provided with the distribution.
42
-
43
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
44
-  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
45
-  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
47
-  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
48
-  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
-  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
-  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
-  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55
-  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
-
57
-
58
-*/
23
+/**
24
+ * Based on u8g_dev_ssd1306_128x64.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2015, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
59 55
 
60 56
 /**
61 57
  * These routines are meant for two wire I2C interfaces.
@@ -85,43 +81,38 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
85 81
 // The sh1106 is compatible to the ssd1306, but is 132x64. 128x64 display area is centered within
86 82
 // the 132x64.
87 83
 
88
-
89 84
 static const uint8_t u8g_dev_sh1106_128x64_data_start_2_wire[] PROGMEM = {
90
-  0x010,    // set upper 4 bit of the col adr to 0
91
-  0x002,    // set lower 4 bit of the col adr to 2 (centered display with ssd1306)
92
-  U8G_ESC_END                // end of sequence
85
+  0x010,          // set upper 4 bit of the col adr to 0
86
+  0x002,          // set lower 4 bit of the col adr to 2 (centered display with ssd1306)
87
+  U8G_ESC_END     // end of sequence
93 88
 };
94 89
 
95
-
96 90
 static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = {
97
-  U8G_ESC_ADR(0),  // initiate command mode
98
-  0x0ae,        /* display off, sleep mode */
99
-  0x0a8, 0x03f,   /* mux ratio */
100
-  0x0d3, 0x00,    /* display offset */
101
-  0x040,        /* start line */
102
-  0x0a1,        /* segment remap a0/a1*/
103
-  0x0c8,        /* c0: scan dir normal, c8: reverse */
104
-  0x0da, 0x012,   /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
105
-  0x081, 0x0cf,   /* [2] set contrast control */
106
-  0x020, 0x002,   /* 2012-05-27: page addressing mode */
107
-  0x21, 2, 0x81,   // set column range from 0 through 131
108
-  0x22, 0, 7,   // set page range from 0 through 7
109
-  0x0d9, 0x0f1,   /* [2] pre-charge period 0x022/f1*/
110
-  0x0db, 0x040,   /* vcomh deselect level */
111
-  0x0a4,        /* output ram to display */
112
-  0x0a6,        /* none inverted normal display mode */
113
-  0x0d5, 0x080,   /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
114
-  0x08d, 0x014,   /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
115
-  0x02e,        /* 2012-05-27: Deactivate scroll */
116
-  0x0af,        /* display on */
117
-  U8G_ESC_END                /* end of sequence */
91
+  U8G_ESC_ADR(0), // initiate command mode
92
+  0x0AE,          // display off, sleep mode
93
+  0x0A8, 0x03F,   // mux ratio
94
+  0x0D3, 0x00,    // display offset
95
+  0x040,          // start line
96
+  0x0A1,          // segment remap a0/a1
97
+  0x0C8,          // c0: scan dir normal, c8: reverse
98
+  0x0DA, 0x012,   // com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
99
+  0x081, 0x0CF,   // [2] set contrast control
100
+  0x020, 0x002,   // 2012-05-27: page addressing mode
101
+  0x21, 2, 0x81,  // set column range from 0 through 131
102
+  0x22, 0, 7,     // set page range from 0 through 7
103
+  0x0D9, 0x0F1,   // [2] pre-charge period 0x022/f1
104
+  0x0DB, 0x040,   // vcomh deselect level
105
+  0x0A4,          // output ram to display
106
+  0x0A6,          // none inverted normal display mode
107
+  0x0D5, 0x080,   // clock divide ratio (0x00=1) and oscillator frequency (0x8)
108
+  0x08D, 0x014,   // [2] charge pump setting (p62): 0x014 enable, 0x010 disable
109
+  0x02E,          // 2012-05-27: Deactivate scroll
110
+  0x0AF,          // display on
111
+  U8G_ESC_END     // end of sequence
118 112
 };
119 113
 
120
-
121
-uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
122
-{
123
-  switch(msg)
124
-  {
114
+uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
115
+  switch(msg) {
125 116
     case U8G_DEV_MSG_INIT:
126 117
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
127 118
       u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_init_seq_2_wire);
@@ -152,7 +143,6 @@ uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
152 143
   return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
153 144
 }
154 145
 
155
-
156 146
 uint8_t u8g_dev_sh1106_128x64_2x_i2c_2_wire_buf[WIDTH*2] U8G_NOCOMMON ;
157 147
 u8g_pb_t u8g_dev_sh1106_128x64_2x_i2c_2_wire_pb = { {16, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_sh1106_128x64_2x_i2c_2_wire_buf};
158 148
 u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire = { u8g_dev_sh1106_128x64_2x_2_wire_fn, &u8g_dev_sh1106_128x64_2x_i2c_2_wire_pb, U8G_COM_SSD_I2C_HAL };
@@ -160,41 +150,37 @@ u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire = { u8g_dev_sh1106_128x64_2x_2_wir
160 150
 /////////////////////////////////////////////////////////////////////////////////////////////
161 151
 
162 152
 static const uint8_t u8g_dev_ssd1306_128x64_data_start_2_wire[] PROGMEM = {
163
-  0x010,    // set upper 4 bit of the col adr to 0
164
-  0x000,    // set lower 4 bit of the col adr to 0
165
-  U8G_ESC_END                // end of sequence
153
+  0x010,          // set upper 4 bit of the col adr to 0
154
+  0x000,          // set lower 4 bit of the col adr to 0
155
+  U8G_ESC_END     // end of sequence
166 156
 };
167 157
 
168
-
169 158
 static const uint8_t u8g_dev_ssd1306_128x64_init_seq_2_wire[] PROGMEM = {
170
-  U8G_ESC_ADR(0),  // initiate command mode
171
-  0x0ae,        /* display off, sleep mode */
172
-  0x0a8, 0x03f,   /* mux ratio */
173
-  0x0d3, 0x00,    /* display offset */
174
-  0x040,        /* start line */
175
-  0x0a1,        /* segment remap a0/a1*/
176
-  0x0c8,        /* c0: scan dir normal, c8: reverse */
177
-  0x0da, 0x012,   /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
178
-  0x081, 0x0cf,   /* [2] set contrast control */
179
-  0x020, 0x002,   /* 2012-05-27: page addressing mode */
180
-  0x21, 0, 0x7f,   // set column range from 0 through 127
181
-  0x22, 0, 7,   // set page range from 0 through 7
182
-  0x0d9, 0x0f1,   /* [2] pre-charge period 0x022/f1*/
183
-  0x0db, 0x040,   /* vcomh deselect level */
184
-  0x0a4,        /* output ram to display */
185
-  0x0a6,        /* none inverted normal display mode */
186
-  0x0d5, 0x080,   /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
187
-  0x08d, 0x014,   /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
188
-  0x02e,        /* 2012-05-27: Deactivate scroll */
189
-  0x0af,        /* display on */
190
-  U8G_ESC_END                /* end of sequence */
159
+  U8G_ESC_ADR(0), // initiate command mode
160
+  0x0AE,          // display off, sleep mode
161
+  0x0A8, 0x03F,   // mux ratio
162
+  0x0D3, 0x00,    // display offset
163
+  0x040,          // start line
164
+  0x0A1,          // segment remap a0/a1
165
+  0x0C8,          // c0: scan dir normal, c8: reverse
166
+  0x0DA, 0x012,   // com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
167
+  0x081, 0x0CF,   // [2] set contrast control
168
+  0x020, 0x002,   // 2012-05-27: page addressing mode
169
+  0x21, 0, 0x7F,  // set column range from 0 through 127
170
+  0x22, 0, 7,     // set page range from 0 through 7
171
+  0x0D9, 0x0F1,   // [2] pre-charge period 0x022/f1
172
+  0x0DB, 0x040,   // vcomh deselect level
173
+  0x0A4,          // output ram to display
174
+  0x0A6,          // none inverted normal display mode
175
+  0x0D5, 0x080,   // clock divide ratio (0x00=1) and oscillator frequency (0x8)
176
+  0x08D, 0x014,   // [2] charge pump setting (p62): 0x014 enable, 0x010 disable
177
+  0x02E,          // 2012-05-27: Deactivate scroll
178
+  0x0AF,          // display on
179
+  U8G_ESC_END     // end of sequence
191 180
 };
192 181
 
193
-
194
-uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
195
-{
196
-  switch(msg)
197
-  {
182
+uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
183
+  switch(msg) {
198 184
     case U8G_DEV_MSG_INIT:
199 185
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
200 186
       u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_init_seq_2_wire);
@@ -238,54 +224,42 @@ u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire = { u8g_dev_ssd1306_128x64_2x_2_w
238 224
 
239 225
 #define I2C_CMD_MODE    0x080
240 226
 
241
-uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq)
242
-{
227
+uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq) {
243 228
   uint8_t is_escape = 0;
244 229
   uint8_t value;
245
-  for(;;)
246
-  {
230
+  for(;;) {
247 231
     value = u8g_pgm_read(esc_seq);
248
-    if ( is_escape == 0 )
249
-    {
250
-      if ( value != 255 )
251
-      {
252
-        if ( u8g_WriteByte(u8g, dev, value) == 0 )
232
+    if (is_escape == 0) {
233
+      if (value != 255) {
234
+        if (u8g_WriteByte(u8g, dev, value) == 0 )
253 235
           return 0;
254
-        if ( u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
236
+        if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
255 237
           return 0;
256 238
       }
257
-      else
258
-      {
239
+      else {
259 240
         is_escape = 1;
260 241
       }
261 242
     }
262
-    else
263
-    {
264
-      if ( value == 255 )
265
-      {
266
-        if ( u8g_WriteByte(u8g, dev, value) == 0 )
243
+    else {
244
+      if (value == 255) {
245
+        if (u8g_WriteByte(u8g, dev, value) == 0 )
267 246
           return 0;
268
-        if ( u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
247
+        if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
269 248
           return 0;
270 249
       }
271
-      else if ( value == 254 )
272
-      {
250
+      else if (value == 254) {
273 251
         break;
274 252
       }
275
-      else if ( value >= 0x0f0 )
276
-      {
253
+      else if (value >= 0x0f0) {
277 254
         /* not yet used, do nothing */
278 255
       }
279
-      else if ( value >= 0xe0  )
280
-      {
256
+      else if (value >= 0xe0 ) {
281 257
         u8g_SetAddress(u8g, dev, value & 0x0f);
282 258
       }
283
-      else if ( value >= 0xd0 )
284
-      {
259
+      else if (value >= 0xd0) {
285 260
         u8g_SetChipSelect(u8g, dev, value & 0x0f);
286 261
       }
287
-      else if ( value >= 0xc0 )
288
-      {
262
+      else if (value >= 0xc0) {
289 263
         u8g_SetResetLow(u8g, dev);
290 264
         value &= 0x0f;
291 265
         value <<= 4;
@@ -294,13 +268,10 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
294 268
         u8g_SetResetHigh(u8g, dev);
295 269
         u8g_Delay(value);
296 270
       }
297
-      else if ( value >= 0xbe )
298
-      {
299
-  /* not yet implemented */
271
+      else if (value >= 0xbe) {                       /* not yet implemented */
300 272
         /* u8g_SetVCC(u8g, dev, value & 0x01); */
301 273
       }
302
-      else if ( value <= 127 )
303
-      {
274
+      else if (value <= 127) {
304 275
         u8g_Delay(value);
305 276
       }
306 277
       is_escape = 0;

+ 82
- 90
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp Wyświetl plik

@@ -20,42 +20,38 @@
20 20
  *
21 21
  */
22 22
 
23
-
24
-/*
25
-
26
-  u8g_dev_st7565_64128n_HAL.c (Displaytech)
27
-
28
-  Universal 8bit Graphics Library
29
-
30
-  Copyright (c) 2011, olikraus@gmail.com
31
-  All rights reserved.
32
-
33
-  Redistribution and use in source and binary forms, with or without modification,
34
-  are permitted provided that the following conditions are met:
35
-
36
-  * Redistributions of source code must retain the above copyright notice, this list
37
-    of conditions and the following disclaimer.
38
-
39
-  * Redistributions in binary form must reproduce the above copyright notice, this
40
-    list of conditions and the following disclaimer in the documentation and/or other
41
-    materials provided with the distribution.
42
-
43
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
44
-  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
45
-  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
47
-  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
48
-  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
-  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
-  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
-  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
-  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55
-  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
-
57
-
58
-*/
23
+/**
24
+ * u8g_dev_st7565_64128n_HAL.c (Displaytech)
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
59 55
 
60 56
 #include "../../inc/MarlinConfig.h"
61 57
 
@@ -71,78 +67,76 @@
71 67
 
72 68
 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
73 69
 static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
74
-   U8G_ESC_CS(0),            /* disable chip */
75
-    U8G_ESC_ADR(0),          /* instruction mode */
76
-    U8G_ESC_CS(1),           /* enable chip */
77
-    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)*/
78 74
 
79
-    0x0A2,             /* 0x0a2: LCD bias 1/9 (according to Displaytech 64128N datasheet) */
80
-    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)
81 77
 
82
-    0x0c8,                   /* common output mode: set scan direction normal operation/SHL Select, 0x0c0 --> SHL = 0, normal, 0x0c8 --> SHL = 1 */
83
-    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
84 80
 
85
-    0x028 | 0x04,            /* power control: turn on voltage converter */
86
-    U8G_ESC_DLY(50),         /* delay 50 ms */
81
+    0x028 | 0x04,       // power control: turn on voltage converter
82
+    U8G_ESC_DLY(50),    // delay 50 ms
87 83
 
88
-    0x028 | 0x06,            /* power control: turn on voltage regulator */
89
-    U8G_ESC_DLY(50),         /* delay 50 ms */
84
+    0x028 | 0x06,       // power control: turn on voltage regulator
85
+    U8G_ESC_DLY(50),    // delay 50 ms
90 86
 
91
-    0x028 | 0x07,            /* power control: turn on voltage follower */
92
-    U8G_ESC_DLY(50),         /* delay 50 ms */
87
+    0x028 | 0x07,       // power control: turn on voltage follower
88
+    U8G_ESC_DLY(50),    // delay 50 ms
93 89
 
94
-    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
95 91
 
96
-    0x0a6,                   /* display normal, bit val 0: LCD pixel off. */
92
+    0x0a6,              // display normal, bit val 0: LCD pixel off.
97 93
 
98
-    0x081,                   /* set contrast */
99
-    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
100 96
 
101 97
 
102
-    0x0af,               /* display on */
98
+    0x0af,              // display on
103 99
 
104
-    U8G_ESC_DLY(100),        /* delay 100 ms */
105
-    0x0a5,               /* display all points, ST7565 */
106
-    U8G_ESC_DLY(100),        /* delay 100 ms */
107
-    U8G_ESC_DLY(100),        /* delay 100 ms */
108
-    0x0a4,               /* normal display */
109
-    U8G_ESC_CS(0),           /* disable chip */
110
-    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
111 107
 };
112 108
 
113 109
 static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
114
-  U8G_ESC_ADR(0),           /* instruction mode */
115
-  U8G_ESC_CS(1),            /* enable chip */
116
-  0x010,                  /* set upper 4 bit of the col adr to 0x10 */
117
-  0x000,                /* set lower 4 bit of the col adr to 0x00. Changed for DisplayTech 64128N */
118
-  U8G_ESC_END               /* end of sequence */
110
+  U8G_ESC_ADR(0),       // instruction mode
111
+  U8G_ESC_CS(1),        // enable chip
112
+  0x010,                // set upper 4 bit of the col adr to 0x10
113
+  0x000,                // set lower 4 bit of the col adr to 0x00. Changed for DisplayTech 64128N
114
+  U8G_ESC_END           // end of sequence
119 115
 };
120 116
 
121 117
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
122
-  U8G_ESC_ADR(0),           /* instruction mode */
123
-  U8G_ESC_CS(1),             /* enable chip */
124
-  0x0ac,    /* static indicator off */
125
-  0x000,                    /* indicator register set (not sure if this is required) */
126
-  0x0ae,    /* display off */
127
-  0x0a5,    /* all points on */
128
-  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
129
-  U8G_ESC_END                /* end of sequence */
118
+  U8G_ESC_ADR(0),       // instruction mode
119
+  U8G_ESC_CS(1),        // enable chip
120
+  0x0ac,                // static indicator off
121
+  0x000,                // indicator register set (not sure if this is required)
122
+  0x0ae,                // display off
123
+  0x0a5,                // all points on
124
+  U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
125
+  U8G_ESC_END           // end of sequence
130 126
   };
131 127
 
132 128
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
133
-  U8G_ESC_ADR(0),           /* instruction mode */
134
-  U8G_ESC_CS(1),             /* enable chip */
135
-  0x0a4,    /* all points off */
136
-  0x0af,    /* display on */
137
-  U8G_ESC_DLY(50),       /* delay 50 ms */
138
-  U8G_ESC_CS(0),             /* disable chip, bugfix 12 nov 2014 */
139
-  U8G_ESC_END                /* end of sequence */
129
+  U8G_ESC_ADR(0),       // instruction mode
130
+  U8G_ESC_CS(1),        // enable chip
131
+  0x0a4,                // all points off
132
+  0x0af,                // display on
133
+  U8G_ESC_DLY(50),      // delay 50 ms
134
+  U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
135
+  U8G_ESC_END           // end of sequence
140 136
 };
141 137
 
142
-uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
143
-{
144
-  switch(msg)
145
-  {
138
+uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
139
+  switch(msg) {
146 140
     case U8G_DEV_MSG_INIT:
147 141
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
148 142
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_init_seq);
@@ -176,10 +170,8 @@ uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
176 170
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
177 171
 }
178 172
 
179
-uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
180
-{
181
-  switch(msg)
182
-  {
173
+uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
174
+  switch(msg) {
183 175
     case U8G_DEV_MSG_INIT:
184 176
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
185 177
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_init_seq);

+ 104
- 121
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp Wyświetl plik

@@ -20,41 +20,38 @@
20 20
  *
21 21
  */
22 22
 
23
-/*
24
-
25
-  u8g_dev_st7920_128x64_HAL.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
-*/
23
+/**
24
+ * u8g_dev_st7920_128x64_HAL.c
25
+ *
26
+ * Universal 8bit Graphics Library
27
+ *
28
+ * Copyright (c) 2011, olikraus@gmail.com
29
+ * All rights reserved.
30
+ *
31
+ * Redistribution and use in source and binary forms, with or without modification,
32
+ * are permitted provided that the following conditions are met:
33
+ *
34
+ *  * Redistributions of source code must retain the above copyright notice, this list
35
+ *    of conditions and the following disclaimer.
36
+ *
37
+ *  * Redistributions in binary form must reproduce the above copyright notice, this
38
+ *    list of conditions and the following disclaimer in the documentation and/or other
39
+ *    materials provided with the distribution.
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
42
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
43
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
46
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
53
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
+ */
58 55
 
59 56
 #include "../../inc/MarlinConfig.h"
60 57
 
@@ -68,25 +65,24 @@
68 65
 #define HEIGHT 64
69 66
 #define PAGE_HEIGHT 8
70 67
 
71
-
72 68
 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
73 69
 static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = {
74
-  U8G_ESC_CS(0),             /* disable chip */
75
-  U8G_ESC_ADR(0),           /* instruction mode */
76
-  U8G_ESC_RST(15),           /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
77
-  U8G_ESC_DLY(100),         /* 8 Dez 2012: additional delay 100 ms because of reset*/
78
-  U8G_ESC_CS(1),             /* enable chip */
79
-  U8G_ESC_DLY(50),         /* delay 50 ms */
80
-
81
-  0x038,                                /* 8 Bit interface (DL=1), basic instruction set (RE=0) */
82
-  0x00c,                                /* display on, cursor & blink off; 0x08: all off */
83
-  0x006,                                /* Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift */
84
-  0x002,                                /* disable scroll, enable CGRAM adress */
85
-  0x001,                                /* clear RAM, needs 1.6 ms */
86
-  U8G_ESC_DLY(100),               /* delay 100 ms */
87
-
88
-  U8G_ESC_CS(0),             /* disable chip */
89
-  U8G_ESC_END                /* end of sequence */
70
+  U8G_ESC_CS(0),      // disable chip
71
+  U8G_ESC_ADR(0),     // instruction mode
72
+  U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)
73
+  U8G_ESC_DLY(100),   // 8 Dez 2012: additional delay 100 ms because of reset
74
+  U8G_ESC_CS(1),      // enable chip
75
+  U8G_ESC_DLY(50),    // delay 50 ms
76
+
77
+  0x038,              // 8 Bit interface (DL=1), basic instruction set (RE=0)
78
+  0x00c,              // display on, cursor & blink off; 0x08: all off
79
+  0x006,              // Entry mode: Cursor move to right ,DDRAM address counter (AC) plus 1, no shift
80
+  0x002,              // disable scroll, enable CGRAM adress
81
+  0x001,              // clear RAM, needs 1.6 ms
82
+  U8G_ESC_DLY(100),   // delay 100 ms
83
+
84
+  U8G_ESC_CS(0),      // disable chip
85
+  U8G_ESC_END         // end of sequence
90 86
 };
91 87
 
92 88
 void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev){
@@ -107,13 +103,10 @@ void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev){
107 103
   u8g_WriteByte(u8g, dev, 0x0C); //display on, cursor+blink off
108 104
 
109 105
   u8g_SetChipSelect(u8g, dev, 0);
110
-
111 106
 }
112 107
 
113
-uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
114
-{
115
-  switch(msg)
116
-  {
108
+uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
109
+  switch(msg) {
117 110
     case U8G_DEV_MSG_INIT:
118 111
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
119 112
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_HAL_init_seq);
@@ -122,46 +115,41 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
122 115
     case U8G_DEV_MSG_STOP:
123 116
       break;
124 117
     case U8G_DEV_MSG_PAGE_NEXT: {
125
-        uint8_t y, i;
126
-        uint8_t *ptr;
127
-        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
128
-
118
+      uint8_t y, i;
119
+      uint8_t *ptr;
120
+      u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
121
+
122
+      u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
123
+      u8g_SetChipSelect(u8g, dev, 1);
124
+      y = pb->p.page_y0;
125
+      ptr = (uint8_t *)pb->buf;
126
+      for (i = 0; i < 8; i ++) {
129 127
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
130
-        u8g_SetChipSelect(u8g, dev, 1);
131
-        y = pb->p.page_y0;
132
-        ptr = (uint8_t *)pb->buf;
133
-        for( i = 0; i < 8; i ++ )
134
-        {
135
-          u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
136
-          u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
137
-
138
-          if ( y < 32 )
139
-          {
140
-                  u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
141
-                  u8g_WriteByte(u8g, dev, 0x080  );      /* set x pos to 0*/
142
-          }
143
-          else
144
-          {
145
-                  u8g_WriteByte(u8g, dev, 0x080 | (y-32) );      /* y pos  */
146
-                  u8g_WriteByte(u8g, dev, 0x080 | 8);      /* set x pos to 64*/
147
-          }
148
-
149
-          u8g_SetAddress(u8g, dev, 1);                  /* data mode */
150
-          u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
151
-          ptr += WIDTH/8;
152
-          y++;
128
+        u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
129
+
130
+        if (y < 32) {
131
+          u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
132
+          u8g_WriteByte(u8g, dev, 0x080  );      /* set x pos to 0*/
133
+        }
134
+        else {
135
+          u8g_WriteByte(u8g, dev, 0x080 | (y-32) );      /* y pos  */
136
+          u8g_WriteByte(u8g, dev, 0x080 | 8);      /* set x pos to 64*/
153 137
         }
154
-        u8g_SetChipSelect(u8g, dev, 0);
138
+
139
+        u8g_SetAddress(u8g, dev, 1);                  /* data mode */
140
+        u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
141
+        ptr += WIDTH/8;
142
+        y++;
155 143
       }
156
-      break;
144
+      u8g_SetChipSelect(u8g, dev, 0);
145
+    }
146
+    break;
157 147
   }
158 148
   return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
159 149
 }
160 150
 
161
-uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
162
-{
163
-  switch(msg)
164
-  {
151
+uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
152
+  switch(msg) {
165 153
     case U8G_DEV_MSG_INIT:
166 154
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
167 155
       u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_HAL_init_seq);
@@ -172,38 +160,35 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
172 160
       break;
173 161
 
174 162
     case U8G_DEV_MSG_PAGE_NEXT: {
175
-        uint8_t y, i;
176
-        uint8_t *ptr;
177
-        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
178
-
163
+      uint8_t y, i;
164
+      uint8_t *ptr;
165
+      u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
166
+
167
+      u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
168
+      u8g_SetChipSelect(u8g, dev, 1);
169
+      y = pb->p.page_y0;
170
+      ptr = (uint8_t *)pb->buf;
171
+      for (i = 0; i < 32; i ++) {
179 172
         u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
180
-        u8g_SetChipSelect(u8g, dev, 1);
181
-        y = pb->p.page_y0;
182
-        ptr = (uint8_t *)pb->buf;
183
-        for( i = 0; i < 32; i ++ )
184
-        {
185
-          u8g_SetAddress(u8g, dev, 0);           /* cmd mode */
186
-          u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
187
-
188
-          if ( y < 32 )
189
-          {
190
-                  u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
191
-                  u8g_WriteByte(u8g, dev, 0x080  );      /* set x pos to 0*/
192
-          }
193
-          else
194
-          {
195
-                  u8g_WriteByte(u8g, dev, 0x080 | (y-32) );      /* y pos  */
196
-                  u8g_WriteByte(u8g, dev, 0x080 | 8);      /* set x pos to 64*/
197
-          }
198
-
199
-          u8g_SetAddress(u8g, dev, 1);                  /* data mode */
200
-          u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
201
-          ptr += WIDTH/8;
202
-          y++;
173
+        u8g_WriteByte(u8g, dev, 0x03e );      /* enable extended mode */
174
+
175
+        if (y < 32) {
176
+          u8g_WriteByte(u8g, dev, 0x080 | y );      /* y pos  */
177
+          u8g_WriteByte(u8g, dev, 0x080  );      /* set x pos to 0*/
203 178
         }
204
-        u8g_SetChipSelect(u8g, dev, 0);
179
+        else {
180
+          u8g_WriteByte(u8g, dev, 0x080 | (y-32) );      /* y pos  */
181
+          u8g_WriteByte(u8g, dev, 0x080 | 8);      /* set x pos to 64*/
182
+        }
183
+
184
+        u8g_SetAddress(u8g, dev, 1);                  /* data mode */
185
+        u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
186
+        ptr += WIDTH/8;
187
+        y++;
205 188
       }
206
-      break;
189
+      u8g_SetChipSelect(u8g, dev, 0);
190
+    }
191
+    break;
207 192
   }
208 193
   return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg);
209 194
 }
@@ -215,11 +200,9 @@ uint8_t u8g_dev_st7920_128x64_HAL_4x_buf[QWIDTH] U8G_NOCOMMON ;
215 200
 u8g_pb_t u8g_dev_st7920_128x64_HAL_4x_pb = { {32, HEIGHT, 0, 0, 0},  WIDTH, u8g_dev_st7920_128x64_HAL_4x_buf};
216 201
 u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
217 202
 
218
-
219 203
 U8G_PB_DEV(u8g_dev_st7920_128x64_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7920_128x64_HAL_fn, U8G_COM_ST7920_HAL_HW_SPI);
220 204
 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 };
221 205
 
222
-
223 206
 #if defined(U8G_HAL_LINKS) || defined(__SAM3X8E__)
224 207
   // Also use this device for HAL version of rrd class. This results in the same device being used
225 208
   // for the ST7920 for HAL systems no matter what is selected in ultralcd_impl_DOGM.h.

Ładowanie…
Anuluj
Zapisz