mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 05:53:49 +01:00
nrf5x_common: Clear I2C periph shorts
The I2C peripheral's shortcuts are used with the read and write register to automatically stop the I2C transaction or to continue with the next stage. With simple I2C read and write bytes these shorts are not used, but are also not cleared by the function in all cases, causing it to use the shortcut configuration set by a previous function call. This patch ensures that the shorts are always set by the read and write functions
This commit is contained in:
parent
e2c5ea0009
commit
e5d25e0b04
@ -251,6 +251,9 @@ int i2c_read_bytes(i2c_t dev, uint16_t addr, void *data, size_t len,
|
||||
if (!(flags & I2C_NOSTOP)) {
|
||||
bus(dev)->SHORTS = TWIM_SHORTS_LASTRX_STOP_Msk;
|
||||
}
|
||||
else {
|
||||
bus(dev)->SHORTS = 0;
|
||||
}
|
||||
/* Start transmission */
|
||||
bus(dev)->TASKS_STARTRX = 1;
|
||||
|
||||
@ -309,6 +312,9 @@ int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data, size_t len,
|
||||
if (!(flags & I2C_NOSTOP)) {
|
||||
bus(dev)->SHORTS = TWIM_SHORTS_LASTTX_STOP_Msk;
|
||||
}
|
||||
else {
|
||||
bus(dev)->SHORTS = 0;
|
||||
}
|
||||
bus(dev)->TASKS_STARTTX = 1;
|
||||
|
||||
return finish(dev);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user