1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/nrf52 i2c: Add shortcut when data is in RAM

See-Also: https://github.com/RIOT-OS/RIOT/pull/20298#discussion_r1466508505
This commit is contained in:
chrysn 2024-01-25 16:20:32 +01:00
parent b80d1e622f
commit 52a976e147

View File

@ -340,6 +340,10 @@ int i2c_read_regs(i2c_t dev, uint16_t addr, uint16_t reg,
int i2c_write_bytes(i2c_t dev, uint16_t addr, const void *data, size_t len,
uint8_t flags)
{
if ((unsigned int)data >= CPU_RAM_BASE && (unsigned int)data < CPU_RAM_BASE + CPU_RAM_SIZE) {
return direct_i2c_write_bytes(dev, addr, data, len, flags);
}
/* These are critical for the memcpy; direct_i2c_write_bytes makes some
* more */
assert((len > 0) && (len < 256));