i2c_slave.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Valentin Milea <valentin.milea@gmail.com>
3  * Copyright (c) 2023 Raspberry Pi (Trading) Ltd.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef _PICO_I2C_SLAVE_H
9 #define _PICO_I2C_SLAVE_H
10 
11 #include "hardware/i2c.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
33 typedef enum i2c_slave_event_t
34 {
39 
52 typedef void (*i2c_slave_handler_t)(i2c_inst_t *i2c, i2c_slave_event_t event);
53 
62 void i2c_slave_init(i2c_inst_t *i2c, uint8_t address, i2c_slave_handler_t handler);
63 
69 void i2c_slave_deinit(i2c_inst_t *i2c);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif // _PICO_I2C_SLAVE_H_
void i2c_slave_deinit(i2c_inst_t *i2c)
Restore an I2C instance to master mode.
Definition: i2c_slave.c:85
Definition: i2c_slave.h:37
Definition: i2c_slave.h:35
void(* i2c_slave_handler_t)(i2c_inst_t *i2c, i2c_slave_event_t event)
I2C slave event handlerThe event handler will run from the I2C ISR, so it should return quickly (unde...
Definition: i2c_slave.h:52
Definition: i2c.h:135
Definition: i2c_slave.h:36
i2c_slave_event_t
I2C slave event types.
Definition: i2c_slave.h:33
void i2c_slave_init(i2c_inst_t *i2c, uint8_t address, i2c_slave_handler_t handler)
Configure an I2C instance for slave mode.
Definition: i2c_slave.c:60