Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Energia SLDriver to 1.0.1.6 #886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions hardware/lm4f/libraries/WiFi/utility/SimpleLinkForEnergia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*
* Copyright (C) 2014 Noah Luskey | [email protected]
*
* Contributors:
* Phil LaFayette (MH Electric Motor & Control Corp.) - Upgraded CC31xx/CC32xx Host Driver to v1.0.1.6, May 27, 2016
*
*/

#include "SimpleLinkForEnergia.h"
Expand Down Expand Up @@ -42,7 +45,7 @@ void CC3100_disable()
//
digitalWrite(WiFiClass::pin_nhib, LOW);
}

//
//open the SPI interface (none of the inputs actually matter)
//
Expand All @@ -57,14 +60,14 @@ int spi_Open(char* pIfName , unsigned long flags)
pinMode(WiFiClass::pin_irq, INPUT);
pinMode(WiFiClass::pin_nhib, OUTPUT);
digitalWrite(WiFiClass::pin_nhib, LOW);

//
//set the spi port up using Energia functions
//
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);

//
//return a success
//
Expand All @@ -91,7 +94,7 @@ int spi_Close(int Fd)
int spi_Read(int Fd , char* pBuff , int Len)\
{
digitalWrite(WiFiClass::pin_cs, LOW);

DEBUG_TRACE("SPI_READ");
//
//read bytes into the buffer by transmitting NULL over and over
Expand All @@ -100,7 +103,7 @@ int spi_Read(int Fd , char* pBuff , int Len)\
pBuff[i] = SPI.transfer(0);
DEBUG_TRACE(pBuff[i]);
}

digitalWrite(WiFiClass::pin_cs, HIGH);
return Len;
}
Expand All @@ -111,7 +114,7 @@ int spi_Read(int Fd , char* pBuff , int Len)\
int spi_Write(int Fd , char* pBuff , int Len)
{
digitalWrite(WiFiClass::pin_cs, LOW);

DEBUG_TRACE("SPI_WRITE");
//
//transfer all the bytes from the buffer
Expand All @@ -120,7 +123,7 @@ int spi_Write(int Fd , char* pBuff , int Len)
SPI.transfer(pBuff[i]);
DEBUG_TRACE(pBuff[i]);
}

digitalWrite(WiFiClass::pin_cs, HIGH);
return Len;
}
Expand All @@ -130,7 +133,7 @@ int registerInterruptHandler(void* InterruptHdl , void* pValue)
{
delay(100);
DEBUG_TRACE("INTERRUPT REGISTER");

//
//the IRQ line may already be high
//in this case, manually call the interrupt first
Expand All @@ -139,7 +142,7 @@ int registerInterruptHandler(void* InterruptHdl , void* pValue)
void (*interruptFunction)(void) = (void (*)())InterruptHdl;
interruptFunction();
}

if (InterruptHdl == NULL) {
//
//according to documentation, a NULL pointer means remove the interrupt
Expand All @@ -151,7 +154,7 @@ int registerInterruptHandler(void* InterruptHdl , void* pValue)
//
attachInterrupt(WiFiClass::pin_irq, (void (*)())InterruptHdl, RISING);
}

delay(100);
return 0;
}
Expand Down
5 changes: 4 additions & 1 deletion hardware/lm4f/libraries/WiFi/utility/SimpleLinkForEnergia.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*
* Copyright (C) 2014 Noah Luskey | [email protected]
*
* Contributors:
* Phil LaFayette (MH Electric Motor & Control Corp.) - Upgraded CC31xx/CC32xx Host Driver to v1.0.1.6, May 27, 2016
*
*/


Expand All @@ -28,4 +31,4 @@ int registerInterruptHandler(void* InterruptHdl , void* pValue);
}
#endif /* extern "C" */

#endif /* inclusion guard end */
#endif /* inclusion guard end */
Loading