Skip to content

Commit f54ca1a

Browse files
authored
Add/tidy API doxygen for the new pico_i2c_slave library (#1233)
1 parent 8c8006d commit f54ca1a

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/rp2_common/pico_i2c_slave/include/pico/i2c_slave.h

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ extern "C" {
1515
#endif
1616

1717
/** \file pico/i2c_slave.h
18-
* \defgrup pico_i2c_slave pico_i2c_slave
19-
* \brief I2C slave helper library, which takes care of hooking the I2C IRQ and calling back the user with I2C events.
18+
* \defgroup pico_i2c_slave pico_i2c_slave
19+
*
20+
* Functions providing an interrupt driven I2C slave interface.
21+
*
22+
* This I2C slave helper library configures slave mode and hooks the relevant I2C IRQ
23+
* so that a user supplied handler is called with enumerated I2C events.
24+
*
25+
* An example application \c slave_mem_i2c, which makes use of this library, can be found in
26+
* <a href="https://github.com/raspberrypi/pico-examples/blob/master/i2c/slave_mem_i2c/slave_mem_i2c.c">pico_examples</a>.
2027
*/
2128

2229
/**
2330
* \brief I2C slave event types.
31+
* \ingroup pico_i2c_slave
2432
*/
2533
typedef enum i2c_slave_event_t
2634
{
@@ -31,31 +39,32 @@ typedef enum i2c_slave_event_t
3139

3240
/**
3341
* \brief I2C slave event handler
42+
* \ingroup pico_i2c_slave
3443
*
3544
* The event handler will run from the I2C ISR, so it should return quickly (under 25 us at 400 kb/s).
3645
* Avoid blocking inside the handler and split large data transfers across multiple calls for best results.
37-
* When sending data to master, up to `i2c_get_write_available()` bytes can be written without blocking.
38-
* When receiving data from master, up to `i2c_get_read_available()` bytes can be read without blocking.
39-
*
40-
* \param i2c Slave I2C instance.
46+
* When sending data to master, up to \ref i2c_get_write_available() bytes can be written without blocking.
47+
* When receiving data from master, up to \ref 2c_get_read_available() bytes can be read without blocking.
48+
*
49+
* \param i2c Either \ref i2c0 or \ref i2c1
4150
* \param event Event type.
4251
*/
4352
typedef void (*i2c_slave_handler_t)(i2c_inst_t *i2c, i2c_slave_event_t event);
4453

4554
/**
46-
* \brief Configure I2C instance for slave mode.
47-
*
55+
* \brief Configure an I2C instance for slave mode.
56+
* \ingroup pico_i2c_slave
4857
* \param i2c I2C instance.
4958
* \param address 7-bit slave address.
50-
* \param handler Called on events from I2C master. It will run from the I2C ISR, on the CPU core
51-
* where the slave was initialized.
59+
* \param handler Callback for events from I2C master. It will run from the I2C ISR, on the CPU core
60+
* where the slave was initialised.
5261
*/
5362
void i2c_slave_init(i2c_inst_t *i2c, uint8_t address, i2c_slave_handler_t handler);
5463

5564
/**
56-
* \brief Restore I2C instance to master mode.
57-
*
58-
* \param i2c I2C instance.
65+
* \brief Restore an I2C instance to master mode.
66+
* \ingroup pico_i2c_slave
67+
* \param i2c Either \ref i2c0 or \ref i2c1
5968
*/
6069
void i2c_slave_deinit(i2c_inst_t *i2c);
6170

0 commit comments

Comments
 (0)