Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DISCO_IOT-wifi_client
Fork of stm-spirit1-rf-driver by
Diff: source/SimpleSpirit1.cpp
- Revision:
- 48:373e1b7e424f
- Parent:
- 47:3a30b960a8c2
- Child:
- 49:d017830c0c67
--- a/source/SimpleSpirit1.cpp Thu Dec 22 08:25:22 2016 +0100
+++ b/source/SimpleSpirit1.cpp Thu Jan 12 08:20:43 2017 +0100
@@ -525,10 +525,10 @@
spirit_rx_len = pkt_basic_get_received_pkt_length();
#ifdef DEBUG_IRQ
- debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\n\rAssert failed in: %s (%d)\n\r", __func__, __LINE__);
+ debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\n\r%s (%d): irq=%x\n\r", __func__, __LINE__, *tmp);
#endif
- for(; _spirit_rx_pos < spirit_rx_len;) {
+ if(spirit_rx_len <= MAX_PACKET_LEN) {
uint8_t to_receive = spirit_rx_len - _spirit_rx_pos;
if(to_receive > 0) {
spi_read_linear_fifo(to_receive, &spirit_rx_buf[_spirit_rx_pos]);
@@ -542,7 +542,7 @@
last_sqi = qi_get_sqi(); //MGR
/* call user callback */
- if(_current_irq_callback) {
+ if((_spirit_rx_pos == spirit_rx_len) && _current_irq_callback) {
_current_irq_callback(RX_DONE);
}
@@ -564,8 +564,14 @@
#endif
} else {
uint8_t fifo_available = linear_fifo_read_num_elements_rx_fifo();
- spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
- _spirit_rx_pos += fifo_available;
+ if((fifo_available + _spirit_rx_pos) <= MAX_PACKET_LEN) {
+ spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
+ _spirit_rx_pos += fifo_available;
+ } else {
+#ifdef DEBUG_IRQ
+ debug("\n\r%s (%d): irq=%x\n\r", __func__, __LINE__, *tmp);
+#endif
+ }
}
}
#endif // !RX_FIFO_THR_WA
