Skip to content

Commit 0c2ee4f

Browse files
Add some additional I2C error codes
1 parent 63fbaaf commit 0c2ee4f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hal/include/hal/i2c_api.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ typedef struct i2c_s i2c_t;
8787

8888
enum {
8989
I2C_ERROR_NO_SLAVE = -1,
90-
I2C_ERROR_BUS_BUSY = -2
90+
I2C_ERROR_BUS_BUSY = -2,
91+
I2C_ERROR_INVALID_USAGE = -3 ///< Invalid usage of the I2C API, e.g. by mixing single-byte and transactional function calls.
9192
};
9293

9394
typedef struct {
@@ -255,7 +256,7 @@ int i2c_byte_read(i2c_t *obj, int last);
255256
*
256257
* @param obj The I2C object
257258
* @param data Byte to be written
258-
* @return 0 if NAK was received, 1 if ACK was received, 2 for timeout.
259+
* @return 0 if NAK was received, 1 if ACK was received, 2 for timeout, or 3 for other error.
259260
*/
260261
int i2c_byte_write(i2c_t *obj, int data);
261262

0 commit comments

Comments
 (0)