cc1200: make pending_packet work even when interrupt handler was not called

This commit is contained in:
Simon Duquennoy 2018-10-03 14:16:54 +02:00
parent 90264a3ba3
commit 0ef1ee6df5
1 changed files with 9 additions and 2 deletions

View File

@ -1026,9 +1026,16 @@ receiving_packet(void)
static int
pending_packet(void)
{
int ret;
ret = ((rx_pkt_len != 0) ? 1 : 0);
if(ret == 0 && !SPI_IS_LOCKED()) {
LOCK_SPI();
ret = (single_read(CC1200_NUM_RXBYTES) > 0);
RELEASE_SPI();
}
INFO("RF: Pending (%d)\n", ((rx_pkt_len != 0) ? 1 : 0));
return (rx_pkt_len != 0) ? 1 : 0;
INFO("RF: Pending (%d)\n", ret);
return ret;
}
/*---------------------------------------------------------------------------*/