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.
Diff: simplelink/cc3100_spi.cpp
- Revision:
- 17:acc075ff3fcb
- Parent:
- 16:7e5aab2fabba
- Child:
- 19:3dd3e7f30f8b
--- a/simplelink/cc3100_spi.cpp Sun Aug 30 21:10:11 2015 +0000
+++ b/simplelink/cc3100_spi.cpp Mon Aug 31 15:20:36 2015 +0000
@@ -54,8 +54,8 @@
: /*_sw1_irq(button1_irq), _sw2_irq(button2_irq),*/ _wlan_irq(cc3100_irq), _wlan_nHIB(cc3100_nHIB), _wlan_cs(cc3100_cs), _wlan_spi(cc3100_spi), _driver(driver)
{
- _wlan_spi.format(8,1);
- _wlan_spi.frequency(16000000);
+ _wlan_spi.format(8,0);//Note Mode 0
+ _wlan_spi.frequency(12000000);
_wlan_irq.rise(this, &cc3100_spi::IntSpiGPIOHandler); //_SlDrvRxIrqHandler is called from IntSpiGPIOHandler
// _sw1_irq.rise(this, &cc3100_spi::buttonHandler_1);
// _sw2_irq.rise(this, &cc3100_spi::buttonHandler_2);
@@ -126,9 +126,6 @@
Fd_t cc3100_spi::spi_Open(int8_t *ifName, uint32_t flags)
{
- // 50 ms delay
- // wait_ms(50);
-
// Enable WLAN interrupt
cc3100_InterruptEnable();
@@ -138,16 +135,14 @@
int cc3100_spi::spi_Write(Fd_t fd, uint8_t *pBuff, int len)
{
int len_to_return = len;
-// Uart_Write((uint8_t*)"Write\r\n");
+
_wlan_cs = 0;
-// for(int i = 0;i<len;i++){
-// printf(" %x",pBuff[i]);
-// }
+
while(len) {
_wlan_spi.write(*pBuff++);
len--;
}
-// printf("\r\n");
+
_wlan_cs = 1;
return len_to_return;
@@ -156,21 +151,20 @@
int cc3100_spi::spi_Read(Fd_t fd, uint8_t *pBuff, int len)
{
int i = 0;
-// Uart_Write((uint8_t*)"Read\r\n");
+
_wlan_cs = 0;
for (i = 0; i < len; i++) {
pBuff[i] = _wlan_spi.write(0xFF);
-// printf(" %x",pBuff[i]);
}
-// printf("\r\n");
+
_wlan_cs = 1;
return len;
}
void cc3100_spi::IntSpiGPIOHandler(void)
{
-// Uart_Write((uint8_t*)"Int\r\n");
+
if(_wlan_irq){
_driver._SlDrvRxIrqHandler(0);
}