extern "C" { #include } #include "../global.h" #include "../configs/ds1803/ds1803.h" #include "ds1803.h" DS1803::DS1803() { #ifdef WIRE_LIB_SCAN_MOD /*if (!Wire.isStarted())*/ Wire.begin(); #else Wire.begin(); #endif } /** * Instantiate the object **/ DS1803 DPOT = DS1803(); void DS1803::setWiper(uint8_t value, uint8_t wiperAddr) { if (!Wire.checkAddress(DS1803_ADDR)) return; Wire.beginTransmission(DS1803_ADDR); Wire.send(wiperAddr); // Send the wiper address Wire.send(value); Wire.endTransmission(); } #ifdef DS1803_USE_GET_VALUE_FUNC uint8_t DS1803::getValue() { if (!Wire.checkAddress(DS1803_ADDR)) return; Wire.requestFrom(DS1803_ADDR, 2); while (Wire.available()) { Serial.println((uint8_t)Wire.receive(), DEC); } return 0; } #endif