Kaynağa Gözat

Fix MKS Base + Digipot compile error (#16636)

0r31 4 yıl önce
ebeveyn
işleme
e3611ad209

+ 0
- 1
Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c Dosyayı Görüntüle

@@ -36,7 +36,6 @@
36 36
 #endif
37 37
 
38 38
 #include "digipot_mcp4451_I2C_routines.h"
39
-#include "i2c_util.h"
40 39
 
41 40
 // These two routines are exact copies of the lpc17xx_i2c.c routines.  Couldn't link to
42 41
 // to the lpc17xx_i2c.c routines so had to copy them into this file & rename them.

+ 1
- 0
Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h Dosyayı Görüntüle

@@ -33,6 +33,7 @@
33 33
 #include <lpc17xx_i2c.h>
34 34
 #include <lpc17xx_pinsel.h>
35 35
 #include <lpc17xx_libcfg_default.h>
36
+#include "i2c_util.h"
36 37
 
37 38
 uint8_t digipot_mcp4451_start(uint8_t sla);
38 39
 uint8_t digipot_mcp4451_send_byte(uint8_t data);

+ 8
- 0
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h Dosyayı Görüntüle

@@ -45,4 +45,12 @@
45 45
 #include <lpc17xx_pinsel.h>
46 46
 #include <lpc17xx_libcfg_default.h>
47 47
 
48
+#ifdef __cplusplus
49
+  extern "C" {
50
+#endif
51
+
48 52
 void configure_i2c(const uint8_t clock_option);
53
+
54
+#ifdef __cplusplus
55
+  }
56
+#endif

+ 1
- 1
Marlin/src/feature/digipot/digipot_mcp4451.cpp Dosyayı Görüntüle

@@ -77,7 +77,7 @@ void digipot_i2c_set_current(const uint8_t channel, const float current) {
77 77
 
78 78
 void digipot_i2c_init() {
79 79
   #if MB(MKS_SBASE)
80
-    configure_i2c();
80
+    configure_i2c(16); // Setting clock_option to 16 ensure the I2C bus is initialized at 400kHz
81 81
   #else
82 82
     Wire.begin();
83 83
   #endif

Loading…
İptal
Kaydet