summaryrefslogtreecommitdiff
path: root/apps/examples/cc3000
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 08:09:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 08:09:57 -0600
commit40205b8ce91e12a08e7148670ca09eef74265843 (patch)
treedeb7fd27b0c5b7ca576887e23457469b138aa526 /apps/examples/cc3000
parentf2048d655094547f1a5c1c24768f085ccf9cbcdc (diff)
downloadpx4-nuttx-40205b8ce91e12a08e7148670ca09eef74265843.tar.gz
px4-nuttx-40205b8ce91e12a08e7148670ca09eef74265843.tar.bz2
px4-nuttx-40205b8ce91e12a08e7148670ca09eef74265843.zip
Fixes for more complaints from cppcheck
Diffstat (limited to 'apps/examples/cc3000')
-rw-r--r--apps/examples/cc3000/board.h73
-rw-r--r--apps/examples/cc3000/cc3000basic.c27
2 files changed, 23 insertions, 77 deletions
diff --git a/apps/examples/cc3000/board.h b/apps/examples/cc3000/board.h
index 1646095dc..75caab003 100644
--- a/apps/examples/cc3000/board.h
+++ b/apps/examples/cc3000/board.h
@@ -12,7 +12,6 @@
*
* Don't sue me if my code blows up your board and burns down your house
*
-*
* This file is the main module for the Arduino CC3000 library.
* Your program must call CC3000_Init() before any other API calls.
*
@@ -29,11 +28,6 @@
#define TEENSY3 1
#endif
-
-
-
-
-
/* I used the Teensy 3.0 to get the Arduino CC3000 library working but the
Teensy's hardware SPI and the CC3000's SPI didn't like each other so I had
to send the bits manually. For the Uno, Nano, etc. you can probably leave
@@ -46,14 +40,6 @@
#define USE_HARDWARE_SPI true
#endif
-
-
-
-
-
-
-
-
// These are the Arduino pins that connect to the CC3000
// (in addition to standard SPI pins MOSI, MISO, and SCK)
//
@@ -82,16 +68,6 @@
#endif
-
-
-
-
-
-
-
-
-
-
/*
The timing between setting the CS pin and reading the IRQ pin is very
tight on the CC3000, and sometimes the default Arduino digitalRead()
@@ -135,39 +111,13 @@
#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#define MAC_ADDR_LEN 6
-
-
-
#define DISABLE (0)
-
#define ENABLE (1)
//AES key "smartconfigAES16"
//const uint8_t smartconfigkey[] = {0x73,0x6d,0x61,0x72,0x74,0x63,0x6f,0x6e,0x66,0x69,0x67,0x41,0x45,0x53,0x31,0x36};
-
-
-
-
/* If you uncomment the line below the library will leave out a lot of the
higher level functions but use a lot less memory. From:
@@ -195,23 +145,14 @@
//#define CC3000_TINY_DRIVER 1
-
-
-
-
extern uint8_t asyncNotificationWaiting;
extern long lastAsyncEvent;
extern uint8_t dhcpIPAddress[];
-
-
-
-extern void CC3000_Init(void);
-
-
-extern volatile unsigned long ulSmartConfigFinished,
- ulCC3000Connected,
- ulCC3000DHCP,
- OkToDoShutDown,
- ulCC3000DHCP_configured;
-
+extern volatile unsigned long ulSmartConfigFinished;
+extern volatile unsigned long ulCC3000Connected;
+extern volatile unsigned long ulCC3000DHCP;
+extern volatile unsigned long OkToDoShutDown;
+extern volatile unsigned long ulCC3000DHCP_configured;
extern volatile uint8_t ucStopSmartConfig;
+
+void CC3000_Init(void);
diff --git a/apps/examples/cc3000/cc3000basic.c b/apps/examples/cc3000/cc3000basic.c
index db6215762..ae786c4e7 100644
--- a/apps/examples/cc3000/cc3000basic.c
+++ b/apps/examples/cc3000/cc3000basic.c
@@ -267,7 +267,7 @@ void stkmon_disp(void)
void AsyncEventPrint(void)
{
printf("\n");
- switch(lastAsyncEvent)
+ switch (lastAsyncEvent)
{
printf("CC3000 Async event: Simple config done\n");
break;
@@ -305,7 +305,8 @@ void AsyncEventPrint(void)
break;
default:
- printf("AsyncCallback called with unhandled event! (0x%X)\n", lastAsyncEvent);
+ printf("AsyncCallback called with unhandled event! (0x%lx)\n", \
+ (unsigned long)lastAsyncEvent);
break;
}
}
@@ -443,7 +444,7 @@ void Initialize(void)
{
printf(":");
}
- printf("%X", fancyBuffer[i]);
+ printf("%x", fancyBuffer[i]);
}
printf("\n");
@@ -513,7 +514,8 @@ void StartSmartConfig(void)
printf(" Disabling auto-connect policy...");
if ((rval = wlan_ioctl_set_connection_policy(DISABLE, DISABLE, DISABLE)) !=0 )
{
- printf(" Failed!\n Setting auto connection policy failed, error: %X\n", rval);
+ printf(" Failed!\n Setting auto connection policy failed, error: %lx\n",
+ (unsigned long)rval);
return;
}
@@ -523,7 +525,8 @@ void StartSmartConfig(void)
if ((rval = wlan_ioctl_del_profile(255)) !=0 )
{
- printf(" Failed!\n Deleting all profiles failed, error: %X\n", rval);
+ printf(" Failed!\n Deleting all profiles failed, error: %lx\n",
+ (unsigned long)rval);
return;
}
@@ -535,7 +538,8 @@ void StartSmartConfig(void)
if ((rval = wlan_smart_config_set_prefix(simpleConfigPrefix)) !=0 )
{
- printf(" Failed!\n Setting smart config prefix failed, error: %X", rval);
+ printf(" Failed!\n Setting smart config prefix failed, error: %lx",
+ (unsigned long)rval);
return;
}
@@ -545,7 +549,8 @@ void StartSmartConfig(void)
if ((rval = wlan_smart_config_start(0)) !=0 )
{
- printf(" Failed!\n Starting smart config failed, error: %X\n", rval);
+ printf(" Failed!\n Starting smart config failed, error: %lx\n",
+ (unsigned long)rval);
return;
}
@@ -562,7 +567,7 @@ void StartSmartConfig(void)
fflush(stdout);
if ((rval=wlan_ioctl_set_connection_policy(DISABLE, DISABLE, ENABLE)) !=0 )
{
- printf(" Failed!\n Setting auto connection policy failed, error: %X\n", rval);
+ printf(" Failed!\n Setting auto connection policy failed, error: %x\n", rval);
return;
}
@@ -857,7 +862,7 @@ void ListAccessPoints(void)
if (sr.isValid)
{
printf(" ");
- switch(sr.securityMode)
+ switch (sr.securityMode)
{
case WLAN_SEC_UNSEC: /* 0 */
printf("OPEN ");
@@ -873,7 +878,7 @@ void ListAccessPoints(void)
break;
}
- sprintf(localB, "%3d ", sr.rssi);
+ sprintf(localB, "%3u ", sr.rssi);
printf("%s", localB);
memset(localB, 0, 33);
memcpy(localB, sr.ssid_name, sr.ssidLength);
@@ -946,7 +951,7 @@ void ShowInformation(void)
{
printf(":");
}
- printf("%X", inf.uaMacAddr[i]);
+ printf("%x", inf.uaMacAddr[i]);
}
printf("\n");