Skip to content

Commit e96f6bf

Browse files
committed
SPI should notify internal complete
1 parent 50e79a4 commit e96f6bf

File tree

1 file changed

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

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ static void spi_rx_irq(IRQn_Type irq_num, uint32_t index)
321321
spi_async_read(obj);
322322
} else {
323323
if (obj->rx_buff.buffer && obj->tx_buff.buffer && obj->tx_buff.pos < obj->tx_buff.length) {
324-
spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
324+
spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
325+
if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
326+
spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
327+
}
325328
spi_irqs_set(obj, 0);
326329
spi_data[obj->spi.index].async_obj = NULL;
327330
((void (*)())spi_data[obj->spi.index].async_callback)();
@@ -331,7 +334,10 @@ static void spi_rx_irq(IRQn_Type irq_num, uint32_t index)
331334
}
332335
if (obj->tx_buff.buffer) {
333336
if (obj->tx_buff.pos == obj->tx_buff.length) {
334-
spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
337+
spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
338+
if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
339+
spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
340+
}
335341
spi_irqs_set(obj, 0);
336342
spi_data[obj->spi.index].async_obj = NULL;
337343
((void (*)())spi_data[obj->spi.index].async_callback)();
@@ -340,7 +346,10 @@ static void spi_rx_irq(IRQn_Type irq_num, uint32_t index)
340346
}
341347
} else {
342348
if (obj->rx_buff.pos == obj->rx_buff.length) {
343-
spi_data[obj->spi.index].event = SPI_EVENT_COMPLETE;
349+
spi_data[obj->spi.index].event = SPI_EVENT_INTERNAL_TRANSFER_COMPLETE;
350+
if (spi_data[obj->spi.index].wanted_events & SPI_EVENT_COMPLETE) {
351+
spi_data[obj->spi.index].event |= SPI_EVENT_COMPLETE;
352+
}
344353
spi_irqs_set(obj, 0);
345354
spi_data[obj->spi.index].async_obj = NULL;
346355
((void (*)())spi_data[obj->spi.index].async_callback)();

0 commit comments

Comments
 (0)