CC3000 driver updates from Alan Carvalho de Assis

This commit is contained in:
Gregory Nutt 2013-09-04 09:45:59 -06:00
parent 16868bf39d
commit 870606c810
3 changed files with 28 additions and 30 deletions

View File

@ -38,7 +38,7 @@ volatile unsigned long ulSmartConfigFinished,
OkToDoShutDown, OkToDoShutDown,
ulCC3000DHCP_configured; ulCC3000DHCP_configured;
volatile unsigned char ucStopSmartConfig; volatile uint8_t ucStopSmartConfig;
@ -47,7 +47,7 @@ volatile unsigned char ucStopSmartConfig;
#define CC3000_RX_BUFFER_OVERHEAD_SIZE (20) #define CC3000_RX_BUFFER_OVERHEAD_SIZE (20)
/* /*
unsigned char pucCC3000_Rx_Buffer[CC3000_APP_BUFFER_SIZE + CC3000_RX_BUFFER_OVERHEAD_SIZE]; uint8_t pucCC3000_Rx_Buffer[CC3000_APP_BUFFER_SIZE + CC3000_RX_BUFFER_OVERHEAD_SIZE];
*/ */
@ -60,9 +60,9 @@ unsigned char pucCC3000_Rx_Buffer[CC3000_APP_BUFFER_SIZE + CC3000_RX_BUFFER_OVER
So now we just set a flag and write to a string, and the master So now we just set a flag and write to a string, and the master
loop can deal with it when it wants. loop can deal with it when it wants.
*/ */
unsigned char asyncNotificationWaiting = false; uint8_t asyncNotificationWaiting = false;
long lastAsyncEvent; long lastAsyncEvent;
unsigned char dhcpIPAddress[4]; uint8_t dhcpIPAddress[4];
/*------------------------------------------------------------------- /*-------------------------------------------------------------------
@ -78,7 +78,7 @@ unsigned char dhcpIPAddress[4];
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void CC3000_AsyncCallback(long lEventType, char * data, unsigned char length) void CC3000_AsyncCallback(long lEventType, char * data, uint8_t length)
{ {
lastAsyncEvent = lEventType; lastAsyncEvent = lEventType;

View File

@ -18,16 +18,13 @@
* *
****************************************************************************/ ****************************************************************************/
/* /*
Some things are different for the Teensy 3.0, so set a flag if we're using Some things are different for the Teensy 3.0, so set a flag if we're using
that hardware. that hardware.
*/ */
#include <stdint.h>
#if defined(__arm__) && defined(CORE_TEENSY) && defined(__MK20DX128__) #if defined(__arm__) && defined(CORE_TEENSY) && defined(__MK20DX128__)
#define TEENSY3 1 #define TEENSY3 1
#endif #endif
@ -165,7 +162,7 @@
#define ENABLE (1) #define ENABLE (1)
//AES key "smartconfigAES16" //AES key "smartconfigAES16"
//const unsigned char smartconfigkey[] = {0x73,0x6d,0x61,0x72,0x74,0x63,0x6f,0x6e,0x66,0x69,0x67,0x41,0x45,0x53,0x31,0x36}; //const uint8_t smartconfigkey[] = {0x73,0x6d,0x61,0x72,0x74,0x63,0x6f,0x6e,0x66,0x69,0x67,0x41,0x45,0x53,0x31,0x36};
@ -202,9 +199,9 @@
extern unsigned char asyncNotificationWaiting; extern uint8_t asyncNotificationWaiting;
extern long lastAsyncEvent; extern long lastAsyncEvent;
extern unsigned char dhcpIPAddress[]; extern uint8_t dhcpIPAddress[];
@ -217,4 +214,4 @@ extern volatile unsigned long ulSmartConfigFinished,
OkToDoShutDown, OkToDoShutDown,
ulCC3000DHCP_configured; ulCC3000DHCP_configured;
extern volatile unsigned char ucStopSmartConfig; extern volatile uint8_t ucStopSmartConfig;

View File

@ -90,6 +90,7 @@ Arduino pin -----> 560 Ohm --+--> 1K Ohm -----> GND
#include "board.h" #include "board.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/time.h> #include <sys/time.h>
@ -111,7 +112,7 @@ void ManualConnect(void);
void ManualConnect(void); void ManualConnect(void);
void ManualAddProfile(void); void ManualAddProfile(void);
void ListAccessPoints(void); void ListAccessPoints(void);
void PrintIPBytes(unsigned char *ipBytes); void PrintIPBytes(uint8_t *ipBytes);
void ShowInformation(void); void ShowInformation(void);
// When operations that take a long time (like Smart Config) are running, the // When operations that take a long time (like Smart Config) are running, the
@ -223,7 +224,7 @@ void execute(int cmd)
void Initialize(void) void Initialize(void)
{ {
unsigned char fancyBuffer[MAC_ADDR_LEN], i = 0; uint8_t fancyBuffer[MAC_ADDR_LEN], i = 0;
if (isInitialized) { if (isInitialized) {
printf("CC3000 already initialized. Shutting down and restarting...\n"); printf("CC3000 already initialized. Shutting down and restarting...\n");
@ -417,9 +418,9 @@ void StartSmartConfig(void) {
void ManualConnect(void) { void ManualConnect(void) {
char ssidName[] = "OpenNET"; char ssidName[] = "YourAP";
char AP_KEY[] = "gargame1"; char AP_KEY[] = "yourpass";
unsigned char rval; uint8_t rval;
if (!isInitialized) if (!isInitialized)
{ {
@ -452,7 +453,7 @@ void ManualConnect(void) {
ssidName, ssidName,
strlen(ssidName), strlen(ssidName),
NULL, NULL,
(unsigned char *)AP_KEY, (uint8_t *)AP_KEY,
strlen(AP_KEY)); strlen(AP_KEY));
if (rval==0) { if (rval==0) {
@ -484,7 +485,7 @@ void ManualConnect(void) {
void ManualAddProfile(void) { void ManualAddProfile(void) {
char ssidName[] = "YourAP"; char ssidName[] = "YourAP";
char AP_KEY[] = "yourpass"; char AP_KEY[] = "yourpass";
unsigned char rval; uint8_t rval;
if (!isInitialized) if (!isInitialized)
{ {
@ -500,14 +501,14 @@ void ManualAddProfile(void) {
printf(" Adding profile...\n"); printf(" Adding profile...\n");
rval = wlan_add_profile ( rval = wlan_add_profile (
WLAN_SEC_WPA2, // WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 WLAN_SEC_WPA2, // WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
(unsigned char *)ssidName, (uint8_t *)ssidName,
strlen(ssidName), strlen(ssidName),
NULL, // BSSID, TI always uses NULL NULL, // BSSID, TI always uses NULL
0, // profile priority 0, // profile priority
0x18, // key length for WEP security, undocumented why this needs to be 0x18 0x18, // key length for WEP security, undocumented why this needs to be 0x18
0x1e, // key index, undocumented why this needs to be 0x1e 0x1e, // key index, undocumented why this needs to be 0x1e
0x2, // key management, undocumented why this needs to be 2 0x2, // key management, undocumented why this needs to be 2
(unsigned char *)AP_KEY, // WPA security key (uint8_t *)AP_KEY, // WPA security key
strlen(AP_KEY) // WPA security key length strlen(AP_KEY) // WPA security key length
); );
@ -587,16 +588,16 @@ typedef struct scanResults {
unsigned rssi:7; unsigned rssi:7;
unsigned securityMode:2; unsigned securityMode:2;
unsigned ssidLength:6; unsigned ssidLength:6;
unsigned short frameTime; uint16_t frameTime;
unsigned char ssid_name[32]; uint8_t ssid_name[32];
unsigned char bssid[6]; uint8_t bssid[6];
} scanResults; } scanResults;
#define NUM_CHANNELS 16 #define NUM_CHANNELS 16
void ListAccessPoints(void) { void ListAccessPoints(void) {
unsigned long aiIntervalList[NUM_CHANNELS]; unsigned long aiIntervalList[NUM_CHANNELS];
unsigned char rval; uint8_t rval;
scanResults sr; scanResults sr;
int apCounter, i; int apCounter, i;
char localB[33]; char localB[33];
@ -639,7 +640,7 @@ void ListAccessPoints(void) {
// actual # of APs currently seen. Get that # then loop through and print // actual # of APs currently seen. Get that # then loop through and print
// out what's found. // out what's found.
if ((rval=wlan_ioctl_get_scan_results(2000, (unsigned char *)&sr))!=0) { if ((rval=wlan_ioctl_get_scan_results(2000, (uint8_t *)&sr))!=0) {
printf(" Got back unusual result from wlan_ioctl_get scan results, can't continue: %d\n", rval); printf(" Got back unusual result from wlan_ioctl_get scan results, can't continue: %d\n", rval);
return; return;
} }
@ -672,7 +673,7 @@ void ListAccessPoints(void) {
} }
if (--apCounter>0) { if (--apCounter>0) {
if ((rval=wlan_ioctl_get_scan_results(2000, (unsigned char *)&sr))!=0) { if ((rval=wlan_ioctl_get_scan_results(2000, (uint8_t *)&sr))!=0) {
printf(" Got back unusual result from wlan_ioctl_get scan, can't continue: %d\n", rval); printf(" Got back unusual result from wlan_ioctl_get scan, can't continue: %d\n", rval);
return; return;
} }
@ -684,7 +685,7 @@ void ListAccessPoints(void) {
void PrintIPBytes(unsigned char *ipBytes) { void PrintIPBytes(uint8_t *ipBytes) {
printf("%d.%d.%d.%d\n", ipBytes[3], ipBytes[2], ipBytes[1], ipBytes[0]); printf("%d.%d.%d.%d\n", ipBytes[3], ipBytes[2], ipBytes[1], ipBytes[0]);
} }