USBKeyboard example with media keys

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Fri Mar 01 13:24:33 2013 +0000
Parent:
1:f9120f998887
Commit message:
use latest USBDevice lib (FRDM-KL25Z support)

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice.lib	Thu Nov 03 17:38:03 2011 +0000
+++ b/USBDevice.lib	Fri Mar 01 13:24:33 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/samux/code/USBDevice/#019ce73594da
+http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
--- a/main.cpp	Thu Nov 03 17:38:03 2011 +0000
+++ b/main.cpp	Fri Mar 01 13:24:33 2013 +0000
@@ -1,35 +1,33 @@
-#include "mbed.h"
-#include "USBKeyboard.h"
-
-USBKeyboard keyboard;
-
-//Bus of buttons
-BusInOut buttons(p21, p22, p23, p24, p25, p26, p29);
-
-int main(void) {
-    uint8_t p_bus = 0;
-
-    while (1) {
-        //if the bus of buttons has changed, send a report
-        if (buttons.read() != p_bus) {
-            p_bus = buttons.read();
-            if(p_bus & 0x01)
-               keyboard.mediaControl(KEY_MUTE);
-            if(p_bus & 0x02)
-               keyboard.mediaControl(KEY_VOLUME_DOWN);
-            if(p_bus & 0x04)
-               keyboard.mediaControl(KEY_VOLUME_UP);
-            if(p_bus & 0x08)
-               keyboard.mediaControl(KEY_NEXT_TRACK);
-            if(p_bus & 0x10)
-               keyboard.mediaControl(KEY_PLAY_PAUSE);
-            if(p_bus & 0x20)
-               keyboard.mediaControl(KEY_PREVIOUS_TRACK);
-            if(p_bus & 0x40)
-               keyboard.printf("Hello World\r\n");
-        }
-        wait(0.01);
-    }
-}
-
-
+#include "mbed.h"
+#include "USBKeyboard.h"
+ 
+USBKeyboard keyboard;
+ 
+//Bus of buttons
+BusInOut buttons(p21, p22, p23, p24, p25, p26, p29);
+ 
+int main(void) {
+    uint8_t p_bus = 0;
+ 
+    while (1) {
+        //if the bus of buttons has changed, send a report
+        if (buttons.read() != p_bus) {
+            p_bus = buttons.read();
+            if(p_bus & 0x01)
+               keyboard.mediaControl(KEY_MUTE);
+            if(p_bus & 0x02)
+               keyboard.mediaControl(KEY_VOLUME_DOWN);
+            if(p_bus & 0x04)
+               keyboard.mediaControl(KEY_VOLUME_UP);
+            if(p_bus & 0x08)
+               keyboard.mediaControl(KEY_NEXT_TRACK);
+            if(p_bus & 0x10)
+               keyboard.mediaControl(KEY_PLAY_PAUSE);
+            if(p_bus & 0x20)
+               keyboard.mediaControl(KEY_PREVIOUS_TRACK);
+            if(p_bus & 0x40)
+               keyboard.printf("Hello World\r\n");
+        }
+        wait(0.01);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Mar 01 13:24:33 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec
\ No newline at end of file