mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
Removes terminal from QMK. (#17258)
This commit is contained in:
parent
9e2fe4eff6
commit
8545473307
|
@ -542,12 +542,6 @@ ifeq ($(strip $(LED_TABLES)), yes)
|
|||
SRC += $(QUANTUM_DIR)/led_tables.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(TERMINAL_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
|
||||
OPT_DEFS += -DTERMINAL_ENABLE
|
||||
OPT_DEFS += -DUSER_PRINT
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VIA_ENABLE)), yes)
|
||||
DYNAMIC_KEYMAP_ENABLE := yes
|
||||
RAW_ENABLE := yes
|
||||
|
|
|
@ -5,7 +5,6 @@ BUILD_OPTION_NAMES = \
|
|||
CONSOLE_ENABLE \
|
||||
COMMAND_ENABLE \
|
||||
NKRO_ENABLE \
|
||||
TERMINAL_ENABLE \
|
||||
CUSTOM_MATRIX \
|
||||
DEBOUNCE_TYPE \
|
||||
SPLIT_KEYBOARD \
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
* [Swap Hands](feature_swap_hands.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
* [Tap-Hold Configuration](tap_hold.md)
|
||||
* [Terminal](feature_terminal.md)
|
||||
* [Unicode](feature_unicode.md)
|
||||
* [Userspace](feature_userspace.md)
|
||||
* [WPM Calculation](feature_wpm.md)
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
# Terminal
|
||||
|
||||
> This feature is currently *huge*, and should probably only be put on boards with a lot of memory, or for fun.
|
||||
|
||||
The terminal feature is a command-line-like interface designed to communicate through a text editor with keystrokes. It's beneficial to turn off auto-indent features in your editor.
|
||||
|
||||
To enable, stick this in your `rules.mk` or `Makefile`:
|
||||
|
||||
TERMINAL_ENABLE = yes
|
||||
|
||||
And use the `TERM_ON` and `TERM_OFF` keycodes to turn it on or off.
|
||||
|
||||
When enabled, a `> ` prompt will appear, where you'll be able to type, backspace (a bell will ding if you reach the beginning and audio is enabled), and hit enter to send the command. Arrow keys are currently disabled so it doesn't get confused. Moving your cursor around with the mouse is discouraged.
|
||||
|
||||
`#define TERMINAL_HELP` enables some other output helpers that aren't really needed with this page.
|
||||
|
||||
Pressing "up" and "down" will allow you to cycle through the past 5 commands entered.
|
||||
|
||||
## Future Ideas
|
||||
|
||||
* Keyboard/user-extensible commands
|
||||
* Smaller footprint
|
||||
* Arrow key support
|
||||
* Command history - Done
|
||||
* SD card support
|
||||
* LCD support for buffer display
|
||||
* Keycode -> name string LUT
|
||||
* Layer status
|
||||
* *Analog/digital port read/write*
|
||||
* RGB mode stuff
|
||||
* Macro definitions
|
||||
* EEPROM read/write
|
||||
* Audio control
|
||||
|
||||
## Current Commands
|
||||
|
||||
### `about`
|
||||
|
||||
Prints out the current version of QMK with a build date:
|
||||
|
||||
```
|
||||
> about
|
||||
QMK Firmware
|
||||
v0.5.115-7-g80ed73-dirty
|
||||
Built: 2017-08-29-20:24:44
|
||||
```
|
||||
|
||||
|
||||
### `print-buffer`
|
||||
|
||||
Outputs the last 5 commands entered
|
||||
|
||||
```
|
||||
> print-buffer
|
||||
0. print-buffer
|
||||
1. help
|
||||
2. about
|
||||
3. keymap 0
|
||||
4. help
|
||||
5. flush-buffer
|
||||
```
|
||||
|
||||
### `flush-buffer`
|
||||
|
||||
Clears command buffer
|
||||
```
|
||||
> flush-buffer
|
||||
Buffer cleared!
|
||||
```
|
||||
|
||||
|
||||
### `help`
|
||||
|
||||
|
||||
Prints out the available commands:
|
||||
|
||||
```
|
||||
> help
|
||||
commands available:
|
||||
about help keycode keymap exit print-buffer flush-buffer
|
||||
```
|
||||
|
||||
### `keycode <layer> <row> <col>`
|
||||
|
||||
Prints out the keycode value of a certain layer, row, and column:
|
||||
|
||||
```
|
||||
> keycode 0 1 0
|
||||
0x29 (41)
|
||||
```
|
||||
|
||||
### `keymap <layer>`
|
||||
|
||||
Prints out the entire keymap for a certain layer
|
||||
|
||||
```
|
||||
> keymap 0
|
||||
0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a,
|
||||
0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034,
|
||||
0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028,
|
||||
0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f,
|
||||
>
|
||||
```
|
||||
|
||||
### `exit`
|
||||
|
||||
Exits the terminal - same as `TERM_OFF`.
|
|
@ -85,7 +85,6 @@
|
|||
* [スワップハンド](ja/feature_swap_hands.md)
|
||||
* [タップダンス](ja/feature_tap_dance.md)
|
||||
* [タップホールド設定](ja/tap_hold.md)
|
||||
* [ターミナル](ja/feature_terminal.md)
|
||||
* [ユニコード](ja/feature_unicode.md)
|
||||
* [ユーザスペース](ja/feature_userspace.md)
|
||||
* [WPM 計算](ja/feature_wpm.md)
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
# ターミナル
|
||||
|
||||
<!---
|
||||
original document: 0.8.147:docs/feature_terminal.md
|
||||
git diff 0.8.147 HEAD -- docs/feature_terminal.md | cat
|
||||
-->
|
||||
|
||||
> この機能は現在のところ*巨大*であり、おそらく大量のメモリを搭載したキーボード、または楽しみのためにのみ配置する必要があります。
|
||||
|
||||
ターミナル機能はテキストエディタを介してキーストロークで通信するように設計されたコマンドラインのようなインタフェースです。エディタで自動インデント機能をオフにすることは有益です。
|
||||
|
||||
有効にするには、以下を `rules.mk` または `Makefile` に貼り付けます:
|
||||
|
||||
TERMINAL_ENABLE = yes
|
||||
|
||||
そして、オンまたはオフにするために、`TERM_ON` および `TERM_OFF` キーコードを使います。
|
||||
|
||||
有効な場合、`> ` プロンプトが現れ、ここでコマンドやバックスペース(オーディオが有効な場合は、先頭に到達するとベルが鳴ります)を入力することができ、エンターを入力するとコマンドを送信します。矢印キーは現在のところ無効なため、混乱することはありません。マウスでカーソルを移動することはお勧めしません。
|
||||
|
||||
`#define TERMINAL_HELP` は、このページでは実際には必要のない他の出力ヘルパーを有効にします。
|
||||
|
||||
"上矢印" および "下矢印" により、過去に入力した5つのコマンドを順に切り替えることができます。
|
||||
|
||||
## 今後のアイデア
|
||||
|
||||
* キーボード/ユーザ拡張可能なコマンド
|
||||
* より小さなフットプリント
|
||||
* 矢印キーのサポート
|
||||
* コマンド履歴 - 完了
|
||||
* SD カードのサポート
|
||||
* バッファディスプレイのための LCD サポート
|
||||
* キーコード -> 名称の対応表
|
||||
* レイヤー状態
|
||||
* *アナログ/デジタル ポートの読み込み/書き込み*
|
||||
* RGB モード関連機能
|
||||
* マクロ定義
|
||||
* EEPROM の読み込み/書き込み
|
||||
* オーディオ制御
|
||||
|
||||
## 現在のコマンド
|
||||
|
||||
### `about`
|
||||
|
||||
現在の QMK のバージョンとビルドした日の出力:
|
||||
|
||||
```
|
||||
> about
|
||||
QMK Firmware
|
||||
v0.5.115-7-g80ed73-dirty
|
||||
Built: 2017-08-29-20:24:44
|
||||
```
|
||||
|
||||
|
||||
### `print-buffer`
|
||||
|
||||
最後に入力した5つのコマンドの出力
|
||||
|
||||
```
|
||||
> print-buffer
|
||||
0. print-buffer
|
||||
1. help
|
||||
2. about
|
||||
3. keymap 0
|
||||
4. help
|
||||
5. flush-buffer
|
||||
```
|
||||
|
||||
### `flush-buffer`
|
||||
|
||||
コマンドバッファをクリア
|
||||
```
|
||||
> flush-buffer
|
||||
Buffer cleared!
|
||||
```
|
||||
|
||||
|
||||
### `help`
|
||||
|
||||
|
||||
利用可能なコマンドの出力:
|
||||
|
||||
```
|
||||
> help
|
||||
commands available:
|
||||
about help keycode keymap exit print-buffer flush-buffer
|
||||
```
|
||||
|
||||
### `keycode <layer> <row> <col>`
|
||||
|
||||
特定のレイヤー、行および列のキーコード値の出力:
|
||||
|
||||
```
|
||||
> keycode 0 1 0
|
||||
0x29 (41)
|
||||
```
|
||||
|
||||
### `keymap <layer>`
|
||||
|
||||
特定のレイヤーの全てのキーマップの出力
|
||||
|
||||
```
|
||||
> keymap 0
|
||||
0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a,
|
||||
0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034,
|
||||
0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028,
|
||||
0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f,
|
||||
>
|
||||
```
|
||||
|
||||
### `exit`
|
||||
|
||||
ターミナルの終了 - `TERM_OFF` と同じ。
|
|
@ -161,7 +161,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_combo.c#L115)
|
||||
* [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_printer.c#L77)
|
||||
* [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_auto_shift.c#L94)
|
||||
* [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_terminal.c#L264)
|
||||
* [Quantum 固有のキーコードを識別して処理する](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L291)
|
||||
|
||||
この一連のイベントの中の任意のステップで (`process_record_kb()` のような)関数は `false` を返して、以降の処理を停止することができます。
|
||||
|
|
|
@ -155,7 +155,6 @@ The `process_record()` function itself is deceptively simple, but hidden within
|
|||
* [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_printer.c#L77)
|
||||
* [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_auto_shift.c#L94)
|
||||
* `bool process_dynamic_tapping_term(uint16_t keycode, keyrecord_t *record)`
|
||||
* [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_terminal.c#L264)
|
||||
* [Identify and process Quantum-specific keycodes](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L291)
|
||||
|
||||
At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
|
||||
|
|
|
@ -91,7 +91,6 @@
|
|||
* [换手](zh-cn/feature_swap_hands.md)
|
||||
* [一键多用](zh-cn/feature_tap_dance.md)
|
||||
* [点按配置](zh-cn/tap_hold.md)
|
||||
* [终端](zh-cn/feature_terminal.md)
|
||||
* [Unicode](zh-cn/feature_unicode.md)
|
||||
* [用户空间](zh-cn/feature_userspace.md)
|
||||
* [WPM计算](zh-cn/feature_wpm.md)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
BACKLIGHT_DRIVER = custom
|
||||
NKRO_ENABLE = yes
|
||||
TERMINAL_ENABLE = yes
|
||||
DYNAMIC_MACRO_ENABLE = yes
|
||||
|
||||
# Use RAM (fake EEPROM, transient) instead of real EEPROM
|
||||
|
|
|
@ -134,10 +134,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `--------=======------------------------'
|
||||
*/
|
||||
[_TERMINAL] = LAYOUT_ortho_4x4(
|
||||
_______, TERM_ABOUT, _______, _______,
|
||||
TERM_OFF, TERM_PRINT, _______, _______,
|
||||
_______, TERM_FLUSH, _______, _______,
|
||||
TERM_ON, TERM_HELP , _______, _______
|
||||
_______, TERM_ABOUT, _______, _______,
|
||||
_______, TERM_PRINT, _______, _______,
|
||||
_______, TERM_FLUSH, _______, _______,
|
||||
_______, TERM_HELP , _______, _______
|
||||
),
|
||||
/* ADMIN
|
||||
* ,-----------------------------------------.
|
||||
|
|
|
@ -12,7 +12,6 @@ MOUSEKEY_ENABLE = yes # Mouse keys
|
|||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
TERMINAL_ENABLE = yes
|
||||
NKRO_ENABLE = yes # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
|
|
|
@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_ADJUST] = LAYOUT_planck_mit(
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_FN] = LAYOUT_ortho_5x12(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,TERM_ON, TERM_OFF, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_FN] = LAYOUT_ortho_5x12(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,TERM_ON, TERM_OFF, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
|
||||
_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -195,7 +195,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_ADJUST] = LAYOUT_plaid_grid(
|
||||
QK_BOOT,LED_1, LED_2, LED_3, LED_4, LED_5,LED_6, LED_7, LED_8, LED_9, LED_0,KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_5x12(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -162,7 +162,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_ADJUST] = LAYOUT_ortho_4x12_1x2uC(
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_5x12(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, NK_TOGG, LCG_SWP, LCG_NRM, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -158,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_5x12(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, NK_TOGG, LCG_SWP, LCG_NRM, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -155,7 +155,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_5x12(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -193,7 +193,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
|
||||
[_ADJUST] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, QK_BOOT, _______, TERM_ON, TERM_OFF, _______, _______, KC_DEL,
|
||||
_______, _______, _______, _______, _______, QK_BOOT, _______, _______, _______, _______, _______, KC_DEL,
|
||||
_______, _______, _______, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -92,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_ortho_5x12(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______,_______, _______, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -8,7 +8,6 @@ DYNAMIC_MACRO_ENABLE = no # Dynamic macro recording and play
|
|||
MOUSEKEY_ENABLE = no # Enable mouse control keycodes. Increases firmware size.
|
||||
TAP_DANCE_ENABLE = no # Enable tap dance keys
|
||||
CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size.
|
||||
TERMINAL_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
# RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard
|
||||
# COMBO_ENABLE # Key combo feature
|
||||
|
|
|
@ -7,7 +7,6 @@ MOUSEKEY_ENABLE = yes # Enable mouse control keycodes. Increases firmware size
|
|||
TAP_DANCE_ENABLE = yes # Enable tap dance keys
|
||||
CONSOLE_ENABLE = yes # Enable debugging console. Increases firmware size.
|
||||
SRC += config_led.c # Used to add files to the compilation/linking list.
|
||||
TERMINAL_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
# RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard
|
||||
# COMBO_ENABLE # Key combo feature
|
||||
|
|
|
@ -7,7 +7,6 @@ MOUSEKEY_ENABLE = no # Enable mouse control keycodes. Increases firmware size.
|
|||
TAP_DANCE_ENABLE = no # Enable tap dance keys
|
||||
CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size.
|
||||
SRC += config_led.c # Used to add files to the compilation/linking list.
|
||||
TERMINAL_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
#RAW_ENABLE = yes #Raw HID has not yet been implemented for this keyboard
|
||||
#COMBO_ENABLE #Key combo feature
|
||||
|
|
|
@ -8,7 +8,6 @@ TAP_DANCE_ENABLE = yes # Enable tap dance keys
|
|||
CONSOLE_ENABLE = no # Enable debugging console. Increases firmware size.
|
||||
SRC += config_led.c # Used to add files to the compilation/linking list.
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
TERMINAL_ENABLE = no
|
||||
# RAW_ENABLE = yes # Raw HID has not yet been implemented for this keyboard
|
||||
# COMBO_ENABLE # Key combo feature
|
||||
# LEADER_ENABLE # Enable leader key chording
|
||||
|
|
|
@ -106,10 +106,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJ] = LAYOUT_ortho_4x12(
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
};
|
||||
|
|
|
@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
[_ADJUST] = LAYOUT_planck_grid(
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
AUDIO_ENABLE = yes
|
||||
COMMAND_ENABLE = no
|
||||
TERMINAL_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
|
|
@ -20,8 +20,5 @@ KEY_LOCK_ENABLE = yes # Enables using lock key to maintain holds
|
|||
# SWAP_HANDS_ENABLE = yes # Enables the swap hands function
|
||||
# DEBOUNCE_TYPE = sym_eager_pk # Change debounce algorithm
|
||||
|
||||
# NOTE: The following requires a lot of memory to include
|
||||
TERMINAL_ENABLE = yes # Enables a command-line-like interface designed to communicate through a text editor with keystrokes
|
||||
|
||||
# NOTE: The following is not yet available in main qmk branch
|
||||
KEY_OVERRIDE_ENABLE = yes # Allows overiding modifier combos (change Shift+1 without affecting 1 or Shift's normal operation)
|
||||
|
|
|
@ -160,10 +160,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_planck_grid(
|
||||
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
};
|
||||
|
|
|
@ -160,10 +160,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_planck_grid(
|
||||
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
};
|
||||
|
|
|
@ -157,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT_preonic_grid(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL,
|
||||
_______, QK_BOOT, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
|
|
|
@ -9,7 +9,6 @@ MOUSEKEY_ENABLE = no
|
|||
TAP_DANCE_ENABLE = no
|
||||
STENO_ENABLE = no
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
TERMINAL_ENABLE = no
|
||||
GRAVE_ESC_ENABLE = no
|
||||
MAGIC_ENABLE = no
|
||||
SPACE_CADET_ENABLE = no
|
||||
|
|
|
@ -144,9 +144,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT(
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
||||
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , _______,
|
||||
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
|
||||
|
|
|
@ -1,330 +0,0 @@
|
|||
/* Copyright 2017 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "process_terminal.h"
|
||||
#include <string.h>
|
||||
#include "version.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef CMD_BUFF_SIZE
|
||||
# define CMD_BUFF_SIZE 5
|
||||
#endif
|
||||
|
||||
bool terminal_enabled = false;
|
||||
char buffer[80] = "";
|
||||
char cmd_buffer[CMD_BUFF_SIZE][80];
|
||||
bool cmd_buffer_enabled = true; // replace with ifdef?
|
||||
char newline[2] = "\n";
|
||||
char arguments[6][20];
|
||||
bool firstTime = true;
|
||||
|
||||
short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer
|
||||
|
||||
__attribute__((weak)) const char terminal_prompt[8] = "> ";
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
# ifndef TERMINAL_SONG
|
||||
# define TERMINAL_SONG SONG(TERMINAL_SOUND)
|
||||
# endif
|
||||
float terminal_song[][2] = TERMINAL_SONG;
|
||||
# define TERMINAL_BELL() PLAY_SONG(terminal_song)
|
||||
#else
|
||||
# define TERMINAL_BELL()
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) const char keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t', ' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/'};
|
||||
|
||||
__attribute__((weak)) const char shifted_keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', 0, 0, 0, '\t', ' ', '_', '+', '{', '}', '|', 0, ':', '\'', '~', '<', '>', '?'};
|
||||
|
||||
struct stringcase {
|
||||
char *string;
|
||||
void (*func)(void);
|
||||
} typedef stringcase;
|
||||
|
||||
void enable_terminal(void) {
|
||||
terminal_enabled = true;
|
||||
strcpy(buffer, "");
|
||||
memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80);
|
||||
for (int i = 0; i < 6; i++)
|
||||
strcpy(arguments[i], "");
|
||||
// select all text to start over
|
||||
// SEND_STRING(SS_LCTL("a"));
|
||||
send_string(terminal_prompt);
|
||||
}
|
||||
|
||||
void disable_terminal(void) {
|
||||
terminal_enabled = false;
|
||||
SEND_STRING("\n");
|
||||
}
|
||||
|
||||
void push_to_cmd_buffer(void) {
|
||||
if (cmd_buffer_enabled) {
|
||||
if (cmd_buffer == NULL) {
|
||||
return;
|
||||
} else {
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
strcpy(cmd_buffer[0], buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = CMD_BUFF_SIZE - 1; i > 0; --i) {
|
||||
strncpy(cmd_buffer[i], cmd_buffer[i - 1], 80);
|
||||
}
|
||||
|
||||
strcpy(cmd_buffer[0], buffer);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void terminal_about(void) {
|
||||
SEND_STRING("QMK Firmware\n");
|
||||
SEND_STRING(" v");
|
||||
SEND_STRING(QMK_VERSION);
|
||||
SEND_STRING("\n" SS_TAP(X_HOME) " Built: ");
|
||||
SEND_STRING(QMK_BUILDDATE);
|
||||
send_string(newline);
|
||||
#ifdef TERMINAL_HELP
|
||||
if (strlen(arguments[1]) != 0) {
|
||||
SEND_STRING("You entered: ");
|
||||
send_string(arguments[1]);
|
||||
send_string(newline);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void terminal_help(void);
|
||||
|
||||
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
||||
|
||||
void terminal_keycode(void) {
|
||||
if (strlen(arguments[1]) != 0 && strlen(arguments[2]) != 0 && strlen(arguments[3]) != 0) {
|
||||
char keycode_dec[5];
|
||||
char keycode_hex[5];
|
||||
uint16_t layer = strtol(arguments[1], (char **)NULL, 10);
|
||||
uint16_t row = strtol(arguments[2], (char **)NULL, 10);
|
||||
uint16_t col = strtol(arguments[3], (char **)NULL, 10);
|
||||
uint16_t keycode = pgm_read_word(&keymaps[layer][row][col]);
|
||||
itoa(keycode, keycode_dec, 10);
|
||||
itoa(keycode, keycode_hex, 16);
|
||||
SEND_STRING("0x");
|
||||
send_string(keycode_hex);
|
||||
SEND_STRING(" (");
|
||||
send_string(keycode_dec);
|
||||
SEND_STRING(")\n");
|
||||
} else {
|
||||
#ifdef TERMINAL_HELP
|
||||
SEND_STRING("usage: keycode <layer> <row> <col>\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void terminal_keymap(void) {
|
||||
if (strlen(arguments[1]) != 0) {
|
||||
uint16_t layer = strtol(arguments[1], (char **)NULL, 10);
|
||||
for (int r = 0; r < MATRIX_ROWS; r++) {
|
||||
for (int c = 0; c < MATRIX_COLS; c++) {
|
||||
uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]);
|
||||
char keycode_s[8];
|
||||
sprintf(keycode_s, "0x%04x,", keycode);
|
||||
send_string(keycode_s);
|
||||
}
|
||||
send_string(newline);
|
||||
}
|
||||
} else {
|
||||
#ifdef TERMINAL_HELP
|
||||
SEND_STRING("usage: keymap <layer>\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void print_cmd_buff(void) {
|
||||
/* without the below wait, a race condition can occur wherein the
|
||||
buffer can be printed before it has been fully moved */
|
||||
wait_ms(250);
|
||||
for (int i = 0; i < CMD_BUFF_SIZE; i++) {
|
||||
char tmpChar = ' ';
|
||||
itoa(i, &tmpChar, 10);
|
||||
const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char *
|
||||
send_string(tmpCnstCharStr);
|
||||
SEND_STRING(". ");
|
||||
send_string(cmd_buffer[i]);
|
||||
SEND_STRING("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void flush_cmd_buffer(void) {
|
||||
memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80);
|
||||
SEND_STRING("Buffer Cleared!\n");
|
||||
}
|
||||
|
||||
stringcase terminal_cases[] = {{"about", terminal_about}, {"help", terminal_help}, {"keycode", terminal_keycode}, {"keymap", terminal_keymap}, {"flush-buffer", flush_cmd_buffer}, {"print-buffer", print_cmd_buff}, {"exit", disable_terminal}};
|
||||
|
||||
void terminal_help(void) {
|
||||
SEND_STRING("commands available:\n ");
|
||||
for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) {
|
||||
send_string(case_p->string);
|
||||
SEND_STRING(" ");
|
||||
}
|
||||
send_string(newline);
|
||||
}
|
||||
|
||||
void command_not_found(void) {
|
||||
wait_ms(50); // sometimes buffer isnt grabbed quick enough
|
||||
SEND_STRING("command \"");
|
||||
send_string(buffer);
|
||||
SEND_STRING("\" not found\n");
|
||||
}
|
||||
|
||||
void process_terminal_command(void) {
|
||||
// we capture return bc of the order of events, so we need to manually send a newline
|
||||
send_string(newline);
|
||||
|
||||
char * pch;
|
||||
uint8_t i = 0;
|
||||
pch = strtok(buffer, " ");
|
||||
while (pch != NULL) {
|
||||
strcpy(arguments[i], pch);
|
||||
pch = strtok(NULL, " ");
|
||||
i++;
|
||||
}
|
||||
|
||||
bool command_found = false;
|
||||
for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) {
|
||||
if (0 == strcmp(case_p->string, buffer)) {
|
||||
command_found = true;
|
||||
(*case_p->func)();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!command_found) command_not_found();
|
||||
|
||||
if (terminal_enabled) {
|
||||
strcpy(buffer, "");
|
||||
for (int i = 0; i < 6; i++)
|
||||
strcpy(arguments[i], "");
|
||||
SEND_STRING(SS_TAP(X_HOME));
|
||||
send_string(terminal_prompt);
|
||||
}
|
||||
}
|
||||
void check_pos(void) {
|
||||
if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down...
|
||||
current_cmd_buffer_pos = CMD_BUFF_SIZE - 1;
|
||||
} else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up
|
||||
current_cmd_buffer_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_terminal(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == TERM_ON && record->event.pressed) {
|
||||
enable_terminal();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (terminal_enabled && record->event.pressed) {
|
||||
if (keycode == TERM_OFF && record->event.pressed) {
|
||||
disable_terminal();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
|
||||
keycode = keycode & 0xFF;
|
||||
}
|
||||
|
||||
if (keycode < 256) {
|
||||
uint8_t str_len;
|
||||
char char_to_add;
|
||||
switch (keycode) {
|
||||
case KC_ENTER:
|
||||
case KC_KP_ENTER:
|
||||
push_to_cmd_buffer();
|
||||
current_cmd_buffer_pos = 0;
|
||||
process_terminal_command();
|
||||
return false;
|
||||
break;
|
||||
case KC_ESCAPE:
|
||||
SEND_STRING("\n");
|
||||
enable_terminal();
|
||||
return false;
|
||||
break;
|
||||
case KC_BACKSPACE:
|
||||
str_len = strlen(buffer);
|
||||
if (str_len > 0) {
|
||||
buffer[str_len - 1] = 0;
|
||||
return true;
|
||||
} else {
|
||||
TERMINAL_BELL();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case KC_LEFT:
|
||||
return false;
|
||||
break;
|
||||
case KC_RIGHT:
|
||||
return false;
|
||||
break;
|
||||
case KC_UP: // 0 = recent
|
||||
check_pos(); // check our current buffer position is valid
|
||||
if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything
|
||||
str_len = strlen(buffer);
|
||||
for (int i = 0; i < str_len; ++i) {
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
// process_terminal(KC_BACKSPACE,record);
|
||||
}
|
||||
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80);
|
||||
|
||||
send_string(buffer);
|
||||
++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case KC_DOWN:
|
||||
check_pos();
|
||||
if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything
|
||||
str_len = strlen(buffer);
|
||||
for (int i = 0; i < str_len; ++i) {
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
// process_terminal(KC_BACKSPACE,record);
|
||||
}
|
||||
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79);
|
||||
|
||||
send_string(buffer);
|
||||
--current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
if (keycode <= 58) {
|
||||
char_to_add = 0;
|
||||
if (get_mods() & (MOD_BIT(KC_LEFT_SHIFT) | MOD_BIT(KC_RIGHT_SHIFT))) {
|
||||
char_to_add = shifted_keycode_to_ascii_lut[keycode];
|
||||
} else if (get_mods() == 0) {
|
||||
char_to_add = keycode_to_ascii_lut[keycode];
|
||||
}
|
||||
if (char_to_add != 0) {
|
||||
strncat(buffer, &char_to_add, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/* Copyright 2017 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
extern const char keycode_to_ascii_lut[58];
|
||||
extern const char shifted_keycode_to_ascii_lut[58];
|
||||
extern const char terminal_prompt[8];
|
||||
bool process_terminal(uint16_t keycode, keyrecord_t *record);
|
|
@ -1,22 +0,0 @@
|
|||
/* Copyright 2017 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define TERM_ON KC_NO
|
||||
#define TERM_OFF KC_NO
|
|
@ -304,9 +304,6 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||
#ifdef DYNAMIC_TAPPING_TERM_ENABLE
|
||||
process_dynamic_tapping_term(keycode, record) &&
|
||||
#endif
|
||||
#ifdef TERMINAL_ENABLE
|
||||
process_terminal(keycode, record) &&
|
||||
#endif
|
||||
#ifdef CAPS_WORD_ENABLE
|
||||
process_caps_word(keycode, record) &&
|
||||
#endif
|
||||
|
|
|
@ -141,12 +141,6 @@ extern layer_state_t layer_state;
|
|||
# include "process_key_lock.h"
|
||||
#endif
|
||||
|
||||
#ifdef TERMINAL_ENABLE
|
||||
# include "process_terminal.h"
|
||||
#else
|
||||
# include "process_terminal_nop.h"
|
||||
#endif
|
||||
|
||||
#ifdef SPACE_CADET_ENABLE
|
||||
# include "process_space_cadet.h"
|
||||
#endif
|
||||
|
|
|
@ -473,9 +473,9 @@ enum quantum_keycodes {
|
|||
// Lock Key
|
||||
KC_LOCK, // 5D2B
|
||||
|
||||
// Terminal
|
||||
TERM_ON, // 5D2C
|
||||
TERM_OFF, // 5D2D
|
||||
// Unused slots
|
||||
UNUSED_000, // 5D2C
|
||||
UNUSED_001, // 5D2D
|
||||
|
||||
// Sequencer
|
||||
SQ_ON, // 5D2E
|
||||
|
|
|
@ -11,3 +11,6 @@
|
|||
|
||||
#define KC_GESC QK_GRAVE_ESCAPE
|
||||
#define EEP_RST QK_CLEAR_EEPROM
|
||||
|
||||
#define TERM_ON _Static_assert(false, "The Terminal feature has been removed from QMK. Please remove use of TERM_ON/TERM_OFF from your keymap.")
|
||||
#define TERM_OFF _Static_assert(false, "The Terminal feature has been removed from QMK.. Please remove use of TERM_ON/TERM_OFF from your keymap.")
|
|
@ -47,7 +47,6 @@ endif
|
|||
COMMAND_ENABLE = no
|
||||
CONSOLE_ENABLE = no
|
||||
MOUSEKEY_ENABLE = no
|
||||
TERMINAL_ENABLE = no
|
||||
|
||||
# Disable unwanted hardware options on all keyboards. (Some keyboards turn
|
||||
# these features on by default even though they aren't actually required.)
|
||||
|
|
Loading…
Reference in New Issue
Block a user