From c105d111af883d58463b5a6c6a23d176d1aa2bb5 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 10 Feb 2022 11:42:28 +0000 Subject: [PATCH] ICP10125: Fix block indefinitely on repeated start Should fix pimoroni/icp10125-python#2 --- drivers/icp10125/icp10125.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/icp10125/icp10125.cpp b/drivers/icp10125/icp10125.cpp index 5a2cf9a3..6ed4ce6e 100644 --- a/drivers/icp10125/icp10125.cpp +++ b/drivers/icp10125/icp10125.cpp @@ -39,7 +39,7 @@ namespace pimoroni { } void ICP10125::reset() { - uint16_t command = SOFT_RESET; + uint16_t command = __bswap16(SOFT_RESET); i2c->write_blocking(address, (uint8_t *)&command, 2, false); sleep_ms(10); // Soft reset time is 170us but you can never be too sure... } @@ -86,7 +86,7 @@ namespace pimoroni { uint16_result result; uint16_t command = __bswap16(READ_ID); - i2c->write_blocking(address, (uint8_t *)&command, 2, false); + i2c->write_blocking(address, (uint8_t *)&command, 2, true); i2c->read_blocking(address, (uint8_t *)&result, 3, false); if(result.crc8 != crc8((uint8_t *)&result.data, 2)) {