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: SimpleSpirit1.h
- Revision:
- 14:898a9d48dd03
- Parent:
- 12:b8056eda4028
- Child:
- 16:25dc4b811ad3
--- a/SimpleSpirit1.h Wed Nov 02 15:33:34 2016 +0100
+++ b/SimpleSpirit1.h Fri Nov 04 15:29:59 2016 +0100
@@ -16,6 +16,15 @@
/*** Macros from Cube Implementation ***/
+#define CLEAR_TXBUF() (spirit_tx_len = 0)
+#define IS_RXBUF_EMPTY() (spirit_rx_len == 0)
+#define CLEAR_RXBUF() do { \
+ spirit_rx_len = 0; \
+ _spirit_rx_pos = 0; \
+ } while(0)
+
+
+/*** Macros from Cube Implementation ***/
/* transceiver state. */
#define ON 0
#define OFF 1
@@ -59,6 +68,26 @@
DigitalOut _led; // PB_4 (D5) (optional)
Callback<void(int)> _current_irq_callback;
+ Timeout _rx_receiving_timeout;
+
+ void rx_timeout_handler(void) {
+ set_ready_state();
+ cmd_strobe(SPIRIT1_STROBE_FRX);
+ cmd_strobe(SPIRIT1_STROBE_RX);
+ CLEAR_TXBUF();
+ CLEAR_RXBUF();
+ _spirit_rx_err = false;
+ _spirit_tx_started = false;
+ printf("%s (%d)\n", __func__, __LINE__);
+ }
+
+ void start_rx_timeout(void) {
+ _rx_receiving_timeout.attach_us(Callback<void()>(this, &SimpleSpirit1::rx_timeout_handler), 500 * 1000); // 5ms
+ }
+
+ void stop_rx_timeout(void) {
+ _rx_receiving_timeout.detach();
+ }
/** Static Variables from Cube Implementation **/
/*
