cc3000 driver with expanded buffers.

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Revision:
52:ad6514e66b3b
Parent:
51:a3f8d6de71b4
Child:
53:66e86aa98dbe
--- a/cc3000_spi.cpp	Mon May 05 18:00:59 2014 +0000
+++ b/cc3000_spi.cpp	Tue May 06 07:57:01 2014 +0000
@@ -122,10 +122,9 @@
     // If the magic number is overwitten - buffer overrun occurred - we will be stuck here forever!
     uint8_t *transmit_buffer = _simple_link.get_transmit_buffer();
     if (transmit_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
-        // let's not get stuck forever, that would suck.  - jls
-        
-        //NVIC_SystemReset();
-        while (1);
+        // we're probably going to die anyway, if a real buffer overrun has happened.
+        // try to fix it up and go anyway. - jls
+        transmit_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
     }
 
     if (_spi_info.spi_state == eSPI_STATE_POWERUP) {
@@ -211,7 +210,7 @@
     return 0;
 }
 
-void cc3000_spi::set_wlan_en(uint8_t value) {
+inline void cc3000_spi::set_wlan_en(uint8_t value) {
     if (value) {
         _wlan_en = 1;
     } else {
@@ -241,9 +240,9 @@
                 // If the magic number is overwitten - buffer overrun occurred - we will be stuck here forever!
                 uint8_t *received_buffer = _simple_link.get_received_buffer();
                 if (received_buffer[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER) {
-                    // again, I don't like this plan.  - jls
-                    //NVIC_SystemReset();
-                    while (1);
+                    // we're probably going to die anyway, if a real buffer overrun has happened.
+                    // try to fix it up and go anyway. - jls
+                    received_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
                 }
 
                 _spi_info.spi_state = eSPI_STATE_IDLE;