summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Tomaszewski <kamil.tomaszewski@sony.com>2021-03-11 18:04:01 +0100
committerKamil Tomaszewski <kamil.tomaszewski@sony.com>2021-03-11 18:04:01 +0100
commit76d0870fba5a86813242c37ee653c1fc7e008c65 (patch)
tree36ebdd0b8da718897d2954b79ee52fb5b74fb624
parent15e97f12a1be8b2aa625b59d127b6d1db530a18b (diff)
spresense: return error as positive value for i2c
-rw-r--r--ports/cxd56/common-hal/busio/I2C.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/cxd56/common-hal/busio/I2C.c b/ports/cxd56/common-hal/busio/I2C.c
index 127b6e75c..5579bedeb 100644
--- a/ports/cxd56/common-hal/busio/I2C.c
+++ b/ports/cxd56/common-hal/busio/I2C.c
@@ -103,7 +103,7 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t address, cons
msg.flags = (stop ? 0 : I2C_M_NOSTOP);
msg.buffer = (uint8_t *) data;
msg.length = len;
- return I2C_TRANSFER(self->i2c_dev, &msg, 1);
+ return -I2C_TRANSFER(self->i2c_dev, &msg, 1);
}
uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t address, uint8_t *data, size_t len) {
@@ -114,7 +114,7 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t address, uint8
msg.flags = I2C_M_READ;
msg.buffer = data;
msg.length = len;
- return I2C_TRANSFER(self->i2c_dev, &msg, 1);
+ return -I2C_TRANSFER(self->i2c_dev, &msg, 1);
}
void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {