
Hotkeys for RTL investigation
Dependencies: C12832 USBDevice mbed
Dependents: mbed_hotkeys_rtlx7 mbed_hotkeys_rtlX6
Revision 4:206dc00e56b2, committed 2018-09-25
- Comitter:
- stevehousley
- Date:
- Tue Sep 25 11:10:36 2018 +0000
- Parent:
- 2:f5bc849199f3
- Commit message:
- For use on Hybrid Soak Test rig with CCSPRO4.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f5bc849199f3 -r 206dc00e56b2 main.cpp --- a/main.cpp Thu May 10 08:45:43 2018 +0000 +++ b/main.cpp Tue Sep 25 11:10:36 2018 +0000 @@ -20,7 +20,8 @@ const int ccs_hotkeys = KEY_CTRL | KEY_ALT; int ccs_base = 1; -const int ccs_end = 8; +//const int ccs_end = 8; +const int ccs_end = 4; char ccs_mod; const int alif_hotkeys = KEY_CTRL | KEY_SHIFT; @@ -44,55 +45,71 @@ lcd.locate(0,0); lcd.printf("Sending %s+%c \n", info.c_str(), key2); } + +// Switch the CCS PRO 'Computer' setting. +void switchCCSPRO(void) +{ + int ccsID; + + //setup and open next connection + ccsID = (rand() % ccs_end) + 1; + ccs_mod = '0'+ccsID; + leds = ~ccs_base; + sendKey(ccs_mod, ccs_hotkeys, delay); + printData("Ctrl+Alt", ccs_mod); +} + +// Switch between random number of ALIFs (channels) +void switchALIFs(void) +{ + int i; + int alifID; + int wIndex; + + int wMS[12] = {850,100,500,250,1000,300,750,450,2000,800,650,1500}; + int numOfSwitches = (rand() % 10) + 1; + + for(i=1; i <= numOfSwitches; i++) + { + alifID = (rand() % alif_end) + 1; + alif_mod = '0'+alifID; + sendKey(alif_mod, alif_hotkeys, delay); + printData("Ctrl+Shift", alif_mod); + + wIndex = rand() % 12; + wait_ms(wMS[wIndex]); + } +} int main(void) { - + // Startup initialisation. lcd.cls(); lcd.locate(0,0); - lcd.printf("Starting Up,\nAllowing USB to settle\n>>Please Wait<< "); + lcd.printf("Starting Up RTLX6,\nAllowing USB to settle\n>>Please Wait<< "); wait(10); srand(time(NULL)); - int counter = 0; + + int switchType; + float waitCCS; + // Main loop. while (1) { + + switchType = rand() % 2; - ccs_base = 1; - - while (ccs_base<=ccs_end) { - int mod = 0; - counter++; - if (counter <= 1000) { - mod = rand() % (5 + 1 - 0) + 0; - } - //setup and open next connection - ccs_mod = '0'+ccs_base; - leds = ~ccs_base; - sendKey(ccs_mod, ccs_hotkeys, delay); - printData("Ctrl+Alt", ccs_mod); - if (counter <= 1000) { - mod = rand() % (5 + 1 - 0) + 0; - } - wait(speed + mod); - alif_base = 1; - while (alif_base<=alif_end) { - alif_mod = '0'+alif_base; - sendKey(alif_mod, alif_hotkeys, delay); - printData("Ctrl+Shift", alif_mod); - if (counter <= 1000) { - mod = rand() % (5 + 1 - 0) + 0; - } - wait(speed + mod); - sendKey('x', alif_hotkeys, delay); - alif_base++; - } - //prep for next loop - wait(speed); - ccs_base++; - if (counter == 1000) { - counter = 0; - } - + if (switchType == 0) + { + switchCCSPRO(); } + else + { + switchALIFs(); + // Disconnect. + sendKey('x', alif_hotkeys, delay); + } + + waitCCS = (rand() % 5) + 1; + wait(waitCCS); } }