small changes and many new sensors

This commit is contained in:
2023-10-30 14:30:02 +01:00
parent 07917fe5ba
commit aad07c1b0a
21 changed files with 1642 additions and 297 deletions

View File

@@ -157,7 +157,7 @@ public:
Log::addInfo(NAME, "found %d", i);
}
waitLong();
if (i%16 == 0) {delay(10);}
//if (i%16 == 0) {DELAY_MS(10);}
}
}
@@ -219,6 +219,44 @@ public:
public:
/** similar to readReg() but without actually selecting a register */
bool readRaw(const uint8_t addr, const uint8_t len, uint8_t* dst) {
bool ok;
ok = startWrite(addr);
if (!ok) {Log::addInfo(NAME, "failed start read(1)"); return false;}
stop();
ok = startRead(addr);
if (!ok) {Log::addInfo(NAME, "failed start read(2)"); return false;}
readBytes(dst, len);
stop();
return true;
}
/** similar to writeReg() but without actually selecting a register */
bool writeRaw(const uint8_t addr, const uint8_t len, const uint8_t* src) {
bool ok;
// address the slave in write mode and select the first register to read
ok = startWrite(addr);
if (!ok) {Log::addInfo(NAME, "failed start write"); return false;}
ok = writeBytesAndCheck(src, len);
if (!ok) {Log::addInfo(NAME, "failed to write register contents"); return false;}
stop();
return true;
}