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: mbed FATFileSystem USBHost-STM32F4
Revision 0:5637087657f5, committed 2019-02-19
- Comitter:
- hudakz
- Date:
- Tue Feb 19 21:52:55 2019 +0000
- Commit message:
- Example program of using USB keyboard with STM32F407VET6 boards (compatible with Seed Arch Max).
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FATFileSystem.lib Tue Feb 19 21:52:55 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/mbed-official/code/FATFileSystem/#28e685e5ff7f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBHost-STM32F4.lib Tue Feb 19 21:52:55 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/hudakz/code/USBHost-STM32F4/#458bf947f46f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Feb 19 21:52:55 2019 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "USBHostKeyboard.h"
+
+#define LED1 PA_6
+
+DigitalOut led(LED1);
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+void onKeyboardEvent(uint8_t keyCode, uint8_t modifier)
+{
+ printf("keyCode: %d, modifier: %d\r\n", keyCode, modifier);
+}
+
+/**
+ * @brief
+ * @note
+ * @param
+ * @retval
+ */
+int main()
+{
+ USBHostKeyboard keyboard;
+
+ // connect a USB keyboard
+ if (!keyboard.connect()) {
+ printf("USB keyboard not found.\n");
+ return -1;
+ }
+
+ printf("Keyboard connected\r\n");
+ // when connected, attach handler called on keyboard event
+ keyboard.attach(onKeyboardEvent);
+
+ Timer t;
+ t.start();
+ while(1) {
+ if (t.read_ms() > 500) {
+ led = !led;
+ t.reset();
+ }
+
+ USBHost::poll();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 19 21:52:55 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file