Fix two i2c error code return errors (#2375)

This commit is contained in:
Otto Winter 2021-09-22 20:07:43 +02:00 committed by GitHub
parent edb557f79e
commit b398d826c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -12,7 +12,9 @@ namespace pn532_i2c {
static const char *const TAG = "pn532_i2c"; static const char *const TAG = "pn532_i2c";
bool PN532I2C::write_data(const std::vector<uint8_t> &data) { return this->write(data.data(), data.size()); } bool PN532I2C::write_data(const std::vector<uint8_t> &data) {
return this->write(data.data(), data.size()) == i2c::ERROR_OK;
}
bool PN532I2C::read_data(std::vector<uint8_t> &data, uint8_t len) { bool PN532I2C::read_data(std::vector<uint8_t> &data, uint8_t len) {
delay(1); delay(1);

View file

@ -198,7 +198,7 @@ bool SCD30Component::write_command_(uint16_t command, uint16_t data) {
raw[2] = data >> 8; raw[2] = data >> 8;
raw[3] = data & 0xFF; raw[3] = data & 0xFF;
raw[4] = sht_crc_(raw[2], raw[3]); raw[4] = sht_crc_(raw[2], raw[3]);
return this->write(raw, 5); return this->write(raw, 5) == i2c::ERROR_OK;
} }
uint8_t SCD30Component::sht_crc_(uint8_t data1, uint8_t data2) { uint8_t SCD30Component::sht_crc_(uint8_t data1, uint8_t data2) {