
Sends infinity hotkey combinations (Current: LCTRL + RALT + NUM) Cycles numbers 0 to 9 with gaps of 10 seconds.
Dependencies: mbed C12832 USBDevice
Dependents: mbed_alif4000_hotkeys_3chan_001
main.cpp
- Committer:
- shivikas
- Date:
- 2017-11-15
- Revision:
- 0:f4e0c6f139ea
- Child:
- 1:0e50909db8ee
File content as of revision 0:f4e0c6f139ea:
/**************************************************************************** - Following program is to emulate Inifinity channel switching. - embeds are used to send hotkey combination to switch channel. - CTRL+SHIFT+[1-4] is used to switch among four channels. - LCD screen on mbed application board is used to show switch status and count. ****************************************************************************/ #include "mbed.h" #include "C12832.h" #include "USBKeyboard.h" // To change LED colour at channel switching BusOut leds(p23, p24, p25); BusOut myleds(LED1, LED2, LED3, LED4); // keyboard interface to emulate keyboard and send keys with modifiers USBKeyboard keyboard; // LCD interface on appication board C12832 lcd(p5, p7, p6, p8, p11); const float speed = 5; const int hotkeys = KEY_CTRL | KEY_SHIFT; void lcd_print(int key, int count, float speed) { lcd.cls(); lcd.locate(0,0); lcd.printf("Sending CTRL+SHIFT+%c \nCount: %d\nSpeed: %4.2f\n", key, count, speed); } // Start programm int main(void) { int key_base; int count = 1; char key_modifier; //Disconnect any existing connections lcd.cls(); lcd.locate(0,0); lcd.printf("Starting Up..\nAllowing USB to settle\n>>Please Wait<< "); wait(10); while(1) { key_base = 1; while(key_base <= 4) { lcd.cls(); leds = ~key_base; myleds = key_base; key_modifier = '0'+key_base; keyboard.keyCode(key_modifier, hotkeys); lcd_print(key_modifier, count, speed); wait(speed); key_base++; count++; } } }