| @@ -31,8 +31,6 @@ | ||||
|  | ||||
| // Settings for the I2C based DIGIPOT (MCP4018) based on WT150 | ||||
|  | ||||
| #define DIGIPOT_I2C_ADDRESS             0x2F | ||||
|  | ||||
| #define DIGIPOT_A4988_Rsx               0.250 | ||||
| #define DIGIPOT_A4988_Vrefmax           1.666 | ||||
| #define DIGIPOT_A4988_MAX_VALUE         127 | ||||
| @@ -81,7 +79,7 @@ static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = { | ||||
|  | ||||
| static void i2c_send(const uint8_t channel, const byte v) { | ||||
|   if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) { | ||||
|     pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS) << 1) | I2C_WRITE); | ||||
|     pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS_A) << 1) | I2C_WRITE); | ||||
|     pots[channel].i2c_write(v); | ||||
|     pots[channel].i2c_stop(); | ||||
|   } | ||||
|   | ||||
| @@ -25,7 +25,6 @@ | ||||
| #if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018) | ||||
|  | ||||
| #include "Stream.h" | ||||
| #include "utility/twi.h" | ||||
| #include <Wire.h> | ||||
|  | ||||
| // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro | ||||
| @@ -52,7 +51,7 @@ static void i2c_send(const byte addr, const byte a, const byte b) { | ||||
| void digipot_i2c_set_current(const uint8_t channel, const float current) { | ||||
|   // these addresses are specific to Azteeg X3 Pro, can be set to others, | ||||
|   // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1 | ||||
|   const byte addr = channel < 4 ? 0x2C : 0x2E; // channel 0-3 vs 4-7 | ||||
|   const byte addr = channel < 4 ? DIGIPOT_I2C_ADDRESS_A : DIGIPOT_I2C_ADDRESS_B; // channel 0-3 vs 4-7 | ||||
|  | ||||
|   // Initial setup | ||||
|   i2c_send(addr, 0x40, 0xFF); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user