diff options
Diffstat (limited to 'keyboards/scrabblepad')
-rw-r--r-- | keyboards/scrabblepad/keymaps/random/keymap.c | 75 | ||||
-rw-r--r-- | keyboards/scrabblepad/keymaps/random/readme.md | 5 | ||||
-rw-r--r-- | keyboards/scrabblepad/readme.md | 2 |
3 files changed, 81 insertions, 1 deletions
diff --git a/keyboards/scrabblepad/keymaps/random/keymap.c b/keyboards/scrabblepad/keymaps/random/keymap.c new file mode 100644 index 0000000000..8e78259661 --- /dev/null +++ b/keyboards/scrabblepad/keymaps/random/keymap.c @@ -0,0 +1,75 @@ +#include "scrabblepad.h" +#include <stdlib.h> + +static uint16_t keystroke; +static bool shift_pressed; + +static int lower = (int) KC_A; +static int upper = (int) KC_Z; + +uint16_t random_keycode(void) { + return lower + (rand() % (upper - lower + 1)); +}; + +enum custom_keycodes { + RND_KEY = SAFE_RANGE +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case RND_KEY: + if (record->event.pressed) { + keystroke = random_keycode(); + if (rand() % 2 > 0) { + shift_pressed = 1; + register_code(KC_LSHIFT); + } + register_code(keystroke); + } else { + if (shift_pressed > 0) { + unregister_code(KC_LSHIFT); + } + unregister_code(keystroke); + } + + return false; + + default: + return true; + } + + return true; +} + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT( /* Base */ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RESET, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, \ + RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY, RND_KEY +), +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/scrabblepad/keymaps/random/readme.md b/keyboards/scrabblepad/keymaps/random/readme.md new file mode 100644 index 0000000000..e719adaeb8 --- /dev/null +++ b/keyboards/scrabblepad/keymaps/random/readme.md @@ -0,0 +1,5 @@ +# Scrabblepad keymap with every key press random + +Every key produces a random key press, except the middle key, which is reserved for resetting the board. + +The random key press is selected between KC_A and KC_Z keycodes. diff --git a/keyboards/scrabblepad/readme.md b/keyboards/scrabblepad/readme.md index 6b2d2ec5e5..e434eef950 100644 --- a/keyboards/scrabblepad/readme.md +++ b/keyboards/scrabblepad/readme.md @@ -6,7 +6,7 @@ the XDA Scrabble Board sold by [Novelkeys](https://novelkeys.xyz). It uses a [Teensy++ 2.0](https://www.pjrc.com/store/teensypp.html) featuring an at90usb1286 8 bit microcontroller. Usage requires modifying the Teensy by removing the LED on pin D6. -Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin), [Donut Cables](https://donutcables.com/) +Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin), [Donut Cables](https://donutcables.com/) Hardware Supported: Teensy++ 2.0 and ScrabblePad PCB Hardware Availability: [Donut Cables](https://donutcables.com/) |