I have connected an ESP 32 to a MAX11613 chip using this library:
https://github.com/eta-systems/MAX11615/blob/master/src/MAX11615.c
I translated the library for ESP32 using Wire.h. After using the Init-function and the Read-Function the output values for the potentiometer make no sense. They fluctuate randomly with only the max and min values being correct.
My question is: Which step might I have to do. My guess is that I need to do the configuration-function. But I dont understand which data (uint8t) I have to send to the ADC within this function:
uint8_t MAX11615_Configuration(MAX11615* chip, uint8_t data){ data = data & (~0x80); // make REG bit 7 = 0 (configuration byte) if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) return 1; return 0; }
translated to:
uint8_t MAX11613::MAX11613_Configuration(structMAX11613* chip, uint8_t data){
data = data & (~0x80); // make REG bit 7 = 0 (configuration byte)
Wire.beginTransmission(chip->devAddress);
Wire.write(data);
Wire.endTransmission();
if (Wire.endTransmission() != 0) {
return 1;
} else {
return 0;
}
}
Or might I have to use this setup-function:
uint8_t MAX11613::MAX11613_Setup(structMAX11613* chip, uint8_t data){
/*data = data | 0x80; // make REG bit 7 = 1 (setup byte)
if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK)
return 1;
return 0;*/
Wire.begin();
data = data | 0x80; // make REG bit 7 = 1 (setup byte)
Wire.beginTransmission(chip->devAddress);
Wire.write(data);
if (Wire.endTransmission() != 0) {
return 1;
} else {
return 0;
}
}
Sorry for my many guesses, I don't know which step is missing to setup a translation of the potentiometer values from the adc to the ESP32.