@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
i2c_slave.h
Go to the documentation of this file.
/*
* Copyright (c) 2021 Valentin Milea <valentin.milea@gmail.com>
* Copyright (c) 2023 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _PICO_I2C_SLAVE_H
#define _PICO_I2C_SLAVE_H
#include "hardware/i2c.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum i2c_slave_event_t
{
I2C_SLAVE_RECEIVE,
I2C_SLAVE_REQUEST,
I2C_SLAVE_FINISH,
} i2c_slave_event_t;
typedef void (*i2c_slave_handler_t)(i2c_inst_t *i2c, i2c_slave_event_t event);
void i2c_slave_init(i2c_inst_t *i2c, uint8_t address, i2c_slave_handler_t handler);
void i2c_slave_deinit(i2c_inst_t *i2c);
#ifdef __cplusplus
}
#endif
#endif // _PICO_I2C_SLAVE_H_
i2c_slave_init
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_t
I2C slave event types.
Definition i2c_slave.h:34
i2c_slave_deinit
void i2c_slave_deinit(i2c_inst_t *i2c)
Restore an I2C instance to master mode.
Definition i2c_slave.c:80
i2c_slave_handler_t
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
@ I2C_SLAVE_REQUEST
Master is requesting data. Slave must write into Tx FIFO.
Definition i2c_slave.h:36
I2C_SLAVE_RECEIVE
@ I2C_SLAVE_RECEIVE
Data from master is available for reading. Slave must read from Rx FIFO.
Definition i2c_slave.h:35
I2C_SLAVE_FINISH
@ I2C_SLAVE_FINISH
Master has sent a Stop or Restart signal. Slave may prepare for the next transfer.
Definition i2c_slave.h:37
i2c.h