8000 Fixes for #321 · ViaMonkey/esp32-snippets@37a5652 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37a5652

Browse files
committed
Fixes for nkolban#321
1 parent 7f9ccb5 commit 37a5652

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp_utils/I2C.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void I2C::read(uint8_t* bytes, size_t length, bool ack) {
143143
ESP_LOGE(LOG_TAG, "i2c_master_write_byte: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
144144
}
145145
}
146-
esp_err_t errRc = ::i2c_master_read(m_cmd, bytes, length, !ack);
146+
esp_err_t errRc = ::i2c_master_read(m_cmd, bytes, length, ack?I2C_MASTER_ACK:I2C_MASTER_NACK);
147147
if (errRc != ESP_OK) {
148148
ESP_LOGE(LOG_TAG, "i2c_master_read: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
149149
}
@@ -168,7 +168,7 @@ void I2C::read(uint8_t *byte, bool ack) {
168168
ESP_LOGE(LOG_TAG, "i2c_master_write_byte: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
169169
}
170170
}
171-
ESP_ERROR_CHECK(::i2c_master_read_byte(m_cmd, byte, !ack));
171+
ESP_ERROR_CHECK(::i2c_master_read_byte(m_cmd, byte, ack?I2C_MASTER_ACK:I2C_MASTER_NACK));
172172
} // readByte
173173

174174

0 commit comments

Comments
 (0)
0