@@ -15,12 +15,20 @@ extern "C" {
15
15
#endif
16
16
17
17
/** \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>.
20
27
*/
21
28
22
29
/**
23
30
* \brief I2C slave event types.
31
+ * \ingroup pico_i2c_slave
24
32
*/
25
33
typedef enum i2c_slave_event_t
26
34
{
@@ -31,31 +39,32 @@ typedef enum i2c_slave_event_t
31
39
32
40
/**
33
41
* \brief I2C slave event handler
42
+ * \ingroup pico_i2c_slave
34
43
*
35
44
* The event handler will run from the I2C ISR, so it should return quickly (under 25 us at 400 kb/s).
36
45
* 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
41
50
* \param event Event type.
42
51
*/
43
52
typedef void (* i2c_slave_handler_t )(i2c_inst_t * i2c , i2c_slave_event_t event );
44
53
45
54
/**
46
- * \brief Configure I2C instance for slave mode.
47
- *
55
+ * \brief Configure an I2C instance for slave mode.
56
+ * \ingroup pico_i2c_slave
48
57
* \param i2c I2C instance.
49
58
* \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 .
52
61
*/
53
62
void i2c_slave_init (i2c_inst_t * i2c , uint8_t address , i2c_slave_handler_t handler );
54
63
55
64
/**
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
59
68
*/
60
69
void i2c_slave_deinit (i2c_inst_t * i2c );
61
70
0 commit comments