@@ -70,9 +70,72 @@ extern "C" {
70
70
71
71
/**
72
72
* \defgroup hal_GeneralI2C I2C Configuration Functions
73
+ *
74
+ * # Defined behavior
75
+ * * ::i2c_init initialize the I2C peripheral
76
+ * * ::i2c_init sets the default parameters for I2C peripheral
77
+ * * ::i2c_init configures the pins used by I2C
78
+ * * ::i2c_frequency configure the I2C frequency
79
+ * * ::i2c_start sends START command
80
+ * * ::i2c_read reads `length` bytes from the I2C slave specified by `address` to the `data` buffer
81
+ * * ::i2c_read reads generates a stop condition on the bus at the end of the transfer if `stop` parameter is non-zero
82
+ * * ::i2c_read reads returns the number of symbols received from the bus
83
+ * * ::i2c_write writes `length` bytes to the I2C slave specified by `address` from the `data` buffer
84
+ * * ::i2c_write generates a stop condition on the bus at the end of the transfer if `stop` parameter is non-zero
85
+ * * ::i2c_write returns zero on success, error code otherwise
86
+ * * ::i2c_reset resets the I2C peripheral
87
+ * * ::i2c_byte_read reads and return one byte from the specfied I2C slave
88
+ * * ::i2c_byte_read uses `last` parameter to inform the slave that all bytes have been read
89
+ * * ::i2c_byte_write writes one byte to the specified I2C slave
90
+ * * ::i2c_byte_write returns 0 if NAK was received, 1 if ACK was received, 2 for timeout
91
+ * * ::i2c_slave_mode enables/disables I2S slave mode
92
+ * * ::i2c_slave_receive returns: 1 - read addresses, 2 - write to all slaves, 3 write addressed, 0 - the slave has not been addressed
93
+ * * ::i2c_slave_read reads `length` bytes from the I2C master to the `data` buffer
94
+ * * ::i2c_slave_read returns non-zero if a value is available, 0 otherwise
95
+ * * ::i2c_slave_write writes `length` bytes to the I2C master from the `data` buffer
96
+ * * ::i2c_slave_write returns non-zero if a value is available, 0 otherwise
97
+ * * ::i2c_slave_address configures I2C slave address
98
+ * * ::i2c_transfer_asynch starts I2C asynchronous transfer
99
+ * * ::i2c_transfer_asynch writes `tx_length` bytes to the I2C slave specified by `address` from the `tx` buffer
100
+ * * ::i2c_transfer_asynch reads `rx_length` bytes from the I2C slave specified by `address` to the `rx` buffer
101
+ * * ::i2c_transfer_asynch generates a stop condition on the bus at the end of the transfer if `stop` parameter is non-zero
102
+ * * The callback given to ::i2c_transfer_asynch is invoked when the transfer completes
103
+ * * ::i2c_transfer_asynch specifies the logical OR of events to be registered
104
+ * * The ::i2c_transfer_asynch function may use the `DMAUsage` hint to select the appropriate async algorithm
105
+ * * ::i2c_irq_handler_asynch returns event flags if a transfer termination condition was met, otherwise returns 0.
106
+ * * ::i2c_active returns non-zero if the I2C module is active or 0 if it is not
107
+ * * ::i2c_abort_asynch aborts an on-going async transfer
108
+ *
109
+ * # Undefined behavior
110
+ * * Calling ::i2c_init multiple times on the same `i2c_t`
111
+ * * Calling any function other than ::i2c_init on a non-initialized `i2c_t`
112
+ * * Initialising the `I2C` peripheral with invalid `SDA` and `SCL` pins.
113
+ * * Passing pins that cannot be on the same peripheral
114
+ * * Passing an invalid pointer as `obj` to any function
115
+ * * Use of a `null` pointer as an argument to any function.
116
+ * * Initialising the peripheral in slave mode if slave mode is not supported
117
+ * * Operating the peripheral in slave mode without first specifying and address using ::i2c_slave_address
118
+ * * Setting an address using i2c_slave_address after initialising the peripheral in master mode
119
+ * * Setting an address to an `I2C` reserved value
120
+ * * Specifying an invalid address when calling any `read` or `write` functions
121
+ * * Setting the length of the transfer or receive buffers to larger than the buffers are
122
+ * * Passing an invalid pointer as `handler`
123
+ * * Calling ::i2c_abort_async when no transfer is currently in progress
124
+ *
125
+ *
73
126
* @{
74
127
*/
75
128
129
+ /**
130
+ * \defgroup hal_GeneralI2C_tests I2C hal tests
131
+ * The I2C HAL tests ensure driver conformance to defined behaviour.
132
+ *
133
+ * To run the I2C hal tests use the command:
134
+ *
135
+ * mbed test -t <toolchain> -m <target> -n tests-mbed_hal_fpga_ci_test_shield-i2c
136
+ *
137
+ */
138
+
76
139
/** Initialize the I2C peripheral. It sets the default parameters for I2C
77
140
* peripheral, and configures its specifieds pins.
78
141
*
0 commit comments