diff options
| author | Balz Guenat <balz.guenat@gmail.com> | 2017-11-08 17:11:44 +0100 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-11-08 11:11:44 -0500 |
| commit | 3b5381d6893b02b48b9abd4845220cd68d02979f (patch) | |
| tree | 79ea380d96b82f3651b6d5bbfabdff296fd886da | |
| parent | aee67854769feee7e94edd90686178d89946a7ee (diff) | |
| download | qmk_firmware-3b5381d6893b02b48b9abd4845220cd68d02979f.tar.gz qmk_firmware-3b5381d6893b02b48b9abd4845220cd68d02979f.zip | |
restructure converters (#1825)
* restructure converters
each converter is its own keyboard and different hardware variants are different subprojects.
remove (seemingly) old method of loading layouts from main Makefile
* call led_set_kb() from overridden led_set()
* put converter back into one folder
* revert some structure changes to bring in line with #1784.
Also attempt to get the BLE thing more properly integrated.
Also also fix led_set() to call led_set_kb().
20 files changed, 86 insertions, 45 deletions
diff --git a/keyboards/converter/ibm_terminal/README b/keyboards/converter/ibm_terminal/README.md index 6b7aff2c8..dff26e059 100644 --- a/keyboards/converter/ibm_terminal/README +++ b/keyboards/converter/ibm_terminal/README.md | |||
| @@ -6,7 +6,7 @@ This is a port of TMK's converter/terminal_usb to QMK. | |||
| 6 | It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy. | 6 | It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy. |
| 7 | I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys). | 7 | I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys). |
| 8 | 8 | ||
| 9 | Source code: https://github.com/tmk/tmk_keyboard | 9 | Source code: https://github.com/qmk/qmk_firmware.git |
| 10 | Article: http://geekhack.org/index.php?topic=27272.0 | 10 | Article: http://geekhack.org/index.php?topic=27272.0 |
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -22,9 +22,9 @@ And VCC and GND, of course. See RESOURCE for keyboard connector pin assign. | |||
| 22 | 22 | ||
| 23 | BUILD | 23 | BUILD |
| 24 | ----- | 24 | ----- |
| 25 | $ git clone https://github.com/tmk/tmk_keyboard.git | 25 | $ git clone https://github.com/qmk/qmk_firmware.git |
| 26 | $ cd converter/terminal_usb | 26 | $ cd qmk_firmware |
| 27 | $ make | 27 | $ make converter/ibm_terminal:default |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | RESOURCE | 30 | RESOURCE |
diff --git a/keyboards/converter/ibm_terminal/ibm_terminal.c b/keyboards/converter/ibm_terminal/ibm_terminal.c index 17296864a..fd64a21ac 100644 --- a/keyboards/converter/ibm_terminal/ibm_terminal.c +++ b/keyboards/converter/ibm_terminal/ibm_terminal.c | |||
| @@ -1,6 +1 @@ | |||
| 1 | #include "ibm_terminal.h" | #include "ibm_terminal.h" | |
| 2 | |||
| 3 | // void matrix_init_kb(void) { | ||
| 4 | |||
| 5 | // matrix_init_user(); | ||
| 6 | // } \ No newline at end of file | ||
diff --git a/keyboards/converter/usb_usb/README.md b/keyboards/converter/usb_usb/README.md index 2ed702695..b529fbd28 100644 --- a/keyboards/converter/usb_usb/README.md +++ b/keyboards/converter/usb_usb/README.md | |||
| @@ -13,13 +13,18 @@ Make example for this keyboard (after setting up your build environment): | |||
| 13 | 13 | ||
| 14 | See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. | 14 | See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. |
| 15 | 15 | ||
| 16 | Note that you have to choose the right hardware variant as your subproject, otherwise you will probably have issues. | ||
| 17 | |||
| 16 | Troubleshooting & Known Issues | 18 | Troubleshooting & Known Issues |
| 17 | ------------------------------ | 19 | ------------------------------ |
| 18 | The Pro Micro variant runs at 8MHz, hence the following line in `usb_usb/rules.mk`: | 20 | If something doesn't work, it's probably because of the CPU clock. |
| 19 | `F_CPU ?= 8000000` | 21 | Be sure to select the correct subproject (the middle part of the `make` argument) according to your hardware. |
| 20 | If the firmware doesn't work, try changing that line to | 22 | If you are sure you have this correct, try changeing the default in `usb_usb/rules.mk` or overriding the value in the `rules.mk` of your keymap. |
| 21 | `F_CPU ?= 16000000` | 23 | |
| 22 | or override the `F_CPU` variable in the `rules.mk` of your keymap. | 24 | The Pro Micro variant uses a 3.3V Pro Micro and thus runs at 8MHz, hence the following line in `usb_usb/pro_micro/rules.mk`: |
| 25 | `F_CPU = 8000000` | ||
| 26 | The converter sold by Hasu runs at 16MHz and so the corresponding line in `usb_usb/hasu/rules.mk` is: | ||
| 27 | `F_CPU = 16000000` | ||
| 23 | 28 | ||
| 24 | Getting the Hardware | 29 | Getting the Hardware |
| 25 | -------------------- | 30 | -------------------- |
diff --git a/keyboards/converter/usb_usb/keymaps/ble/README.md b/keyboards/converter/usb_usb/ble/README.md index 0ee7223fd..0ee7223fd 100644 --- a/keyboards/converter/usb_usb/keymaps/ble/README.md +++ b/keyboards/converter/usb_usb/ble/README.md | |||
diff --git a/keyboards/converter/usb_usb/ble/ble.c b/keyboards/converter/usb_usb/ble/ble.c new file mode 100644 index 000000000..387eb8166 --- /dev/null +++ b/keyboards/converter/usb_usb/ble/ble.c | |||
| @@ -0,0 +1 @@ | |||
| #include "ble.h" | |||
diff --git a/keyboards/converter/usb_usb/ble/ble.h b/keyboards/converter/usb_usb/ble/ble.h new file mode 100644 index 000000000..d28629643 --- /dev/null +++ b/keyboards/converter/usb_usb/ble/ble.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef BLE_H | ||
| 2 | #define BLE_H | ||
| 3 | |||
| 4 | #include QMK_KEYBOARD_H | ||
| 5 | |||
| 6 | #endif | ||
diff --git a/keyboards/converter/usb_usb/ble/config.h b/keyboards/converter/usb_usb/ble/config.h new file mode 100644 index 000000000..45aa778d5 --- /dev/null +++ b/keyboards/converter/usb_usb/ble/config.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef CONFIG_BLE_H | ||
| 2 | #define CONFIG_BLE_H | ||
| 3 | |||
| 4 | #undef PRODUCT | ||
| 5 | #define PRODUCT QMK BLE Adapter | ||
| 6 | #undef DESCRIPTION | ||
| 7 | #define DESCRIPTION | ||
| 8 | |||
| 9 | // Turn off the mode leds on the BLE module | ||
| 10 | #define ADAFRUIT_BLE_ENABLE_MODE_LEDS 0 | ||
| 11 | #define ADAFRUIT_BLE_ENABLE_POWER_LED 0 | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/keyboards/converter/usb_usb/ble/rules.mk b/keyboards/converter/usb_usb/ble/rules.mk new file mode 100644 index 000000000..c951780e2 --- /dev/null +++ b/keyboards/converter/usb_usb/ble/rules.mk | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | BLUETOOTH = AdafruitBLE | ||
| 2 | ADAFRUIT_BLE_ENABLE = yes | ||
| 3 | OPT_DEFS += -DCATERINA_BOOTLOADER | ||
| 4 | F_CPU = 8000000 | ||
diff --git a/keyboards/converter/usb_usb/config.h b/keyboards/converter/usb_usb/config.h index 591d80f32..deee35948 100644 --- a/keyboards/converter/usb_usb/config.h +++ b/keyboards/converter/usb_usb/config.h | |||
| @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | // do not #include "config_common.h" because the pin names conflict with the USB HID code. | 21 | // do not #include "config_common.h" because the pin names conflict with the USB HID code. |
| 22 | // CUSTOM_MATRIX is defined it that file, though, and we need it, so we define it ourselves. | 22 | // CUSTOM_MATRIX is defined it that file, though, and we need it, so we define it ourselves. |
| 23 | // It's a hack, yeah... | 23 | // It's a hack, yeah... |
| 24 | |||
| 24 | #define CUSTOM_MATRIX 2 | 25 | #define CUSTOM_MATRIX 2 |
| 25 | 26 | ||
| 26 | /* USB Device descriptor parameter */ | 27 | /* USB Device descriptor parameter */ |
diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp index 93d13edf0..fba107c7c 100644 --- a/keyboards/converter/usb_usb/custom_matrix.cpp +++ b/keyboards/converter/usb_usb/custom_matrix.cpp | |||
| @@ -35,6 +35,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | #include "host.h" | 35 | #include "host.h" |
| 36 | #include "keyboard.h" | 36 | #include "keyboard.h" |
| 37 | 37 | ||
| 38 | extern "C" { | ||
| 39 | #include "quantum.h" | ||
| 40 | } | ||
| 38 | 41 | ||
| 39 | /* KEY CODE to Matrix | 42 | /* KEY CODE to Matrix |
| 40 | * | 43 | * |
| @@ -62,7 +65,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 62 | 65 | ||
| 63 | 66 | ||
| 64 | // Integrated key state of all keyboards | 67 | // Integrated key state of all keyboards |
| 65 | static report_keyboard_t keyboard_report; | 68 | static report_keyboard_t local_keyboard_report; |
| 66 | 69 | ||
| 67 | static bool matrix_is_mod = false; | 70 | static bool matrix_is_mod = false; |
| 68 | 71 | ||
| @@ -98,13 +101,13 @@ extern "C" | |||
| 98 | } | 101 | } |
| 99 | 102 | ||
| 100 | static void or_report(report_keyboard_t report) { | 103 | static void or_report(report_keyboard_t report) { |
| 101 | // integrate reports into keyboard_report | 104 | // integrate reports into local_keyboard_report |
| 102 | keyboard_report.mods |= report.mods; | 105 | local_keyboard_report.mods |= report.mods; |
| 103 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | 106 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { |
| 104 | if (IS_ANY(report.keys[i])) { | 107 | if (IS_ANY(report.keys[i])) { |
| 105 | for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { | 108 | for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) { |
| 106 | if (! keyboard_report.keys[j]) { | 109 | if (! local_keyboard_report.keys[j]) { |
| 107 | keyboard_report.keys[j] = report.keys[i]; | 110 | local_keyboard_report.keys[j] = report.keys[i]; |
| 108 | break; | 111 | break; |
| 109 | } | 112 | } |
| 110 | } | 113 | } |
| @@ -130,7 +133,7 @@ extern "C" | |||
| 130 | last_time_stamp4 = kbd_parser4.time_stamp; | 133 | last_time_stamp4 = kbd_parser4.time_stamp; |
| 131 | 134 | ||
| 132 | // clear and integrate all reports | 135 | // clear and integrate all reports |
| 133 | keyboard_report = {}; | 136 | local_keyboard_report = {}; |
| 134 | or_report(kbd_parser1.report); | 137 | or_report(kbd_parser1.report); |
| 135 | or_report(kbd_parser2.report); | 138 | or_report(kbd_parser2.report); |
| 136 | or_report(kbd_parser3.report); | 139 | or_report(kbd_parser3.report); |
| @@ -138,9 +141,9 @@ extern "C" | |||
| 138 | 141 | ||
| 139 | matrix_is_mod = true; | 142 | matrix_is_mod = true; |
| 140 | 143 | ||
| 141 | dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved); | 144 | dprintf("state: %02X %02X", local_keyboard_report.mods, local_keyboard_report.reserved); |
| 142 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | 145 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { |
| 143 | dprintf(" %02X", keyboard_report.keys[i]); | 146 | dprintf(" %02X", local_keyboard_report.keys[i]); |
| 144 | } | 147 | } |
| 145 | dprint("\r\n"); | 148 | dprint("\r\n"); |
| 146 | } else { | 149 | } else { |
| @@ -177,12 +180,12 @@ extern "C" | |||
| 177 | uint8_t code = CODE(row, col); | 180 | uint8_t code = CODE(row, col); |
| 178 | 181 | ||
| 179 | if (IS_MOD(code)) { | 182 | if (IS_MOD(code)) { |
| 180 | if (keyboard_report.mods & ROW_BITS(code)) { | 183 | if (local_keyboard_report.mods & ROW_BITS(code)) { |
| 181 | return true; | 184 | return true; |
| 182 | } | 185 | } |
| 183 | } | 186 | } |
| 184 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | 187 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { |
| 185 | if (keyboard_report.keys[i] == code) { | 188 | if (local_keyboard_report.keys[i] == code) { |
| 186 | return true; | 189 | return true; |
| 187 | } | 190 | } |
| 188 | } | 191 | } |
| @@ -192,14 +195,14 @@ extern "C" | |||
| 192 | matrix_row_t matrix_get_row(uint8_t row) { | 195 | matrix_row_t matrix_get_row(uint8_t row) { |
| 193 | uint16_t row_bits = 0; | 196 | uint16_t row_bits = 0; |
| 194 | 197 | ||
| 195 | if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) { | 198 | if (IS_MOD(CODE(row, 0)) && local_keyboard_report.mods) { |
| 196 | row_bits |= keyboard_report.mods; | 199 | row_bits |= local_keyboard_report.mods; |
| 197 | } | 200 | } |
| 198 | 201 | ||
| 199 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | 202 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { |
| 200 | if (IS_ANY(keyboard_report.keys[i])) { | 203 | if (IS_ANY(local_keyboard_report.keys[i])) { |
| 201 | if (row == ROW(keyboard_report.keys[i])) { | 204 | if (row == ROW(local_keyboard_report.keys[i])) { |
| 202 | row_bits |= ROW_BITS(keyboard_report.keys[i]); | 205 | row_bits |= ROW_BITS(local_keyboard_report.keys[i]); |
| 203 | } | 206 | } |
| 204 | } | 207 | } |
| 205 | } | 208 | } |
| @@ -209,9 +212,9 @@ extern "C" | |||
| 209 | uint8_t matrix_key_count(void) { | 212 | uint8_t matrix_key_count(void) { |
| 210 | uint8_t count = 0; | 213 | uint8_t count = 0; |
| 211 | 214 | ||
| 212 | count += bitpop(keyboard_report.mods); | 215 | count += bitpop(local_keyboard_report.mods); |
| 213 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { | 216 | for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { |
| 214 | if (IS_ANY(keyboard_report.keys[i])) { | 217 | if (IS_ANY(local_keyboard_report.keys[i])) { |
| 215 | count++; | 218 | count++; |
| 216 | } | 219 | } |
| 217 | } | 220 | } |
| @@ -233,6 +236,7 @@ extern "C" | |||
| 233 | kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); | 236 | kbd2.SetReport(0, 0, 2, 0, 1, &usb_led); |
| 234 | kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); | 237 | kbd3.SetReport(0, 0, 2, 0, 1, &usb_led); |
| 235 | kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); | 238 | kbd4.SetReport(0, 0, 2, 0, 1, &usb_led); |
| 239 | led_set_kb(usb_led); | ||
| 236 | } | 240 | } |
| 237 | 241 | ||
| 238 | }; | 242 | }; |
diff --git a/keyboards/converter/usb_usb/hasu/hasu.c b/keyboards/converter/usb_usb/hasu/hasu.c new file mode 100644 index 000000000..3357735ff --- /dev/null +++ b/keyboards/converter/usb_usb/hasu/hasu.c | |||
| @@ -0,0 +1 @@ | |||
| #include "hasu.h" | |||
diff --git a/keyboards/converter/usb_usb/hasu/hasu.h b/keyboards/converter/usb_usb/hasu/hasu.h new file mode 100644 index 000000000..d5e785586 --- /dev/null +++ b/keyboards/converter/usb_usb/hasu/hasu.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef HASU_H | ||
| 2 | #define HASU_H | ||
| 3 | |||
| 4 | #include QMK_KEYBOARD_H | ||
| 5 | |||
| 6 | #endif | ||
diff --git a/keyboards/converter/usb_usb/hasu/rules.mk b/keyboards/converter/usb_usb/hasu/rules.mk new file mode 100644 index 000000000..27d8af768 --- /dev/null +++ b/keyboards/converter/usb_usb/hasu/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| F_CPU = 16000000 | |||
diff --git a/keyboards/converter/usb_usb/keymaps/ble/config.h b/keyboards/converter/usb_usb/keymaps/ble/config.h index c1859b7f1..7fa3bf328 100644 --- a/keyboards/converter/usb_usb/keymaps/ble/config.h +++ b/keyboards/converter/usb_usb/keymaps/ble/config.h | |||
| @@ -3,13 +3,4 @@ | |||
| 3 | 3 | ||
| 4 | #include "../../config.h" | 4 | #include "../../config.h" |
| 5 | 5 | ||
| 6 | #undef PRODUCT | ||
| 7 | #define PRODUCT QMK BLE Adapter | ||
| 8 | #undef DESCRIPTION | ||
| 9 | #define DESCRIPTION | ||
| 10 | |||
| 11 | // Turn off the mode leds on the BLE module | ||
| 12 | #define ADAFRUIT_BLE_ENABLE_MODE_LEDS 0 | ||
| 13 | #define ADAFRUIT_BLE_ENABLE_POWER_LED 0 | ||
| 14 | |||
| 15 | #endif | 6 | #endif |
diff --git a/keyboards/converter/usb_usb/keymaps/ble/rules.mk b/keyboards/converter/usb_usb/keymaps/ble/rules.mk deleted file mode 100644 index 3beda3f44..000000000 --- a/keyboards/converter/usb_usb/keymaps/ble/rules.mk +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | BLUETOOTH = AdafruitBLE | ||
| 2 | ADAFRUIT_BLE_ENABLE = yes | ||
| 3 | OPT_DEFS += -DCATERINA_BOOTLOADER \ No newline at end of file | ||
diff --git a/keyboards/converter/usb_usb/pro_micro/pro_micro.c b/keyboards/converter/usb_usb/pro_micro/pro_micro.c new file mode 100644 index 000000000..f10142f81 --- /dev/null +++ b/keyboards/converter/usb_usb/pro_micro/pro_micro.c | |||
| @@ -0,0 +1 @@ | |||
| #include "pro_micro.h" | |||
diff --git a/keyboards/converter/usb_usb/pro_micro/pro_micro.h b/keyboards/converter/usb_usb/pro_micro/pro_micro.h new file mode 100644 index 000000000..566df9f20 --- /dev/null +++ b/keyboards/converter/usb_usb/pro_micro/pro_micro.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef PRO_MICRO_H | ||
| 2 | #define PRO_MICRO_H | ||
| 3 | |||
| 4 | #include QMK_KEYBOARD_H | ||
| 5 | |||
| 6 | #endif | ||
diff --git a/keyboards/converter/usb_usb/pro_micro/rules.mk b/keyboards/converter/usb_usb/pro_micro/rules.mk new file mode 100644 index 000000000..7c04fa34f --- /dev/null +++ b/keyboards/converter/usb_usb/pro_micro/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| F_CPU = 8000000 | |||
diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk index 81a393e8a..b0e07c764 100644 --- a/keyboards/converter/usb_usb/rules.mk +++ b/keyboards/converter/usb_usb/rules.mk | |||
| @@ -13,7 +13,15 @@ MCU = atmega32u4 | |||
| 13 | # does not *change* the processor frequency - it should merely be updated to | 13 | # does not *change* the processor frequency - it should merely be updated to |
| 14 | # reflect the processor speed set externally so that the code can use accurate | 14 | # reflect the processor speed set externally so that the code can use accurate |
| 15 | # software delays. | 15 | # software delays. |
| 16 | F_CPU = 8000000 | 16 | |
| 17 | # Since there are different hardware variations of these adapters and since these | ||
| 18 | # have different CPU clocks, the clock speed should be set in the rules.mk file of the | ||
| 19 | # respective hardware variantion (i.e. subproject). For example, in /pro_micro/rules.mk | ||
| 20 | # this is set to 8000000. | ||
| 21 | # The value here is only a fallback and is ignored if it is defined in the subproject. | ||
| 22 | F_CPU ?= 16000000 | ||
| 23 | |||
| 24 | DEFAULT_FOLDER = converter/usb_usb/hasu | ||
| 17 | 25 | ||
| 18 | 26 | ||
| 19 | # | 27 | # |
diff --git a/keyboards/converter/usb_usb/usb_usb.c b/keyboards/converter/usb_usb/usb_usb.c index e7657938d..e8f224ad4 100644 --- a/keyboards/converter/usb_usb/usb_usb.c +++ b/keyboards/converter/usb_usb/usb_usb.c | |||
| @@ -1 +1 @@ | |||
| #include "usb_usb.h" \ No newline at end of file | #include "usb_usb.h" | ||
