From e3611ad209582a222562ec88332c8ad9f85e2937 Mon Sep 17 00:00:00 2001 From: 0r31 <37673727+0r31@users.noreply.github.com> Date: Sun, 26 Jan 2020 08:08:40 +0100 Subject: [PATCH] Fix MKS Base + Digipot compile error (#16636) --- .../HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c | 1 - .../HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h | 1 + Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h | 8 ++++++++ Marlin/src/feature/digipot/digipot_mcp4451.cpp | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c index 8dc8c61b4..dd83c7a97 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c @@ -36,7 +36,6 @@ #endif #include "digipot_mcp4451_I2C_routines.h" -#include "i2c_util.h" // These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to // to the lpc17xx_i2c.c routines so had to copy them into this file & rename them. diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h index 6d6fafa8b..db6715e2b 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h @@ -33,6 +33,7 @@ #include #include #include +#include "i2c_util.h" uint8_t digipot_mcp4451_start(uint8_t sla); uint8_t digipot_mcp4451_send_byte(uint8_t data); diff --git a/Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h b/Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h index 671a1e374..1ca3fc184 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h @@ -45,4 +45,12 @@ #include #include +#ifdef __cplusplus + extern "C" { +#endif + void configure_i2c(const uint8_t clock_option); + +#ifdef __cplusplus + } +#endif diff --git a/Marlin/src/feature/digipot/digipot_mcp4451.cpp b/Marlin/src/feature/digipot/digipot_mcp4451.cpp index 13022abad..48b4d154b 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4451.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4451.cpp @@ -77,7 +77,7 @@ void digipot_i2c_set_current(const uint8_t channel, const float current) { void digipot_i2c_init() { #if MB(MKS_SBASE) - configure_i2c(); + configure_i2c(16); // Setting clock_option to 16 ensure the I2C bus is initialized at 400kHz #else Wire.begin(); #endif