diff options
author | Spencer Peterson <spencerjp@google.com> | 2022-03-13 14:49:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-13 14:49:47 -0700 |
commit | 8fe3864fe7601a7e6572e7db680775edeff771ac (patch) | |
tree | f358dbc3b1b24ad1db27d8d586776354c56e4835 /keyboards/uno/keymaps/default | |
parent | 109c60feeb24081f6bcc78276d7426c5340f2822 (diff) |
[Keyboard] Add "Uno" rev2 (#14071)
* [Keyboard] Add "Uno" rev2
Adds support for the second revision of Uno, courtesy of @Snipeye.
* Update keyboards/uno/rev2/rules.mk
* Update keyboards/uno/rev1/rules.mk
* Update keyboards/uno/uno.h
* Update keyboards/uno/rev2/rules.mk
* Update keyboards/uno/rev1/rules.mk
* Update keyboards/uno/keymaps/demo/keymap.c
* Update keyboards/uno/keymaps/demo/keymap.c
* Update keyboards/uno/keymaps/demo/keymap.c
* Update keyboards/uno/rev2/rules.mk
* Update keyboards/uno/rev1/rules.mk
* Align rules.mk comments
* Update keyboards/uno/info.json
* Update keyboards/uno/rev1/config.h
* Update keyboards/uno/rev2/config.h
* Update keyboards/uno/rev2/config.h
* Update keyboards/uno/rev2/config.h
* Update keyboards/uno/rev1/config.h
Diffstat (limited to 'keyboards/uno/keymaps/default')
-rw-r--r-- | keyboards/uno/keymaps/default/keymap.c | 89 | ||||
-rw-r--r-- | keyboards/uno/keymaps/default/readme.md | 5 |
2 files changed, 28 insertions, 66 deletions
diff --git a/keyboards/uno/keymaps/default/keymap.c b/keyboards/uno/keymaps/default/keymap.c index bb19ea7ddb..43c885c800 100644 --- a/keyboards/uno/keymaps/default/keymap.c +++ b/keyboards/uno/keymaps/default/keymap.c @@ -13,6 +13,7 @@ * 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 QMK_KEYBOARD_H enum uno_keycode @@ -20,20 +21,9 @@ enum uno_keycode UNO = SAFE_RANGE }; -static uint16_t pressTimer = 0xFFFF; -#define CUSTOM_LONGPRESS 150 -#define CUSTOM_LONGERPRESS 750 -#define CUSTOM_STRING "I can put a whole buncha text in here and type it all with a single keypress." -#define RESET_LENGTH 3000 -const uint8_t PROGMEM RGBLED_RAINBOW_MOOD_INTERVALS[] = { 10, 25, 50 }; - -char stringToSend[2] = "a"; -char maxLetter = 'z'; - -uint8_t presetCounter = 0; - -#define COUNTER X_A - +enum encoder_names { + _ENCODER, +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( @@ -44,59 +34,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case UNO: - if (record->event.pressed) { - pressTimer = timer_read(); - } else { - uint16_t timeElapsed = timer_elapsed(pressTimer); - switch (presetCounter) { - case 0: - SEND_STRING(SS_LCMD("n")); - break; - case 1: - SEND_STRING("Hello!"); - break; - case 2: - SEND_STRING(SS_TAP(X_ENTER)SS_TAP(X_ENTER)"I am uno!"); - break; - case 3: - SEND_STRING(SS_TAP(X_ENTER)SS_TAP(X_ENTER)"I can do all sorts of useless things!"); - break; - case 4: - SEND_STRING(SS_TAP(X_ENTER)SS_TAP(X_ENTER)"And I have a built-in RGB LED!"SS_TAP(X_ENTER)SS_TAP(X_ENTER)SS_TAP(X_ENTER)); - rgblight_sethsv_noeeprom(255, 255, 255); - rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD); - break; - default: - if (timeElapsed < CUSTOM_LONGPRESS) { - // Normal press. We're going to send the current letter and increment the counter. - SEND_STRING(SS_TAP(X_BSPACE)); - send_string(stringToSend); - stringToSend[0]++; - if (stringToSend[0] > maxLetter) { - stringToSend[0] = 'a'; - } - } else if (timeElapsed < CUSTOM_LONGERPRESS) { - // Long press, confirm the current letter, reset counter - stringToSend[0] = 'a'; - send_string(stringToSend); - } else if (timeElapsed < RESET_LENGTH) { - // Longer press, display macro. - SEND_STRING(CUSTOM_STRING); - } else { - reset_keyboard(); - } - presetCounter--; - break; - } - presetCounter++; - } - break; + if (record->event.pressed) { + SEND_STRING("Hello!"); + } + break; + return false; } - return false; + return true; } void keyboard_post_init_user(void) { rgblight_enable_noeeprom(); - rgblight_sethsv_noeeprom(0, 0, 0); - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv_noeeprom(255, 255, 255); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD); } + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == _ENCODER) { /* First encoder */ + if (clockwise) { + tap_code(KC_A); + } else { + tap_code(KC_B); + } + return false; + } + return true; +} + diff --git a/keyboards/uno/keymaps/default/readme.md b/keyboards/uno/keymaps/default/readme.md index 53b762f878..d783a80acc 100644 --- a/keyboards/uno/keymaps/default/readme.md +++ b/keyboards/uno/keymaps/default/readme.md @@ -1,4 +1,5 @@ # The default keymap for uno -![Keymap](https://i.imgur.com/lCPZZpO.png) +![Picture](https://i.imgur.com/OqPyWbbl.jpg) -The 'Macro' key does a few things: If you open up textedit (was made for a mac), it sends "Command+n" for the first press to make a new document. It then types a few different messages, activates the RGB LED, and finally ends in a "scroll through the alphabet with a long press to confirm a certain character" keyboard mode. +This keymap types "Hello!" when pressed and presses 'A' and 'B' when turning the +encoder. |