Add some missing i2c function documentation (#1650)

Add i2c_get_index for consistency - just calls i2c_hw_index
This commit is contained in:
Peter Harper 2024-05-19 22:36:27 +01:00 committed by GitHub
parent f1f3bd6bf6
commit 0d56f52b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -148,11 +148,33 @@ static inline uint i2c_hw_index(i2c_inst_t *i2c) {
return i2c == i2c1 ? 1 : 0;
}
/*! \brief Convert I2C instance to hardware instance number
* \ingroup hardware_i2c
*
* \param i2c I2C instance
* \return Number of I2C, 0 or 1.
*/
static inline uint i2c_get_index(i2c_inst_t *i2c) {
return i2c_hw_index(i2c);
}
/*! \brief Return pointer to structure containing i2c hardware registers
* \ingroup hardware_i2c
*
* \param i2c I2C instance
* \return pointer to \ref i2c_hw_t
*/
static inline i2c_hw_t *i2c_get_hw(i2c_inst_t *i2c) {
i2c_hw_index(i2c); // check it is a hw i2c
return i2c->hw;
}
/*! \brief Convert I2C hardware instance number to I2C instance
* \ingroup hardware_i2c
*
* \param Number of I2C, 0 or 1
* \return I2C hardware instance
*/
static inline i2c_inst_t *i2c_get_instance(uint instance) {
static_assert(NUM_I2CS == 2, "");
invalid_params_if(I2C, instance >= NUM_I2CS);