Browse Source

Fix MKS Base + Digipot compile error (#16636)

0r31 5 years ago
parent
commit
e3611ad209

+ 0
- 1
Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c View File

36
 #endif
36
 #endif
37
 
37
 
38
 #include "digipot_mcp4451_I2C_routines.h"
38
 #include "digipot_mcp4451_I2C_routines.h"
39
-#include "i2c_util.h"
40
 
39
 
41
 // These two routines are exact copies of the lpc17xx_i2c.c routines.  Couldn't link to
40
 // These two routines are exact copies of the lpc17xx_i2c.c routines.  Couldn't link to
42
 // to the lpc17xx_i2c.c routines so had to copy them into this file & rename them.
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 View File

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

+ 8
- 0
Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h View File

45
 #include <lpc17xx_pinsel.h>
45
 #include <lpc17xx_pinsel.h>
46
 #include <lpc17xx_libcfg_default.h>
46
 #include <lpc17xx_libcfg_default.h>
47
 
47
 
48
+#ifdef __cplusplus
49
+  extern "C" {
50
+#endif
51
+
48
 void configure_i2c(const uint8_t clock_option);
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 View File

77
 
77
 
78
 void digipot_i2c_init() {
78
 void digipot_i2c_init() {
79
   #if MB(MKS_SBASE)
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
   #else
81
   #else
82
     Wire.begin();
82
     Wire.begin();
83
   #endif
83
   #endif

Loading…
Cancel
Save