diff options
| author | Joel Challis <git@zvecr.com> | 2019-12-11 19:36:00 +0000 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-12-11 11:36:00 -0800 |
| commit | 071eb2478f039e21effb981a8a98e6181238b53b (patch) | |
| tree | 061ba39b3de6080bac9adb2a3a0922624d8d047c | |
| parent | 770a4ee7291095aaa6548d3e988633bf2ae6e6c0 (diff) | |
| download | qmk_firmware-071eb2478f039e21effb981a8a98e6181238b53b.tar.gz qmk_firmware-071eb2478f039e21effb981a8a98e6181238b53b.zip | |
Remove mbed files (#7605)
* Remove mbed files
* Remove mbed files - fix comment
* Remove mbed logic blocks
| -rw-r--r-- | docs/faq_build.md | 8 | ||||
| -rw-r--r-- | docs/fr-fr/faq_build.md | 9 | ||||
| -rw-r--r-- | docs/zh-cn/faq_build.md | 8 | ||||
| -rw-r--r-- | doxygen-todo | 1 | ||||
| -rw-r--r-- | tmk_core/common/mbed/bootloader.c | 3 | ||||
| -rw-r--r-- | tmk_core/common/mbed/suspend.c | 5 | ||||
| -rw-r--r-- | tmk_core/common/mbed/timer.c | 23 | ||||
| -rw-r--r-- | tmk_core/common/mbed/xprintf.cpp | 50 | ||||
| -rw-r--r-- | tmk_core/common/mbed/xprintf.h | 16 | ||||
| -rw-r--r-- | tmk_core/common/print.h | 33 | ||||
| -rw-r--r-- | tmk_core/common/wait.h | 2 | ||||
| -rw-r--r-- | tmk_core/protocol/mbed/HIDKeyboard.cpp | 260 | ||||
| -rw-r--r-- | tmk_core/protocol/mbed/HIDKeyboard.h | 32 | ||||
| -rw-r--r-- | tmk_core/protocol/mbed/mbed_driver.cpp | 21 | ||||
| -rw-r--r-- | tmk_core/protocol/mbed/mbed_driver.h | 3 | ||||
| -rw-r--r-- | tmk_core/protocol/ps2_io_mbed.c | 51 |
16 files changed, 1 insertions, 524 deletions
diff --git a/docs/faq_build.md b/docs/faq_build.md index b2e448306..618ae40f3 100644 --- a/docs/faq_build.md +++ b/docs/faq_build.md | |||
| @@ -99,14 +99,6 @@ You can buy a really unique VID:PID here. I don't think you need this for person | |||
| 99 | - http://www.obdev.at/products/vusb/license.html | 99 | - http://www.obdev.at/products/vusb/license.html |
| 100 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 | 100 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 |
| 101 | 101 | ||
| 102 | ## Cortex: `cstddef: No such file or directory` | ||
| 103 | GCC 4.8 of Ubuntu 14.04 had this problem and had to update to 4.9 with this PPA. | ||
| 104 | https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded | ||
| 105 | |||
| 106 | https://github.com/tmk/tmk_keyboard/issues/212 | ||
| 107 | https://github.com/tmk/tmk_keyboard/wiki/mbed-cortex-porting#compile-error-cstddef | ||
| 108 | https://developer.mbed.org/forum/mbed/topic/5205/ | ||
| 109 | |||
| 110 | ## BOOTLOADER_SIZE for AVR | 102 | ## BOOTLOADER_SIZE for AVR |
| 111 | Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment. | 103 | Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment. |
| 112 | 104 | ||
diff --git a/docs/fr-fr/faq_build.md b/docs/fr-fr/faq_build.md index 448ff01aa..84d88afcd 100644 --- a/docs/fr-fr/faq_build.md +++ b/docs/fr-fr/faq_build.md | |||
| @@ -99,15 +99,6 @@ Vous pouvez acheter un VID:PID unique ici. Je ne pense pas que ce soit nécessai | |||
| 99 | - http://www.obdev.at/products/vusb/license.html | 99 | - http://www.obdev.at/products/vusb/license.html |
| 100 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 | 100 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 |
| 101 | 101 | ||
| 102 | ## Cortex: `cstddef: No such file or directory` | ||
| 103 | |||
| 104 | Ce problème existait avec le GCC 4.8 d'Ubuntu 14.04, la solution a nécessité de mettre à jour vers 4.9 avec ce PPA. | ||
| 105 | https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded | ||
| 106 | |||
| 107 | https://github.com/tmk/tmk_keyboard/issues/212 | ||
| 108 | https://github.com/tmk/tmk_keyboard/wiki/mbed-cortex-porting#compile-error-cstddef | ||
| 109 | https://developer.mbed.org/forum/mbed/topic/5205/ | ||
| 110 | |||
| 111 | ## BOOTLOADER_SIZE pour AVR | 102 | ## BOOTLOADER_SIZE pour AVR |
| 112 | 103 | ||
| 113 | Notez que la taille du bootloader pour les Teensy2.0++ est de 2048bytes. Quelques Makefiles peuvent contenir une erreur et avoir le mauvais commentaire. | 104 | Notez que la taille du bootloader pour les Teensy2.0++ est de 2048bytes. Quelques Makefiles peuvent contenir une erreur et avoir le mauvais commentaire. |
diff --git a/docs/zh-cn/faq_build.md b/docs/zh-cn/faq_build.md index 82d0697a8..0d9047bc5 100644 --- a/docs/zh-cn/faq_build.md +++ b/docs/zh-cn/faq_build.md | |||
| @@ -68,14 +68,6 @@ https://github.com/tmk/tmk_keyboard/issues/150 | |||
| 68 | - http://www.obdev.at/products/vusb/license.html | 68 | - http://www.obdev.at/products/vusb/license.html |
| 69 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 | 69 | - http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 |
| 70 | 70 | ||
| 71 | ## Cortex: `cstddef: No such file or directory` | ||
| 72 | 在Ubuntu 14.04上的GCC 4.8 会出现这种问题需要用这个PPA升级到4.9。 | ||
| 73 | https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded | ||
| 74 | |||
| 75 | https://github.com/tmk/tmk_keyboard/issues/212 | ||
| 76 | https://github.com/tmk/tmk_keyboard/wiki/mbed-cortex-porting#compile-error-cstddef | ||
| 77 | https://developer.mbed.org/forum/mbed/topic/5205/ | ||
| 78 | |||
| 79 | ## AVR的BOOTLOADER_SIZE | 71 | ## AVR的BOOTLOADER_SIZE |
| 80 | 注意Teensy2.0++ bootloader的大小是2048字节。有些Makefile注释错了。 | 72 | 注意Teensy2.0++ bootloader的大小是2048字节。有些Makefile注释错了。 |
| 81 | 73 | ||
diff --git a/doxygen-todo b/doxygen-todo index d5ae84058..0f3010ffa 100644 --- a/doxygen-todo +++ b/doxygen-todo | |||
| @@ -3,7 +3,6 @@ tmk_core/protocol/bluefruit | |||
| 3 | tmk_core/protocol/chibios | 3 | tmk_core/protocol/chibios |
| 4 | tmk_core/protocol/iwrap | 4 | tmk_core/protocol/iwrap |
| 5 | tmk_core/protocol/lufa | 5 | tmk_core/protocol/lufa |
| 6 | tmk_core/protocol/mbed | ||
| 7 | tmk_core/protocol/midi | 6 | tmk_core/protocol/midi |
| 8 | tmk_core/protocol/midi/bytequeue | 7 | tmk_core/protocol/midi/bytequeue |
| 9 | tmk_core/protocol/midi/Config | 8 | tmk_core/protocol/midi/Config |
diff --git a/tmk_core/common/mbed/bootloader.c b/tmk_core/common/mbed/bootloader.c deleted file mode 100644 index 88945eb05..000000000 --- a/tmk_core/common/mbed/bootloader.c +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | #include "bootloader.h" | ||
| 2 | |||
| 3 | void bootloader_jump(void) {} | ||
diff --git a/tmk_core/common/mbed/suspend.c b/tmk_core/common/mbed/suspend.c deleted file mode 100644 index 3d0554f87..000000000 --- a/tmk_core/common/mbed/suspend.c +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | |||
| 3 | void suspend_power_down(void) {} | ||
| 4 | bool suspend_wakeup_condition(void) { return true; } | ||
| 5 | void suspend_wakeup_init(void) {} | ||
diff --git a/tmk_core/common/mbed/timer.c b/tmk_core/common/mbed/timer.c deleted file mode 100644 index 7e4070af2..000000000 --- a/tmk_core/common/mbed/timer.c +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | #include "cmsis.h" | ||
| 2 | #include "timer.h" | ||
| 3 | |||
| 4 | /* Mill second tick count */ | ||
| 5 | volatile uint32_t timer_count = 0; | ||
| 6 | |||
| 7 | /* Timer interrupt handler */ | ||
| 8 | void SysTick_Handler(void) { timer_count++; } | ||
| 9 | |||
| 10 | void timer_init(void) { | ||
| 11 | timer_count = 0; | ||
| 12 | SysTick_Config(SystemCoreClock / 1000); /* 1ms tick */ | ||
| 13 | } | ||
| 14 | |||
| 15 | void timer_clear(void) { timer_count = 0; } | ||
| 16 | |||
| 17 | uint16_t timer_read(void) { return (uint16_t)(timer_count & 0xFFFF); } | ||
| 18 | |||
| 19 | uint32_t timer_read32(void) { return timer_count; } | ||
| 20 | |||
| 21 | uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); } | ||
| 22 | |||
| 23 | uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } | ||
diff --git a/tmk_core/common/mbed/xprintf.cpp b/tmk_core/common/mbed/xprintf.cpp deleted file mode 100644 index 184b7fa7a..000000000 --- a/tmk_core/common/mbed/xprintf.cpp +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | #include <cstdarg> | ||
| 2 | //#include <stdarg.h> | ||
| 3 | #include "mbed.h" | ||
| 4 | #include "mbed/xprintf.h" | ||
| 5 | |||
| 6 | #define STRING_STACK_LIMIT 120 | ||
| 7 | |||
| 8 | // TODO | ||
| 9 | int __xprintf(const char* format, ...) { return 0; } | ||
| 10 | |||
| 11 | #if 0 | ||
| 12 | /* mbed Serial */ | ||
| 13 | Serial ser(UART_TX, UART_RX); | ||
| 14 | |||
| 15 | /* TODO: Need small implementation for embedded */ | ||
| 16 | int xprintf(const char* format, ...) | ||
| 17 | { | ||
| 18 | /* copy from mbed/common/RawSerial.cpp */ | ||
| 19 | std::va_list arg; | ||
| 20 | va_start(arg, format); | ||
| 21 | int len = vsnprintf(NULL, 0, format, arg); | ||
| 22 | if (len < STRING_STACK_LIMIT) { | ||
| 23 | char temp[STRING_STACK_LIMIT]; | ||
| 24 | vsprintf(temp, format, arg); | ||
| 25 | ser.puts(temp); | ||
| 26 | } else { | ||
| 27 | char *temp = new char[len + 1]; | ||
| 28 | vsprintf(temp, format, arg); | ||
| 29 | ser.puts(temp); | ||
| 30 | delete[] temp; | ||
| 31 | } | ||
| 32 | va_end(arg); | ||
| 33 | return len; | ||
| 34 | |||
| 35 | /* Fail: __builtin_va_arg_pack? | ||
| 36 | * https://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Constructing-Calls.html#Constructing-Calls | ||
| 37 | void *arg = __builtin_apply_args(); | ||
| 38 | void *ret = __builtin_apply((void*)(&(ser.printf)), arg, 100); | ||
| 39 | __builtin_return(ret) | ||
| 40 | */ | ||
| 41 | /* Fail: varargs can not be passed to printf | ||
| 42 | //int r = ser.printf("test %i\r\n", 123); | ||
| 43 | va_list arg; | ||
| 44 | va_start(arg, format); | ||
| 45 | int r = ser.printf(format, arg); | ||
| 46 | va_end(arg); | ||
| 47 | return r; | ||
| 48 | */ | ||
| 49 | } | ||
| 50 | #endif | ||
diff --git a/tmk_core/common/mbed/xprintf.h b/tmk_core/common/mbed/xprintf.h deleted file mode 100644 index e27822d3a..000000000 --- a/tmk_core/common/mbed/xprintf.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | #ifndef XPRINTF_H | ||
| 2 | #define XPRINTF_H | ||
| 3 | |||
| 4 | //#define xprintf(format, ...) __xprintf(format, ##__VA_ARGS__) | ||
| 5 | |||
| 6 | #ifdef __cplusplus | ||
| 7 | extern "C" { | ||
| 8 | #endif | ||
| 9 | |||
| 10 | int __xprintf(const char *format, ...); | ||
| 11 | |||
| 12 | #ifdef __cplusplus | ||
| 13 | } | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #endif | ||
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index 20189838f..04ca55810 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h | |||
| @@ -128,38 +128,7 @@ extern "C" | |||
| 128 | 128 | ||
| 129 | # endif /* USER_PRINT / NORMAL PRINT */ | 129 | # endif /* USER_PRINT / NORMAL PRINT */ |
| 130 | 130 | ||
| 131 | # elif defined(__arm__) /* __arm__ */ | 131 | # endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM */ |
| 132 | |||
| 133 | # include "mbed/xprintf.h" | ||
| 134 | |||
| 135 | # ifdef USER_PRINT /* USER_PRINT */ | ||
| 136 | |||
| 137 | // Remove normal print defines | ||
| 138 | # define print(s) | ||
| 139 | # define println(s) | ||
| 140 | # define xprintf(fmt, ...) | ||
| 141 | |||
| 142 | // Create user print defines | ||
| 143 | # define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__) | ||
| 144 | # define uprint(s) xprintf(s) | ||
| 145 | # define uprintln(s) xprintf(s "\r\n") | ||
| 146 | |||
| 147 | # else /* NORMAL PRINT */ | ||
| 148 | |||
| 149 | // Create user & normal print defines | ||
| 150 | # define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__) | ||
| 151 | # define print(s) xprintf(s) | ||
| 152 | # define println(s) xprintf(s "\r\n") | ||
| 153 | # define uprint(s) print(s) | ||
| 154 | # define uprintln(s) println(s) | ||
| 155 | # define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__) | ||
| 156 | |||
| 157 | # endif /* USER_PRINT / NORMAL PRINT */ | ||
| 158 | |||
| 159 | /* TODO: to select output destinations: UART/USBSerial */ | ||
| 160 | # define print_set_sendchar(func) | ||
| 161 | |||
| 162 | # endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM / __arm__ */ | ||
| 163 | 132 | ||
| 164 | // User print disables the normal print messages in the body of QMK/TMK code and | 133 | // User print disables the normal print messages in the body of QMK/TMK code and |
| 165 | // is meant as a lightweight alternative to NOPRINT. Use it when you only want to do | 134 | // is meant as a lightweight alternative to NOPRINT. Use it when you only want to do |
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index cb1f386a6..c82cd2d65 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h | |||
| @@ -33,8 +33,6 @@ extern "C" { | |||
| 33 | # include "clks.h" | 33 | # include "clks.h" |
| 34 | # define wait_ms(ms) CLK_delay_ms(ms) | 34 | # define wait_ms(ms) CLK_delay_ms(ms) |
| 35 | # define wait_us(us) CLK_delay_us(us) | 35 | # define wait_us(us) CLK_delay_us(us) |
| 36 | #elif defined(__arm__) | ||
| 37 | # include "wait_api.h" | ||
| 38 | #else // Unit tests | 36 | #else // Unit tests |
| 39 | void wait_ms(uint32_t ms); | 37 | void wait_ms(uint32_t ms); |
| 40 | # define wait_us(us) wait_ms(us / 1000) | 38 | # define wait_us(us) wait_ms(us / 1000) |
diff --git a/tmk_core/protocol/mbed/HIDKeyboard.cpp b/tmk_core/protocol/mbed/HIDKeyboard.cpp deleted file mode 100644 index dbaf108fa..000000000 --- a/tmk_core/protocol/mbed/HIDKeyboard.cpp +++ /dev/null | |||
| @@ -1,260 +0,0 @@ | |||
| 1 | #include <stdint.h> | ||
| 2 | #include "USBHID.h" | ||
| 3 | #include "USBHID_Types.h" | ||
| 4 | #include "USBDescriptor.h" | ||
| 5 | #include "HIDKeyboard.h" | ||
| 6 | |||
| 7 | #define DEFAULT_CONFIGURATION (1) | ||
| 8 | |||
| 9 | HIDKeyboard::HIDKeyboard(uint16_t vendor_id, uint16_t product_id, uint16_t product_release) : USBDevice(vendor_id, product_id, product_release) { USBDevice::connect(); } | ||
| 10 | |||
| 11 | bool HIDKeyboard::sendReport(report_keyboard_t report) { | ||
| 12 | USBDevice::write(EP1IN, report.raw, sizeof(report), MAX_PACKET_SIZE_EP1); | ||
| 13 | return true; | ||
| 14 | } | ||
| 15 | |||
| 16 | uint8_t HIDKeyboard::leds() { return led_state; } | ||
| 17 | |||
| 18 | bool HIDKeyboard::USBCallback_setConfiguration(uint8_t configuration) { | ||
| 19 | if (configuration != DEFAULT_CONFIGURATION) { | ||
| 20 | return false; | ||
| 21 | } | ||
| 22 | |||
| 23 | // Configure endpoints > 0 | ||
| 24 | addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT); | ||
| 25 | // addEndpoint(EPINT_OUT, MAX_PACKET_SIZE_EPINT); | ||
| 26 | |||
| 27 | // We activate the endpoint to be able to recceive data | ||
| 28 | // readStart(EPINT_OUT, MAX_PACKET_SIZE_EPINT); | ||
| 29 | return true; | ||
| 30 | } | ||
| 31 | |||
| 32 | uint8_t *HIDKeyboard::stringImanufacturerDesc() { | ||
| 33 | static uint8_t stringImanufacturerDescriptor[] = { | ||
| 34 | 0x18, /*bLength*/ | ||
| 35 | STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ | ||
| 36 | 't', | ||
| 37 | 0, | ||
| 38 | 'm', | ||
| 39 | 0, | ||
| 40 | 'k', | ||
| 41 | 0, | ||
| 42 | '-', | ||
| 43 | 0, | ||
| 44 | 'k', | ||
| 45 | 0, | ||
| 46 | 'b', | ||
| 47 | 0, | ||
| 48 | 'd', | ||
| 49 | 0, | ||
| 50 | '.', | ||
| 51 | 0, | ||
| 52 | 'c', | ||
| 53 | 0, | ||
| 54 | 'o', | ||
| 55 | 0, | ||
| 56 | 'm', | ||
| 57 | 0 /*bString iManufacturer*/ | ||
| 58 | }; | ||
| 59 | return stringImanufacturerDescriptor; | ||
| 60 | } | ||
| 61 | |||
| 62 | uint8_t *HIDKeyboard::stringIproductDesc() { | ||
| 63 | static uint8_t stringIproductDescriptor[] = { | ||
| 64 | 0x0a, /*bLength*/ | ||
| 65 | STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ | ||
| 66 | 'm', | ||
| 67 | 0, | ||
| 68 | 'b', | ||
| 69 | 0, | ||
| 70 | 'e', | ||
| 71 | 0, | ||
| 72 | 'd', | ||
| 73 | 0 /*bString iProduct*/ | ||
| 74 | }; | ||
| 75 | return stringIproductDescriptor; | ||
| 76 | } | ||
| 77 | |||
| 78 | uint8_t *HIDKeyboard::stringIserialDesc() { | ||
| 79 | static uint8_t stringIserialDescriptor[] = { | ||
| 80 | 0x04, /*bLength*/ | ||
| 81 | STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ | ||
| 82 | '0', 0 /*bString iSerial*/ | ||
| 83 | }; | ||
| 84 | return stringIserialDescriptor; | ||
| 85 | } | ||
| 86 | |||
| 87 | uint8_t *HIDKeyboard::reportDesc() { | ||
| 88 | static uint8_t reportDescriptor[] = { | ||
| 89 | USAGE_PAGE(1), 0x01, // Generic Desktop | ||
| 90 | USAGE(1), 0x06, // Keyboard | ||
| 91 | COLLECTION(1), 0x01, // Application | ||
| 92 | |||
| 93 | USAGE_PAGE(1), 0x07, // Key Codes | ||
| 94 | USAGE_MINIMUM(1), 0xE0, USAGE_MAXIMUM(1), 0xE7, LOGICAL_MINIMUM(1), 0x00, LOGICAL_MAXIMUM(1), 0x01, REPORT_SIZE(1), 0x01, REPORT_COUNT(1), 0x08, INPUT(1), 0x02, // Data, Variable, Absolute | ||
| 95 | |||
| 96 | REPORT_COUNT(1), 0x01, REPORT_SIZE(1), 0x08, INPUT(1), 0x01, // Constant | ||
| 97 | |||
| 98 | REPORT_COUNT(1), 0x05, REPORT_SIZE(1), 0x01, USAGE_PAGE(1), 0x08, // LEDs | ||
| 99 | USAGE_MINIMUM(1), 0x01, USAGE_MAXIMUM(1), 0x05, OUTPUT(1), 0x02, // Data, Variable, Absolute | ||
| 100 | |||
| 101 | REPORT_COUNT(1), 0x01, REPORT_SIZE(1), 0x03, OUTPUT(1), 0x01, // Constant | ||
| 102 | |||
| 103 | REPORT_COUNT(1), 0x06, REPORT_SIZE(1), 0x08, LOGICAL_MINIMUM(1), 0x00, LOGICAL_MAXIMUM(1), 0xFF, USAGE_PAGE(1), 0x07, // Key Codes | ||
| 104 | USAGE_MINIMUM(1), 0x00, USAGE_MAXIMUM(1), 0xFF, INPUT(1), 0x00, // Data, Array | ||
| 105 | END_COLLECTION(0), | ||
| 106 | }; | ||
| 107 | reportLength = sizeof(reportDescriptor); | ||
| 108 | return reportDescriptor; | ||
| 109 | } | ||
| 110 | |||
| 111 | uint16_t HIDKeyboard::reportDescLength() { | ||
| 112 | reportDesc(); | ||
| 113 | return reportLength; | ||
| 114 | } | ||
| 115 | |||
| 116 | #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) + (1 * INTERFACE_DESCRIPTOR_LENGTH) + (1 * HID_DESCRIPTOR_LENGTH) + (1 * ENDPOINT_DESCRIPTOR_LENGTH)) | ||
| 117 | uint8_t *HIDKeyboard::configurationDesc() { | ||
| 118 | static uint8_t configurationDescriptor[] = { | ||
| 119 | CONFIGURATION_DESCRIPTOR_LENGTH, // bLength | ||
| 120 | CONFIGURATION_DESCRIPTOR, // bDescriptorType | ||
| 121 | LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB) | ||
| 122 | MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB) | ||
| 123 | 0x01, // bNumInterfaces | ||
| 124 | DEFAULT_CONFIGURATION, // bConfigurationValue | ||
| 125 | 0x00, // iConfiguration | ||
| 126 | C_RESERVED | C_REMOTE_WAKEUP, // bmAttributes | ||
| 127 | C_POWER(100), // bMaxPowerHello World from Mbed | ||
| 128 | |||
| 129 | INTERFACE_DESCRIPTOR_LENGTH, // bLength | ||
| 130 | INTERFACE_DESCRIPTOR, // bDescriptorType | ||
| 131 | 0x00, // bInterfaceNumber | ||
| 132 | 0x00, // bAlternateSetting | ||
| 133 | 0x01, // bNumEndpoints | ||
| 134 | HID_CLASS, // bInterfaceClass | ||
| 135 | 1, // bInterfaceSubClass (boot) | ||
| 136 | 1, // bInterfaceProtocol (keyboard) | ||
| 137 | 0x00, // iInterface | ||
| 138 | |||
| 139 | HID_DESCRIPTOR_LENGTH, // bLength | ||
| 140 | HID_DESCRIPTOR, // bDescriptorType | ||
| 141 | LSB(HID_VERSION_1_11), // bcdHID (LSB) | ||
| 142 | MSB(HID_VERSION_1_11), // bcdHID (MSB) | ||
| 143 | 0x00, // bCountryCode | ||
| 144 | 0x01, // bNumDescriptors | ||
| 145 | REPORT_DESCRIPTOR, // bDescriptorType | ||
| 146 | (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB) | ||
| 147 | (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB) | ||
| 148 | |||
| 149 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength | ||
| 150 | ENDPOINT_DESCRIPTOR, // bDescriptorType | ||
| 151 | PHY_TO_DESC(EP1IN), // bEndpointAddress | ||
| 152 | E_INTERRUPT, // bmAttributes | ||
| 153 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) | ||
| 154 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) | ||
| 155 | 1, // bInterval (milliseconds) | ||
| 156 | }; | ||
| 157 | return configurationDescriptor; | ||
| 158 | } | ||
| 159 | |||
| 160 | #if 0 | ||
| 161 | uint8_t * HIDKeyboard::deviceDesc() { | ||
| 162 | static uint8_t deviceDescriptor[] = { | ||
| 163 | DEVICE_DESCRIPTOR_LENGTH, /* bLength */ | ||
| 164 | DEVICE_DESCRIPTOR, /* bDescriptorType */ | ||
| 165 | LSB(USB_VERSION_2_0), /* bcdUSB (LSB) */ | ||
| 166 | MSB(USB_VERSION_2_0), /* bcdUSB (MSB) */ | ||
| 167 | 0x00, /* bDeviceClass */ | ||
| 168 | 0x00, /* bDeviceSubClass */ | ||
| 169 | 0x00, /* bDeviceprotocol */ | ||
| 170 | MAX_PACKET_SIZE_EP0, /* bMaxPacketSize0 */ | ||
| 171 | (uint8_t)(LSB(0xfeed)), /* idVendor (LSB) */ | ||
| 172 | (uint8_t)(MSB(0xfeed)), /* idVendor (MSB) */ | ||
| 173 | (uint8_t)(LSB(0x1bed)), /* idProduct (LSB) */ | ||
| 174 | (uint8_t)(MSB(0x1bed)), /* idProduct (MSB) */ | ||
| 175 | (uint8_t)(LSB(0x0002)), /* bcdDevice (LSB) */ | ||
| 176 | (uint8_t)(MSB(0x0002)), /* bcdDevice (MSB) */ | ||
| 177 | 0, /* iManufacturer */ | ||
| 178 | 0, /* iProduct */ | ||
| 179 | 0, /* iSerialNumber */ | ||
| 180 | 0x01 /* bNumConfigurations */ | ||
| 181 | }; | ||
| 182 | return deviceDescriptor; | ||
| 183 | } | ||
| 184 | #endif | ||
| 185 | |||
| 186 | bool HIDKeyboard::USBCallback_request() { | ||
| 187 | bool success = false; | ||
| 188 | CONTROL_TRANSFER *transfer = getTransferPtr(); | ||
| 189 | uint8_t * hidDescriptor; | ||
| 190 | |||
| 191 | // Process additional standard requests | ||
| 192 | |||
| 193 | if ((transfer->setup.bmRequestType.Type == STANDARD_TYPE)) { | ||
| 194 | switch (transfer->setup.bRequest) { | ||
| 195 | case GET_DESCRIPTOR: | ||
| 196 | switch (DESCRIPTOR_TYPE(transfer->setup.wValue)) { | ||
| 197 | case REPORT_DESCRIPTOR: | ||
| 198 | if ((reportDesc() != NULL) && (reportDescLength() != 0)) { | ||
| 199 | transfer->remaining = reportDescLength(); | ||
| 200 | transfer->ptr = reportDesc(); | ||
| 201 | transfer->direction = DEVICE_TO_HOST; | ||
| 202 | success = true; | ||
| 203 | } | ||
| 204 | break; | ||
| 205 | case HID_DESCRIPTOR: | ||
| 206 | // Find the HID descriptor, after the configuration descriptor | ||
| 207 | hidDescriptor = findDescriptor(HID_DESCRIPTOR); | ||
| 208 | if (hidDescriptor != NULL) { | ||
| 209 | transfer->remaining = HID_DESCRIPTOR_LENGTH; | ||
| 210 | transfer->ptr = hidDescriptor; | ||
| 211 | transfer->direction = DEVICE_TO_HOST; | ||
| 212 | success = true; | ||
| 213 | } | ||
| 214 | break; | ||
| 215 | |||
| 216 | default: | ||
| 217 | break; | ||
| 218 | } | ||
| 219 | break; | ||
| 220 | default: | ||
| 221 | break; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | // Process class-specific requests | ||
| 226 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { | ||
| 227 | switch (transfer->setup.bRequest) { | ||
| 228 | case SET_REPORT: | ||
| 229 | // LED indicator | ||
| 230 | // TODO: check Interface and Report length? | ||
| 231 | // if (transfer->setup.wIndex == INTERFACE_KEYBOAD) { } | ||
| 232 | // if (transfer->setup.wLength == 1) | ||
| 233 | |||
| 234 | transfer->remaining = 1; | ||
| 235 | // transfer->ptr = ?? what ptr should be set when OUT(not used?) | ||
| 236 | transfer->direction = HOST_TO_DEVICE; | ||
| 237 | transfer->notify = true; /* notify with USBCallback_requestCompleted */ | ||
| 238 | success = true; | ||
| 239 | default: | ||
| 240 | break; | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 244 | return success; | ||
| 245 | } | ||
| 246 | |||
| 247 | void HIDKeyboard::USBCallback_requestCompleted(uint8_t *buf, uint32_t length) { | ||
| 248 | if (length > 0) { | ||
| 249 | CONTROL_TRANSFER *transfer = getTransferPtr(); | ||
| 250 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { | ||
| 251 | switch (transfer->setup.bRequest) { | ||
| 252 | case SET_REPORT: | ||
| 253 | led_state = buf[0]; | ||
| 254 | break; | ||
| 255 | default: | ||
| 256 | break; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | } | ||
| 260 | } | ||
diff --git a/tmk_core/protocol/mbed/HIDKeyboard.h b/tmk_core/protocol/mbed/HIDKeyboard.h deleted file mode 100644 index e8ff10869..000000000 --- a/tmk_core/protocol/mbed/HIDKeyboard.h +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | #ifndef HIDKEYBOARD_H | ||
| 2 | |||
| 3 | # include "stdint.h" | ||
| 4 | # include "stdbool.h" | ||
| 5 | # include "USBHID.h" | ||
| 6 | # include "report.h" | ||
| 7 | |||
| 8 | class HIDKeyboard : public USBDevice { | ||
| 9 | public: | ||
| 10 | HIDKeyboard(uint16_t vendor_id = 0xFEED, uint16_t product_id = 0xabed, uint16_t product_release = 0x0001); | ||
| 11 | |||
| 12 | bool sendReport(report_keyboard_t report); | ||
| 13 | uint8_t leds(void); | ||
| 14 | |||
| 15 | protected: | ||
| 16 | uint16_t reportLength; | ||
| 17 | virtual bool USBCallback_setConfiguration(uint8_t configuration); | ||
| 18 | virtual uint8_t* stringImanufacturerDesc(); | ||
| 19 | virtual uint8_t* stringIproductDesc(); | ||
| 20 | virtual uint8_t* stringIserialDesc(); | ||
| 21 | virtual uint16_t reportDescLength(); | ||
| 22 | virtual uint8_t* reportDesc(); | ||
| 23 | virtual uint8_t* configurationDesc(); | ||
| 24 | // virtual uint8_t * deviceDesc(); | ||
| 25 | virtual bool USBCallback_request(); | ||
| 26 | virtual void USBCallback_requestCompleted(uint8_t* buf, uint32_t length); | ||
| 27 | |||
| 28 | private: | ||
| 29 | uint8_t led_state; | ||
| 30 | }; | ||
| 31 | |||
| 32 | #endif | ||
diff --git a/tmk_core/protocol/mbed/mbed_driver.cpp b/tmk_core/protocol/mbed/mbed_driver.cpp deleted file mode 100644 index 83086499c..000000000 --- a/tmk_core/protocol/mbed/mbed_driver.cpp +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | #include "HIDKeyboard.h" | ||
| 2 | #include "host.h" | ||
| 3 | #include "host_driver.h" | ||
| 4 | #include "mbed_driver.h" | ||
| 5 | |||
| 6 | HIDKeyboard keyboard; | ||
| 7 | |||
| 8 | /* Host driver */ | ||
| 9 | static uint8_t keyboard_leds(void); | ||
| 10 | static void send_keyboard(report_keyboard_t *report); | ||
| 11 | static void send_mouse(report_mouse_t *report); | ||
| 12 | static void send_system(uint16_t data); | ||
| 13 | static void send_consumer(uint16_t data); | ||
| 14 | |||
| 15 | host_driver_t mbed_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer}; | ||
| 16 | |||
| 17 | static uint8_t keyboard_leds(void) { return keyboard.leds(); } | ||
| 18 | static void send_keyboard(report_keyboard_t *report) { keyboard.sendReport(*report); } | ||
| 19 | static void send_mouse(report_mouse_t *report) {} | ||
| 20 | static void send_system(uint16_t data) {} | ||
| 21 | static void send_consumer(uint16_t data) {} | ||
diff --git a/tmk_core/protocol/mbed/mbed_driver.h b/tmk_core/protocol/mbed/mbed_driver.h deleted file mode 100644 index dd1153b43..000000000 --- a/tmk_core/protocol/mbed/mbed_driver.h +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | #include "host_driver.h" | ||
| 2 | |||
| 3 | extern host_driver_t mbed_driver; | ||
diff --git a/tmk_core/protocol/ps2_io_mbed.c b/tmk_core/protocol/ps2_io_mbed.c deleted file mode 100644 index 9cec3dfbb..000000000 --- a/tmk_core/protocol/ps2_io_mbed.c +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | #include <stdbool.h> | ||
| 2 | #include "ps2_io.h" | ||
| 3 | #include "gpio_api.h" | ||
| 4 | |||
| 5 | static gpio_t clock; | ||
| 6 | static gpio_t data; | ||
| 7 | |||
| 8 | /* | ||
| 9 | * Clock | ||
| 10 | */ | ||
| 11 | void clock_init(void) { | ||
| 12 | gpio_init(&clock, P0_9); | ||
| 13 | gpio_mode(&clock, OpenDrain | PullNone); | ||
| 14 | } | ||
| 15 | |||
| 16 | void clock_lo(void) { | ||
| 17 | gpio_dir(&clock, PIN_OUTPUT); | ||
| 18 | gpio_write(&clock, 0); | ||
| 19 | } | ||
| 20 | void clock_hi(void) { | ||
| 21 | gpio_dir(&clock, PIN_OUTPUT); | ||
| 22 | gpio_write(&clock, 1); | ||
| 23 | } | ||
| 24 | |||
| 25 | bool clock_in(void) { | ||
| 26 | gpio_dir(&clock, PIN_INPUT); | ||
| 27 | return gpio_read(&clock); | ||
| 28 | } | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Data | ||
| 32 | */ | ||
| 33 | void data_init(void) { | ||
| 34 | gpio_init(&data, P0_8); | ||
| 35 | gpio_mode(&data, OpenDrain | PullNone); | ||
| 36 | } | ||
| 37 | |||
| 38 | void data_lo(void) { | ||
| 39 | gpio_dir(&data, PIN_OUTPUT); | ||
| 40 | gpio_write(&data, 0); | ||
| 41 | } | ||
| 42 | |||
| 43 | void data_hi(void) { | ||
| 44 | gpio_dir(&data, PIN_OUTPUT); | ||
| 45 | gpio_write(&data, 1); | ||
| 46 | } | ||
| 47 | |||
| 48 | bool data_in(void) { | ||
| 49 | gpio_dir(&data, PIN_INPUT); | ||
| 50 | return gpio_read(&data); | ||
| 51 | } | ||
