Browse Source

Fix HAL_DUE multiple define error with graphical LCD (#13971)

Marcio Teixeira 6 years ago
parent
commit
746c38f4be

+ 1
- 10
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp View File

64
 
64
 
65
 #include <U8glib.h>
65
 #include <U8glib.h>
66
 
66
 
67
-void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
68
-  PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
69
-    g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
70
-}
71
-
72
-void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
73
-  volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort;
74
-  uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin;
75
-  if (level) port->PIO_SODR = mask; else port->PIO_CODR = mask;
76
-}
67
+#include "u8g_com_HAL_DUE_sw_spi_shared.h"
77
 
68
 
78
 Pio *SCK_pPio, *MOSI_pPio;
69
 Pio *SCK_pPio, *MOSI_pPio;
79
 uint32_t SCK_dwMask, MOSI_dwMask;
70
 uint32_t SCK_dwMask, MOSI_dwMask;

+ 2
- 4
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_sw_spi_shared.cpp View File

57
 
57
 
58
 #include "../../inc/MarlinConfigPre.h"
58
 #include "../../inc/MarlinConfigPre.h"
59
 
59
 
60
-//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\inc\MarlinConfigPre.h
61
-//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\u8g_com_HAL_DUE_sw_spi_shared.cpp
62
-
63
 #if HAS_GRAPHICAL_LCD
60
 #if HAS_GRAPHICAL_LCD
64
 
61
 
65
 #include "../shared/Marduino.h"
62
 #include "../shared/Marduino.h"
67
 
64
 
68
 #include <U8glib.h>
65
 #include <U8glib.h>
69
 
66
 
67
+#include "u8g_com_HAL_DUE_sw_spi_shared.h"
68
+
70
 void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
69
 void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
71
   PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
70
   PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
72
     g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
71
     g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration);  // OUTPUT
95
   }
94
   }
96
 }
95
 }
97
 
96
 
98
-
99
 void U8G_spiSend_sw_DUE_mode_3(uint8_t val) { // 800KHz
97
 void U8G_spiSend_sw_DUE_mode_3(uint8_t val) { // 800KHz
100
   for (uint8_t i = 0; i < 8; i++) {
98
   for (uint8_t i = 0; i < 8; i++) {
101
     SCK_pPio->PIO_CODR = SCK_dwMask;
99
     SCK_pPio->PIO_CODR = SCK_dwMask;

+ 25
- 0
Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_sw_spi_shared.h View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2019 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
+#pragma once
23
+
24
+void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index);
25
+void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level);

Loading…
Cancel
Save