Skip to content
Commit e7487f17 authored by Bjarki Arge Andreasen's avatar Bjarki Arge Andreasen Committed by Carles Cufí
Browse files

drivers: i2c: enforce i2c stop flag in last i2c_transfer msg



The i2c_transfer API specifies that the I2C_MSG_STOP flag implicitly
is set for the last message in a i2c_transfer(). This is identical to
explicitly setting the I2C_MSG_STOP flag in the last message, which is
what every driver which properly adheres to this specification does.

This commit updates the i2c_transfer() API wrapper to explicitly set
the flag before calling the drivers API implementation, which ensures
the specification is followed, while moving this additional complexity
from the device drivers themselves.

Additinally it checks for the num_msgs being 0, in which case no
transfer shall occur, nor shall any stop condition be set. This removes
an additional check from device drivers.

Signed-off-by: default avatarBjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
parent bd7a6b5d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment