From e4074602439ca64ab531a7cdc265975b082e59af Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 24 Nov 2023 10:03:07 +0100 Subject: [PATCH] cpu/nrf51: fix periph_i2c driver The `i2c_read_bytes()` and `i2c_write_bytes()` function return the number of bytes written / read, instead of `0` as the API contract says. This fixes the issue. --- cpu/nrf51/periph/i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/nrf51/periph/i2c.c b/cpu/nrf51/periph/i2c.c index cd2efd09e9..4bfd801655 100644 --- a/cpu/nrf51/periph/i2c.c +++ b/cpu/nrf51/periph/i2c.c @@ -103,7 +103,7 @@ static int write(i2c_t dev, uint16_t addr, const void *data, int len, } } - return len; + return 0; } void i2c_init(i2c_t dev) @@ -198,7 +198,7 @@ int i2c_read_bytes(i2c_t dev, uint16_t address, void *data, size_t length, while (i2c(dev)->EVENTS_STOPPED == 0) {} NRF_PPI->CHENCLR = (1 << i2c_config[dev].ppi); - return length; + return 0; } int i2c_read_regs(i2c_t dev, uint16_t address, uint16_t reg,