Skip to content

Commit 63fbaaf

Browse files
Add documentation for I2C_EVENT macros
1 parent 0751932 commit 63fbaaf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

hal/include/hal/i2c_api.h

+26
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,36 @@
3535
*
3636
* @{
3737
*/
38+
39+
/**
40+
* Indicates that an unspecified error has occurred in the transfer. This usually means
41+
* either an internal error in the Mbed MCU's I2C module, or something like an arbitration loss.
42+
* Does not indicate a NACK.
43+
*/
3844
#define I2C_EVENT_ERROR (1 << 1)
45+
46+
/**
47+
* Indicates that the slave did not respond to the address byte of the transfer.
48+
*/
3949
#define I2C_EVENT_ERROR_NO_SLAVE (1 << 2)
50+
51+
/**
52+
* Indicates that the transfer completed successfully.
53+
*/
4054
#define I2C_EVENT_TRANSFER_COMPLETE (1 << 3)
55+
56+
/**
57+
* Indicates that a NACK was received after the address byte, but before the requested number of bytes
58+
* could be transferred.
59+
*
60+
* Note: Not every manufacturer HAL is able to make a distinction between this flag and #I2C_EVENT_ERROR_NO_SLAVE.
61+
* On a NACK, you might conceivably get one or both of these flags.
62+
*/
4163
#define I2C_EVENT_TRANSFER_EARLY_NACK (1 << 4)
64+
65+
/**
66+
* Use this macro to request all possible I2C events.
67+
*/
4268
#define I2C_EVENT_ALL (I2C_EVENT_ERROR | I2C_EVENT_TRANSFER_COMPLETE | I2C_EVENT_ERROR_NO_SLAVE | I2C_EVENT_TRANSFER_EARLY_NACK)
4369

4470
/**@}*/

0 commit comments

Comments
 (0)