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.
Dependencies: CC3000HostDriver mbed
CC3000TestApp.cpp
00001 /************************************************************************** 00002 * 00003 * CC3000TestApp.cpp - Basic connection test between the TI CC3000 00004 * and an Mbed. 00005 * 00006 * Mbed Version 1.0 00007 * 00008 * Copyright (C) 2013 00009 * 00010 * Note: Some or all of this software has been modified in some way to meet the 00011 * requirements of the mbed libs and/or compiler. If you need a fresh copy of the TI 00012 * software please check TI's website. 00013 * If you need help please take the time to read Chris's notes below. 00014 * ( Yes I know they are for an Arduino, but some still do apply.) 00015 * Most important! 00016 * The mbed will not supply the current that the CC3000 requires, if you try it will 00017 * show up as the mbed resetting as soon as spi runs. 00018 * 00019 * To associate with your WIFI router you will first need to insert your ssid and key into 00020 * functions, ManualConnect() and ManualAddProfile() 00021 * 00022 * Redistribution and use in source and binary forms, with or without 00023 * modification, are permitted provided that the following conditions 00024 * are met: 00025 * 00026 * Don't sue me if this code blows up your board and burns down your house and incinerates 00027 * all life and property in this and any other universe! 00028 ****************************************************************************\ 00029 00030 To connect an mbed to the CC3000 you'll need to make these 6 connections 00031 (in addition to the WiFi antenna, power etc). 00032 00033 Name / pin on CC3000EM board / purpose 00034 00035 cs / J4-8 SPI Chip Select 00036 The Mbed will set this pin LOW when it wants to 00037 exchange data with the CC3000. This is 00038 mbed pin 8, but any pin can be used. In this 00039 program it will be called cs. 00040 This is the mbed's pin 8. 00041 00042 MISO / J4-9 Data from the module to the mbed 00043 This is mbed's MISO pin, and is how the CC3000 00044 will get bytes to the mbed. 00045 This is the mbed's pin 6. 00046 00047 WLAN_IRQ / J4-10 CC3000 host notify 00048 The CC3000 will drive this pin LOW to let the mbed 00049 know it's ready to send data. In 00050 this program it will be called WLAN_IRQ 00051 This is the mbed's pin 9. 00052 00053 MOSI / J4-11 Data from the Arduino to the CC3000 00054 This is the Arduino's MOSI pin, and is how the Arduino 00055 will get bytes to the CC3000. 00056 This is the mbed's pin 5. 00057 00058 SCK / J4-12 SPI clock 00059 This is the mbed's SCK pin 7. 00060 00061 WLAN_EN / J5-5 Module enable 00062 The Arduino will set this pin HIGH to turn the CC3000 00063 on. Any pin can be used. In this program it will be 00064 called WLAN_EN 00065 This is the mbed's pin 10. 00066 ***************************************************************************/ 00067 00068 /************************************************************************** 00069 * 00070 * ArduinoCC3000Test.ino - Basic connection test between the TI CC3000 00071 * and an Arduino. 00072 * 00073 * Version 1.0 00074 * 00075 * Copyright (C) 2013 Chris Magagna - cmagagna@yahoo.com 00076 * 00077 * Redistribution and use in source and binary forms, with or without 00078 * modification, are permitted provided that the following conditions 00079 * are met: 00080 * 00081 * Don't sue me if my code blows up your board and burns down your house 00082 * 00083 **************************************************************************** 00084 00085 00086 00087 To connect an Arduino to the CC3000 you'll need to make these 6 connections 00088 (in addition to the WiFi antenna, power etc). 00089 00090 Name / pin on CC3000 module / pin on CC3000EM board / purpose 00091 00092 SPI_CS / 12 / J4-8 / SPI Chip Select 00093 The Arduino will set this pin LOW when it wants to 00094 exchange data with the CC3000. By convention this is 00095 Arduino pin 10, but any pin can be used. In this 00096 program it will be called WLAN_CS 00097 00098 SPI_DOUT / 13 / J4-9 / Data from the module to the Arduino 00099 This is Arduino's MISO pin, and is how the CC3000 00100 will get bytes to the Arduino. For most Arduinos 00101 MISO is pin 12 00102 00103 SPI_IRQ / 14 / J4-10 / CC3000 host notify 00104 The CC3000 will drive this pin LOW to let the Arduino 00105 know it's ready to send data. For a regular Arduino 00106 (Uno, Nano, Leonardo) this will have to be connected 00107 to pin 2 or 3 so you can use attachInterrupt(). In 00108 this program it will be called WLAN_IRQ 00109 00110 SPI_DIN / 15 / J4-11 Data from the Arduino to the CC3000 00111 This is the Arduino's MOSI pin, and is how the Arduino 00112 will get bytes to the CC3000. For most Arduinos 00113 MOSI is pin 11 00114 00115 SPI_CLK / 17 / J4-12 SPI clock 00116 This is the Arduino's SCK pin. For most Arduinos 00117 SCK is pin 13 00118 00119 VBAT_SW_EN / 26 / J5-5 Module enable 00120 The Arduino will set this pin HIGH to turn the CC3000 00121 on. Any pin can be used. In this program it will be 00122 called WLAN_EN 00123 00124 00125 WARNING #1: The CC3000 runs at 3.6V maximum so you can't run it from your 00126 regular 5V Arduino power pin. Run it from 3.3V! 00127 00128 00129 WARNING #2: When transmitting the CC3000 will use up to 275mA current. Most 00130 Arduinos' 3.3V pins can only supply up to 50mA current, so you'll need a 00131 separate power supply for it (or a voltage regulator like the LD1117V33 00132 connected to your Arduino's 5V power pin). 00133 00134 00135 WARNING #3: The CC3000's IO pins are not 5V tolerant. If you're using a 5V 00136 Arduino you will need a level shifter to convert these signals to 3.3V 00137 so you don't blow up the module. 00138 00139 You'll need to shift the pins for WLAN_CS, MOSI, SCK, and WLAN_EN. The other 00140 2 pins (WLAN_IRQ and MISO) can be connected directly because they're input 00141 pins for the Arduino, and the Arduino can read 3.3V signals directly. 00142 00143 You can use a level shifter chip like the 74LVC245 or TXB0104 or you can use 00144 a pair of resistors to make a voltage divider like this: 00145 00146 Arduino pin -----> 560 Ohm -----> 1K Ohm -----> GND 00147 | 00148 | 00149 +---> CC3000 pin 00150 00151 00152 ****************************************************************************/ 00153 00154 00155 00156 #include "wlan.h" 00157 #include "evnt_handler.h" // callback function declaration 00158 #include "nvmem.h" 00159 #include "socket.h" 00160 #include "netapp.h" 00161 #include "host_driver_version.h" 00162 #include "cc3000.h" 00163 //#include "common.h" 00164 //#include "demo_config.h" 00165 //#include "HttpString.h" 00166 #include "spi.h" 00167 #include "CC3000TestApp.h" 00168 #include "CC3000Core.h" 00169 //#include <msp430.h> 00170 #include "mbed.h" 00171 //#include "Board.h" 00172 //#include "HttpCore.h" 00173 //#include "Wheel.h" 00174 //#include "dispatcher.h" 00175 #include "DigitalClass.h" 00176 00177 #define FALSE 0 00178 int8_t isInitialized = false; 00179 InterruptIn intr(p9); 00180 00181 DigitalOut ind1(LED1); 00182 DigitalOut ind2(LED2); 00183 DigitalOut ind3(LED3); 00184 DigitalOut ind4(LED4); 00185 00186 Serial usb(USBTX, USBRX); 00187 00188 void IntSpi() 00189 { 00190 00191 IntSpiGPIOHandler();// spi.cpp 00192 00193 } 00194 00195 int main() 00196 { 00197 00198 intr.fall(&IntSpi); 00199 usb.baud(115200); 00200 00201 // Start CC3000 State Machine 00202 resetCC3000StateMachine(); 00203 00204 00205 char cmd; 00206 00207 00208 while (1) { 00209 printf("\r\n"); 00210 printf("+-------------------------------------------+\r\n"); 00211 printf("| Mbed CC3000 Demo Program |\r\n"); 00212 printf("+-------------------------------------------+\r\n"); 00213 printf("\r\n"); 00214 printf(" 1 - Initialize the CC3000\r\n"); 00215 printf(" 2 - Show RX & TX buffer sizes, & free RAM\r\n"); 00216 printf(" 3 - Start Smart Config\r\n"); 00217 printf(" 4 - Manually connect to AP\r\n"); 00218 printf(" 5 - Manually add connection profile\r\n"); 00219 printf(" 6 - List access points\r\n"); 00220 printf(" 7 - Show CC3000 information\r\n"); 00221 printf("\r\n"); 00222 00223 //for (;;) { 00224 while (1) { 00225 if (asyncNotificationWaiting) { 00226 asyncNotificationWaiting = false; 00227 AsyncEventPrint(); 00228 } 00229 // } 00230 cmd = usb.getc(); 00231 if (cmd!='\n' && cmd!='\r') { 00232 break; 00233 } 00234 } 00235 00236 00237 switch(cmd) { 00238 case '1': 00239 IntSpi(); 00240 initDriver(); 00241 isInitialized = true; 00242 break; 00243 case '2': 00244 //ShowBufferSize(); 00245 00246 break; 00247 case '3': 00248 StartSmartConfig(); 00249 break; 00250 case '4': 00251 ManualConnect(); 00252 break; 00253 case '5': 00254 ManualAddProfile(); 00255 break; 00256 case '6': 00257 ListAccessPoints(); 00258 break; 00259 case '7': 00260 ShowInformation(); 00261 break; 00262 default: 00263 printf("**Unknown command "); 00264 printf("%d",cmd); 00265 printf("**\r\n"); 00266 break; 00267 } 00268 00269 }; 00270 return 0; 00271 } 00272 00273 00274 void AsyncEventPrint() 00275 { 00276 switch(lastAsyncEvent) { 00277 printf("CC3000 Async event: Simple config done\r\n"); 00278 break; 00279 00280 case HCI_EVNT_WLAN_UNSOL_CONNECT: 00281 printf("CC3000 Async event: Unsolicited connect\r\n"); 00282 break; 00283 00284 case HCI_EVNT_WLAN_UNSOL_DISCONNECT: 00285 printf("CC3000 Async event: Unsolicted disconnect\r\n"); 00286 break; 00287 00288 case HCI_EVNT_WLAN_UNSOL_DHCP: 00289 printf("CC3000 Async event: Got IP address via DHCP: "); 00290 printf("%d",dhcpIPAddress[0]); 00291 printf("."); 00292 printf("%d",dhcpIPAddress[1]); 00293 printf("."); 00294 printf("%d",dhcpIPAddress[2]); 00295 printf("."); 00296 printf("%d\r\n",dhcpIPAddress[3]); 00297 break; 00298 00299 case HCI_EVENT_CC3000_CAN_SHUT_DOWN: 00300 printf("CC3000 Async event: OK to shut down\r\n"); 00301 break; 00302 00303 case HCI_EVNT_WLAN_KEEPALIVE: 00304 // Once initialized, the CC3000 will send these keepalive events 00305 // every 20 seconds. 00306 //printf(F("CC3000 Async event: Keepalive")); 00307 //return; 00308 break; 00309 00310 default: 00311 printf("AsyncCallback called with unhandled event! "); 00312 printf("%x",lastAsyncEvent); 00313 printf("\r\n"); 00314 break; 00315 } 00316 00317 printf("\r\n"); 00318 } 00319 /* 00320 This is an example of how you'd connect the CC3000 to an AP without using 00321 Smart Config or a stored profile. 00322 00323 All the code above wlan_connect() is just for this demo program; if you're 00324 always going to connect to your network this way you wouldn't need it. 00325 */ 00326 00327 void ManualConnect() { 00328 00329 char ssidName[] = "***********"; 00330 char AP_KEY[] = "************"; 00331 int8_t rval; 00332 00333 if (!isInitialized) { 00334 printf("CC3000 not initialized; can't run manual connect.\r\n"); 00335 return; 00336 } 00337 00338 printf("Starting manual connect...\r\n"); 00339 00340 printf((" Disabling auto-connect policy...\r\n")); 00341 rval = wlan_ioctl_set_connection_policy(DISABLE, DISABLE, DISABLE); 00342 00343 printf(" Deleting all existing profiles...\r\n"); 00344 rval = wlan_ioctl_del_profile(255); 00345 00346 printf(" Waiting until disconnected...\r\n"); 00347 while (ulCC3000Connected == 1) { 00348 wait_ms(100); 00349 } 00350 00351 printf(" Manually connecting...\r\n"); 00352 00353 // Parameter 1 is the security type: WLAN_SEC_UNSEC, WLAN_SEC_WEP, 00354 // WLAN_SEC_WPA or WLAN_SEC_WPA2 00355 // Parameter 3 is the MAC adddress of the AP. All the TI examples 00356 // use NULL. I suppose you would want to specify this 00357 // if you were security paranoid. 00358 rval = wlan_connect(WLAN_SEC_WPA2, 00359 ssidName, 00360 strlen(ssidName), 00361 NULL, 00362 (unsigned char *)AP_KEY, 00363 strlen(AP_KEY)); 00364 00365 if (rval==0) { 00366 printf(" Manual connect success.\r\n"); 00367 } 00368 else { 00369 printf(" Unusual return value: "); 00370 printf("%d\r\n",rval); 00371 } 00372 return; 00373 } 00374 /* 00375 This is an example of manually adding a WLAN profile to the CC3000. See 00376 wlan_ioctl_set_connection_policy() for more details of how profiles are 00377 used but basically there's 7 slots where you can store AP info and if 00378 the connection policy is set to auto_start then the CC3000 will go 00379 through its profile table and try to auto-connect to something it knows 00380 about after it boots up. 00381 00382 Note the API documentation for wlan_add_profile is wrong. It says it 00383 returns 0 on success and -1 on failure. What it really returns is 00384 the stored profile number (0-6, since the CC3000 can store 7) or 00385 255 on failure. 00386 00387 Unfortunately the API doesn't give you any way to see how many profiles 00388 are in use or which profile is stored in which slot, so if you want to 00389 manage multiple profiles you'll need to do that yourself. 00390 */ 00391 00392 void ManualAddProfile() { 00393 char ssidName[] = "*****************"; 00394 char AP_KEY[] = "***********"; 00395 00396 if (!isInitialized) { 00397 printf("CC3000 not initialized; can't run manual add profile.\r\n"); 00398 return; 00399 } 00400 00401 printf("Starting manual add profile...\r\n"); 00402 00403 printf(" Disabling auto connection...\r\n"); 00404 wlan_ioctl_set_connection_policy(DISABLE, DISABLE, DISABLE); 00405 00406 printf(" Adding profile...\r\n"); 00407 int8_t rval = wlan_add_profile ( 00408 WLAN_SEC_WPA2, // WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 00409 (unsigned char *)ssidName, 00410 strlen(ssidName), 00411 NULL, // BSSID, TI always uses NULL 00412 0, // profile priority 00413 0x18, // key length for WEP security, undocumented why this needs to be 0x18 00414 0x1e, // key index, undocumented why this needs to be 0x1e 00415 0x2, // key management, undocumented why this needs to be 2 00416 (unsigned char *)AP_KEY, // WPA security key 00417 strlen(AP_KEY) // WPA security key length 00418 ); 00419 00420 if (rval!=255) { 00421 00422 // This code is lifted from http://e2e.ti.com/support/low_power_rf/f/851/p/180859/672551.aspx; 00423 // the actual API documentation on wlan_add_profile doesn't specify any of this.... 00424 00425 printf(" Manual add profile success, stored in profile: "); 00426 printf("%d\r\n",rval); 00427 00428 printf(" Enabling auto connection...\r\n"); 00429 wlan_ioctl_set_connection_policy(DISABLE, DISABLE, ENABLE); 00430 00431 printf(" Stopping CC3000...\r\n"); 00432 wlan_stop(); 00433 00434 printf(" Stopping for 5 seconds...\r\n"); 00435 wait_ms(5000); 00436 00437 printf(" Restarting CC3000...\r\n"); 00438 wlan_start(0); 00439 00440 printf(" Manual add profile done!\r\n"); 00441 00442 } 00443 else { 00444 printf(" Manual add profile failured (all profiles full?).\r\n"); 00445 } 00446 return; 00447 } 00448 00449 00450 00451 /* 00452 All the data in all the fields from netapp_ipconfig() are reversed, 00453 e.g. an IP address is read via bytes 3,2,1,0 instead of bytes 00454 0,1,2,3 and the MAC address is read via bytes 5,4,3,2,1,0 instead 00455 of 0,1,2,3,4,5. 00456 00457 N.B. TI is inconsistent here; nvmem_get_mac_address() returns them in 00458 the right order etc. 00459 */ 00460 00461 void ShowInformation() { 00462 00463 tNetappIpconfigRetArgs inf; 00464 char localB[33]; 00465 00466 if (!isInitialized) { 00467 printf("CC3000 not initialized; can't get information.\r\n"); 00468 return; 00469 } 00470 00471 printf("CC3000 information:"); 00472 00473 netapp_ipconfig(&inf); 00474 00475 printf(" IP address: "); 00476 PrintIPBytes(inf.aucIP); 00477 00478 printf(" Subnet mask: "); 00479 PrintIPBytes(inf.aucSubnetMask); 00480 00481 printf(" Gateway: "); 00482 PrintIPBytes(inf.aucDefaultGateway); 00483 00484 printf(" DHCP server: "); 00485 PrintIPBytes(inf.aucDHCPServer); 00486 00487 printf(" DNS server: "); 00488 PrintIPBytes(inf.aucDNSServer); 00489 00490 printf(" MAC address: "); 00491 for (int i=(MAC_ADDR_LEN-1); i>=0; i--) { 00492 if (i!=(MAC_ADDR_LEN-1)) { 00493 printf(":"); 00494 } 00495 printf("%x",inf.uaMacAddr[i]); 00496 } 00497 printf("\r\n"); 00498 00499 memset(localB, 0, 32); 00500 memcpy(localB, inf.uaSSID, 32); 00501 00502 printf(" Connected to SSID: "); 00503 printf("%s",localB); 00504 00505 } 00506 00507 void PrintIPBytes(unsigned char *ipBytes) { 00508 00509 printf("%d",ipBytes[3]); 00510 printf("."); 00511 printf("%d",ipBytes[2]); 00512 printf("."); 00513 printf("%d",ipBytes[1]); 00514 printf("."); 00515 printf("%d\r\n",ipBytes[0]); 00516 } 00517 00518 /* 00519 The call wlan_ioctl_get_scan_results returns this structure. I couldn't 00520 find it in the TI library so it's defined here. It's 50 bytes with 00521 a semi weird arrangement but fortunately it's not as bad as it looks. 00522 00523 numNetworksFound - 4 bytes - On the first call to wlan_ioctl_get_scan_results 00524 this will be set to how many APs the CC3000 sees. Although 00525 with 4 bytes the CC3000 could see 4 billion APs in my testing 00526 this number was always 20 or less so there's probably an 00527 internal memory limit. 00528 00529 results - 4 bytes - 0=aged results, 1=results valid, 2=no results. Why TI 00530 used 32 bits to store something that could be done in 2, 00531 and how this field is different than isValid below, is 00532 a mystery to me so I just igore this field completely. 00533 00534 isValid & rssi - 1 byte - a packed structure. The top bit (isValid) 00535 indicates whether or not this structure has valid data, 00536 the bottom 7 bits (rssi) are the signal strength of this AP. 00537 00538 securityMode & ssidLength - 1 byte - another packed structure. The top 2 00539 bits (securityMode) show how the AP is configured: 00540 0 - open / no security 00541 1 - WEP 00542 2 - WPA 00543 3 - WPA2 00544 ssidLength is the lower 6 bytes and shows how many characters 00545 (up to 32) of the ssid_name field are valid 00546 00547 frameTime - 2 bytes - how long, in seconds, since the CC3000 saw this AP 00548 beacon 00549 00550 ssid_name - 32 bytes - The ssid name for this AP. Note that this isn't a 00551 regular null-terminated C string so you can't use it 00552 directly with a strcpy() or printf() etc. and you'll 00553 need a 33-byte string to store it (32 valid characters + 00554 null terminator) 00555 00556 bssid - 6 bytes - the MAC address of this AP 00557 */ 00558 00559 typedef struct scanResults { 00560 unsigned long numNetworksFound; 00561 unsigned long results; 00562 unsigned isValid:1; 00563 unsigned rssi:7; 00564 unsigned securityMode:2; 00565 unsigned ssidLength:6; 00566 unsigned short frameTime; 00567 unsigned char ssid_name[32]; 00568 unsigned char bssid[6]; 00569 } scanResults; 00570 00571 #define NUM_CHANNELS 16 00572 00573 void ListAccessPoints() { 00574 unsigned long aiIntervalList[NUM_CHANNELS]; 00575 int8_t rval; 00576 scanResults sr; 00577 int apCounter; 00578 char localB[33]; 00579 00580 if (!isInitialized) { 00581 printf(("CC3000 not initialized; can't list access points.\r\n")); 00582 return; 00583 } 00584 00585 printf(("List visible access points\r\n")); 00586 00587 printf((" Setting scan paramters...\r\n")); 00588 00589 for (int i=0; i<NUM_CHANNELS; i++) { 00590 aiIntervalList[i] = 2000; 00591 } 00592 00593 rval = wlan_ioctl_set_scan_params( 00594 1000, // enable start application scan 00595 100, // minimum dwell time on each channel 00596 100, // maximum dwell time on each channel 00597 5, // number of probe requests 00598 0x7ff, // channel mask 00599 -80, // RSSI threshold 00600 0, // SNR threshold 00601 205, // probe TX power 00602 aiIntervalList // table of scan intervals per channel 00603 ); 00604 if (rval!=0) { 00605 printf(" Got back unusual result from wlan_ioctl_set_scan_params, can't continue: "); 00606 printf("%d\r\n",rval); 00607 return; 00608 } 00609 00610 printf(" Sleeping 5 seconds to let the CC3000 discover APs..."); 00611 wait_ms(5000); 00612 00613 printf(" Getting AP count...\r\n"); 00614 00615 // On the first call to get_scan_results, sr.numNetworksFound will return the 00616 // actual # of APs currently seen. Get that # then loop through and print 00617 // out what's found. 00618 00619 if ((rval=wlan_ioctl_get_scan_results(2000, (unsigned char *)&sr))!=0) { 00620 printf(" Got back unusual result from wlan_ioctl_get scan results, can't continue: "); 00621 printf("%d\r\n",rval); 00622 return; 00623 } 00624 00625 apCounter = sr.numNetworksFound; 00626 printf((" Number of APs found: ")); 00627 printf("%d\r\n",apCounter); 00628 00629 do { 00630 if (sr.isValid) { 00631 printf((" ")); 00632 switch(sr.securityMode) { 00633 case WLAN_SEC_UNSEC: // 0 00634 printf(("OPEN ")); 00635 break; 00636 case WLAN_SEC_WEP: // 1 00637 printf(("WEP ")); 00638 break; 00639 case WLAN_SEC_WPA: // 2 00640 printf(("WPA ")); 00641 break; 00642 case WLAN_SEC_WPA2: // 3 00643 printf(("WPA2 ")); 00644 break; 00645 } 00646 sprintf(localB, "%3d ", sr.rssi); 00647 printf(localB); 00648 memset(localB, 0, 33); 00649 memcpy(localB, sr.ssid_name, sr.ssidLength); 00650 printf(localB); 00651 } 00652 00653 if (--apCounter>0) { 00654 if ((rval=wlan_ioctl_get_scan_results(2000, (unsigned char *)&sr))!=0) { 00655 printf((" Got back unusual result from wlan_ioctl_get scan results, can't continue: ")); 00656 printf("%d\r\n",rval); 00657 return; 00658 } 00659 } 00660 } while (apCounter>0); 00661 00662 printf((" Access Point list finished.")); 00663 } 00664 00665 00666 //***************************************************************************** 00667 // 00668 //! turnLedOn 00669 //! 00670 //! @param ledNum is the LED Number 00671 //! 00672 //! @return none 00673 //! 00674 //! @brief Turns a specific LED on 00675 // 00676 //***************************************************************************** 00677 void turnLedOn(char ledNum) 00678 { 00679 switch(ledNum) 00680 { 00681 case 1: 00682 ind1 = 1; 00683 break; 00684 case 2: 00685 ind2 = 1; 00686 break; 00687 case 3: 00688 ind3 = 1; 00689 break; 00690 case 4: 00691 ind4 = 1; 00692 break; 00693 case 5: 00694 ind1 = 1; 00695 break; 00696 case 6: 00697 ind4 = 1; 00698 break; 00699 case 7: 00700 00701 break; 00702 case 8: 00703 00704 break; 00705 } 00706 00707 } 00708 00709 //***************************************************************************** 00710 // 00711 //! turnLedOff 00712 //! 00713 //! @param ledNum is the LED Number 00714 //! 00715 //! @return none 00716 //! 00717 //! @brief Turns a specific LED Off 00718 // 00719 //***************************************************************************** 00720 void turnLedOff(char ledNum) 00721 { 00722 switch(ledNum) 00723 { 00724 case 1: 00725 ind1 = 0; 00726 break; 00727 case 2: 00728 ind2 = 0; 00729 break; 00730 case 3: 00731 ind3 = 0; 00732 break; 00733 case 4: 00734 ind4 = 0; 00735 break; 00736 case 5: 00737 ind1 = 0; 00738 break; 00739 case 6: 00740 ind4 = 0; 00741 break; 00742 case 7: 00743 00744 break; 00745 case 8: 00746 00747 break; 00748 } 00749 } 00750 00751 //***************************************************************************** 00752 // 00753 //! toggleLed 00754 //! 00755 //! @param ledNum is the LED Number 00756 //! 00757 //! @return none 00758 //! 00759 //! @brief Toggles a board LED 00760 // 00761 //***************************************************************************** 00762 00763 void toggleLed(char ledNum) 00764 { 00765 switch(ledNum) 00766 { 00767 case 1: 00768 ind1 = 0; 00769 break; 00770 case 2: 00771 ind2 = 0; 00772 break; 00773 case 3: 00774 ind3 = 0; 00775 break; 00776 case 4: 00777 ind4 = 0; 00778 break; 00779 case 5: 00780 ind1 = 0; 00781 break; 00782 case 6: 00783 ind4 = 0; 00784 break; 00785 case 7: 00786 00787 break; 00788 case 8: 00789 00790 break; 00791 } 00792 00793 }
Generated on Sun Jul 24 2022 00:54:51 by
1.7.2