Skip to content

Commit 7a9ce24

Browse files
committed
i2c_eeprom_asynch.cpp test passed
1 parent 994c59d commit 7a9ce24

File tree

1 file changed

+2
-3
lines changed
  • libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H

1 file changed

+2
-3
lines changed

libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/i2c_api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,6 @@ static void i2c_transfer_finished(i2c_t *obj)
804804
uint32_t index = obj->i2c.i2c;
805805
i2c_data[index].event = I2C_EVENT_TRANSFER_COMPLETE;
806806
i2c_data[index].async_obj = NULL;
807-
i2c_irqs_set(obj, 0);
808807
((void (*)())i2c_data[index].async_callback)();
809808
}
810809

@@ -817,6 +816,7 @@ static void i2c_tx_irq(IRQn_Type irq_num, uint32_t index)
817816
i2c_data[index].event = I2C_EVENT_ERROR | I2C_EVENT_TRANSFER_EARLY_NACK;
818817
i2c_abort_asynch(obj);
819818
((void (*)())i2c_data[index].async_callback)();
819+
return;
820820
}
821821
if (obj->tx_buff.pos == obj->tx_buff.length) {
822822
/* All datas have tranferred */
@@ -1070,7 +1070,6 @@ static void i2c_irqs_set(i2c_t *obj, uint32_t enable)
10701070
void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint)
10711071
{
10721072
MBED_ASSERT(obj);
1073-
MBED_ASSERT(tx || rx);
10741073
MBED_ASSERT(tx ? tx_length : 1);
10751074
MBED_ASSERT(rx ? rx_length : 1);
10761075
MBED_ASSERT((REG(SER.UINT32) & SER_SAR0E) == 0); /* Slave mode */
@@ -1102,7 +1101,7 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx,
11021101
}
11031102
obj->i2c.last_stop_flag = stop;
11041103

1105-
if (tx_length == 0) {
1104+
if (rx_length && tx_length == 0) {
11061105
/* Ready to read */
11071106
i2c_set_MR3_ACK(obj);
11081107

0 commit comments

Comments
 (0)