Skip to content

Commit

Permalink
Fix MKS Base + Digipot compile error (#16636)
Browse files Browse the repository at this point in the history
  • Loading branch information
0r31 authored and thinkyhead committed Jan 26, 2020
1 parent 95d5a0c commit e3611ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <lpc17xx_i2c.h>
#include <lpc17xx_pinsel.h>
#include <lpc17xx_libcfg_default.h>
#include "i2c_util.h"

uint8_t digipot_mcp4451_start(uint8_t sla);
uint8_t digipot_mcp4451_send_byte(uint8_t data);
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/HAL/HAL_LPC1768/include/i2c_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@
#include <lpc17xx_pinsel.h>
#include <lpc17xx_libcfg_default.h>

#ifdef __cplusplus
extern "C" {
#endif

void configure_i2c(const uint8_t clock_option);

#ifdef __cplusplus
}
#endif
2 changes: 1 addition & 1 deletion Marlin/src/feature/digipot/digipot_mcp4451.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e3611ad

Please sign in to comment.