mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(i2c_slave): filter out fake request for esp32
Closes https://github.com/espressif/esp-idf/issues/18268
This commit is contained in:
@@ -183,7 +183,7 @@ IRAM_ATTR static void i2c_slave_isr_handler(void *arg)
|
||||
if (slave_rw == I2C_SLAVE_READ_BY_MASTER) {
|
||||
#if !SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE
|
||||
i2c_slave_request_event_data_t evt_data = {};
|
||||
if (i2c_slave->request_callback) {
|
||||
if (i2c_slave->request_callback && i2c_ll_slave_wait_ack(hal->dev)) {
|
||||
pxHigherPriorityTaskWoken |= i2c_slave->request_callback(i2c_slave, &evt_data, i2c_slave->user_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -875,6 +875,18 @@ static inline i2c_slave_read_write_status_t i2c_ll_slave_get_read_write_status(i
|
||||
return (hw->status_reg.slave_rw == 0) ? I2C_SLAVE_WRITE_BY_MASTER : I2C_SLAVE_READ_BY_MASTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the slave is waiting for ACK
|
||||
*
|
||||
* @param hw Beginning address of the peripheral registers
|
||||
* @return true if this slave is waiting for ACK, false otherwise
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline bool i2c_ll_slave_wait_ack(i2c_dev_t *hw)
|
||||
{
|
||||
return hw->status_reg.scl_main_state_last == 6;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////Deprecated Functions//////////////////////////////////////////////////////////
|
||||
/////////////////////////////The following functions are only used by the legacy driver/////////////////////////////////
|
||||
/////////////////////////////They might be removed in the next major release (ESP-IDF 6.0)//////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user