cc3000 driver with expanded buffers.
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000_spi.cpp
- Revision:
- 57:8caf996d7b6a
- Parent:
- 56:9ab991c1d2db
--- a/cc3000_spi.cpp Tue May 06 22:38:34 2014 +0000 +++ b/cc3000_spi.cpp Wed May 07 02:53:08 2014 +0000 @@ -106,6 +106,7 @@ uint32_t cc3000_spi::write(uint8_t *buffer, uint16_t length) { uint8_t pad = 0; + uint32_t escapeCounter; // check the total length of the packet in order to figure out if padding is necessary if(!(length & 0x0001)) { pad++; @@ -126,7 +127,12 @@ } if (_spi_info.spi_state == eSPI_STATE_POWERUP) { - while (_spi_info.spi_state != eSPI_STATE_INITIALIZED); + escapeCounter = 100000000; + while (_spi_info.spi_state != eSPI_STATE_INITIALIZED) { + escapeCounter--; + if (!escapeCounter) + break; + } } if (_spi_info.spi_state == eSPI_STATE_INITIALIZED) { @@ -137,7 +143,12 @@ // device, so the state will move to IDLE and once again to not IDLE due to IRQ wlan_irq_disable(); - while (_spi_info.spi_state != eSPI_STATE_IDLE); + escapeCounter = 100000000; + while (_spi_info.spi_state != eSPI_STATE_IDLE){ + escapeCounter--; + if (!escapeCounter) + break; + } _spi_info.spi_state = eSPI_STATE_WRITE_IRQ; //_spi_info.pTxPacket = buffer; @@ -150,8 +161,12 @@ } // Wait until the transaction ends - while (_spi_info.spi_state != eSPI_STATE_IDLE); - + escapeCounter = 100000000; + while (_spi_info.spi_state != eSPI_STATE_IDLE) { + escapeCounter--; + if (!escapeCounter) + break; + } return 0; }