i2c_slave.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Valentin Milea <[email protected]>
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
14extern "C" {
15#endif
16
34{
39
53
62void i2c_slave_init(i2c_inst_t *i2c, uint8_t address, i2c_slave_handler_t handler);
63
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif // _PICO_I2C_SLAVE_H_
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:56
i2c_slave_event_t
I2C slave event types.
Definition: i2c_slave.h:34
void i2c_slave_deinit(i2c_inst_t *i2c)
Restore an I2C instance to master mode.
Definition: i2c_slave.c:81
void(* i2c_slave_handler_t)(i2c_inst_t *i2c, i2c_slave_event_t event)
I2C slave event handler.
Definition: i2c_slave.h:52
@ I2C_SLAVE_REQUEST
Master is requesting data. Slave must write into Tx FIFO.
Definition: i2c_slave.h:36
@ I2C_SLAVE_RECEIVE
Data from master is available for reading. Slave must read from Rx FIFO.
Definition: i2c_slave.h:35
@ I2C_SLAVE_FINISH
Master has sent a Stop or Restart signal. Slave may prepare for the next transfer.
Definition: i2c_slave.h:37
Definition: i2c.h:151