From 588fd8c2d07d57f2fd706089d8cbb54a3df0a687 Mon Sep 17 00:00:00 2001 From: Jay Greco Date: Mon, 1 Feb 2021 03:05:10 -0800 Subject: [PATCH] [Keyboard] Add nullbitsco SCRAMBLE (#11078) * Add SCRAMBLE * Make requested changes to PR * Add all layers to VIA keymap Implement drashna's PR feedback in order to avoid random data within the layers in VIA. * Make requested changes to PR Implement fauxpark's PR feedback to clean up readme.md and rules.mk. * Make changes based on PR feedback -Changed VIA layers to enum -Added info on how to enter the bootloader to readme --- keyboards/nullbitsco/scramble/config.h | 42 +++++++++ keyboards/nullbitsco/scramble/info.json | 39 +++++++++ .../scramble/keymaps/default/keymap.c | 41 +++++++++ .../nullbitsco/scramble/keymaps/oled/config.h | 22 +++++ .../nullbitsco/scramble/keymaps/oled/keymap.c | 85 +++++++++++++++++++ .../nullbitsco/scramble/keymaps/oled/rules.mk | 1 + .../nullbitsco/scramble/keymaps/via/keymap.c | 61 +++++++++++++ .../nullbitsco/scramble/keymaps/via/rules.mk | 1 + keyboards/nullbitsco/scramble/readme.md | 19 +++++ keyboards/nullbitsco/scramble/rules.mk | 23 +++++ keyboards/nullbitsco/scramble/scramble.c | 40 +++++++++ keyboards/nullbitsco/scramble/scramble.h | 39 +++++++++ 12 files changed, 413 insertions(+) create mode 100644 keyboards/nullbitsco/scramble/config.h create mode 100644 keyboards/nullbitsco/scramble/info.json create mode 100644 keyboards/nullbitsco/scramble/keymaps/default/keymap.c create mode 100644 keyboards/nullbitsco/scramble/keymaps/oled/config.h create mode 100644 keyboards/nullbitsco/scramble/keymaps/oled/keymap.c create mode 100644 keyboards/nullbitsco/scramble/keymaps/oled/rules.mk create mode 100644 keyboards/nullbitsco/scramble/keymaps/via/keymap.c create mode 100644 keyboards/nullbitsco/scramble/keymaps/via/rules.mk create mode 100644 keyboards/nullbitsco/scramble/readme.md create mode 100644 keyboards/nullbitsco/scramble/rules.mk create mode 100644 keyboards/nullbitsco/scramble/scramble.c create mode 100644 keyboards/nullbitsco/scramble/scramble.h diff --git a/keyboards/nullbitsco/scramble/config.h b/keyboards/nullbitsco/scramble/config.h new file mode 100644 index 0000000000..949c280263 --- /dev/null +++ b/keyboards/nullbitsco/scramble/config.h @@ -0,0 +1,42 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x6E61 +#define PRODUCT_ID 0x6062 + +#define DEVICE_VER 0x0001 +#define MANUFACTURER nullbits +#define PRODUCT SCRAMBLE + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 3 + +#define DIRECT_PINS {{D4,D5,B1}, {C3,C2,C1}} + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 10 + +/* Optional encoder pins */ +#define ENCODERS_PAD_A { D6 } +#define ENCODERS_PAD_B { D7 } +#define TAP_CODE_DELAY 10 diff --git a/keyboards/nullbitsco/scramble/info.json b/keyboards/nullbitsco/scramble/info.json new file mode 100644 index 0000000000..348db649c7 --- /dev/null +++ b/keyboards/nullbitsco/scramble/info.json @@ -0,0 +1,39 @@ +{ + "keyboard_name": "SCRAMBLE switch tester", + "keyboard_folder": "nullbitsco/scramble", + "url": "https://nullbits.co/scramble", + "maintainer": "jaygreco", + "width": 3, + "height": 2, + "layouts": { + "LAYOUT": { + "layout": [ + { + "label": "n", + "x": 0, + "y": 0 + }, + { + "x": 1, + "y": 0 + }, + { + "x": 2, + "y": 0 + }, + { + "x": 0, + "y": 1 + }, + { + "x": 1, + "y": 1 + }, + { + "x": 2, + "y": 1 + } + ] + } + } +} diff --git a/keyboards/nullbitsco/scramble/keymaps/default/keymap.c b/keyboards/nullbitsco/scramble/keymaps/default/keymap.c new file mode 100644 index 0000000000..81bd732db7 --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/default/keymap.c @@ -0,0 +1,41 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#include QMK_KEYBOARD_H + +#define _BASE 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BASE] = LAYOUT( + KC_F13, KC_F14, KC_F15, + KC_F16, KC_F17, KC_F18 +) + +}; + +void matrix_init_user(void) { + set_scramble_LED(LED_OFF); +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } +} diff --git a/keyboards/nullbitsco/scramble/keymaps/oled/config.h b/keyboards/nullbitsco/scramble/keymaps/oled/config.h new file mode 100644 index 0000000000..5bfc9cff75 --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/oled/config.h @@ -0,0 +1,22 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#pragma once +// Alternate boot pins for accessing the bootloader, +// since the boot switch is blocked by the OLED. +#define BOOTMAGIC_LITE_ROW 1 +#define BOOTMAGIC_LITE_COLUMN 2 diff --git a/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c b/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c new file mode 100644 index 0000000000..eac0a470f3 --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c @@ -0,0 +1,85 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#include QMK_KEYBOARD_H + +#define _BASE 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BASE] = LAYOUT( + KC_F13, KC_F14, KC_F15, + KC_F16, KC_F17, KC_F18 +) + +}; + +#ifdef OLED_DRIVER_ENABLE +static void render_logo(void) { + static const char PROGMEM nullbits_logo[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf6, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xfe, 0xff, 0xfe, 0xf4, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xff, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, + 0xe0, 0xe0, 0xe0, 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xe0, 0xe0, 0xc0, 0xc0, 0xc0, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0xc3, 0xe3, 0xe3, 0xc3, 0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xfe, 0xfe, + 0xff, 0xfe, 0xe0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, + 0xc0, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0x00, 0x01, 0x01, 0x01, 0x03, 0x03, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0f, 0xff, 0xff, 0xfe, + 0xfc, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0x01, 0x01, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x01, 0x01, 0x01, 0x00, 0x1e, 0x3f, 0x7f, 0xff, 0xfb, 0xf3, 0xf1, 0xe1, 0xe1, + 0xe1, 0xc1, 0x81, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, + 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x3f, 0x7f, 0xff, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0x7f, 0x3f, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x7f, 0xf0, 0xf0, 0xf0, 0xf8, 0x78, 0x7e, 0x3f, 0x3f, 0x1f, + 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xfb, + 0x7f, 0x7f, 0x3f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + oled_write_raw_P(nullbits_logo, sizeof(nullbits_logo)); +} + +void oled_task_user(void) { + render_logo(); +} +#endif + +void matrix_init_user(void) { + set_scramble_LED(LED_OFF); +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } +} diff --git a/keyboards/nullbitsco/scramble/keymaps/oled/rules.mk b/keyboards/nullbitsco/scramble/keymaps/oled/rules.mk new file mode 100644 index 0000000000..c582662134 --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/oled/rules.mk @@ -0,0 +1 @@ +OLED_DRIVER_ENABLE = yes diff --git a/keyboards/nullbitsco/scramble/keymaps/via/keymap.c b/keyboards/nullbitsco/scramble/keymaps/via/keymap.c new file mode 100644 index 0000000000..91a448cc1a --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#include QMK_KEYBOARD_H + +enum layer_names { + _BASE, + _VIA1, + _VIA2, + _VIA3 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BASE] = LAYOUT( + KC_F1, KC_F2, KC_F3, + KC_F4, KC_F5, KC_F6 +), + +[_VIA1] = LAYOUT( + _______, _______, _______, + _______, _______, _______ +), + +[_VIA2] = LAYOUT( + _______, _______, _______, + _______, _______, _______ +), + +[_VIA3] = LAYOUT( + _______, _______, _______, + _______, _______, _______ +) + +}; + +void matrix_init_user(void) { + set_scramble_LED(LED_OFF); +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } +} \ No newline at end of file diff --git a/keyboards/nullbitsco/scramble/keymaps/via/rules.mk b/keyboards/nullbitsco/scramble/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/nullbitsco/scramble/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/nullbitsco/scramble/readme.md b/keyboards/nullbitsco/scramble/readme.md new file mode 100644 index 0000000000..6673b807d8 --- /dev/null +++ b/keyboards/nullbitsco/scramble/readme.md @@ -0,0 +1,19 @@ +# SCRAMBLE + +![SCRAMBLE](https://nullbits.co/static/img/scramble1.jpg) + +A 6-switch key tester macropad built by nullbits. [More info at nullbits.co](https://nullbits.co/scramble/) + +* Keyboard Maintainer: [Jay Greco](https://github.com/jaygreco) +* Hardware Supported: SCRAMBLE Rev1 +* Hardware Availability: [nullbits.co](https://nullbits.co/) + +Note: If you are seeing issues with MacOS and keyboard hangs after sleep, make sure `NO_USB_STARTUP_CHECK = yes` is set in your rules.mk. + +In order to enter the bootloader, hold switch #6 while plugging in the USB cable. The LED will stay on to indicate that it's in DFU mode. + +Flashing example for this keyboard: + + make nullbitsco/scramble:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/nullbitsco/scramble/rules.mk b/keyboards/nullbitsco/scramble/rules.mk new file mode 100644 index 0000000000..6fc0c45982 --- /dev/null +++ b/keyboards/nullbitsco/scramble/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega328p + +# Bootloader selection +BOOTLOADER = USBasp + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes # Use rotary encoder diff --git a/keyboards/nullbitsco/scramble/scramble.c b/keyboards/nullbitsco/scramble/scramble.c new file mode 100644 index 0000000000..3e981cfbb3 --- /dev/null +++ b/keyboards/nullbitsco/scramble/scramble.c @@ -0,0 +1,40 @@ +/* +Copyright 2020 Jay Greco + +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 . +*/ + +#include QMK_KEYBOARD_H + +// place overrides here +void set_scramble_LED(uint8_t mode) { + switch(mode) { + case LED_ON: + setPinOutput(PIN_LED); + writePin(PIN_LED, GPIO_STATE_HIGH); + break; + + case LED_DIM: + setPinInput(PIN_LED); + break; + + case LED_OFF: + setPinOutput(PIN_LED); + writePin(PIN_LED, GPIO_STATE_LOW); + break; + + default: + break; + } +} diff --git a/keyboards/nullbitsco/scramble/scramble.h b/keyboards/nullbitsco/scramble/scramble.h new file mode 100644 index 0000000000..5d3e1b0103 --- /dev/null +++ b/keyboards/nullbitsco/scramble/scramble.h @@ -0,0 +1,39 @@ +/* Copyright 2020 Jay Greco + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +// Indication LED settings +#define LED_ON 2 +#define LED_DIM 1 +#define LED_OFF 0 + +#define GPIO_STATE_LOW 0 +#define GPIO_STATE_HIGH 1 + +#define PIN_LED B2 + +void set_scramble_LED(uint8_t mode); + +#define LAYOUT( \ + K01, K02, K03, \ + K11, K12, K13 \ +) { \ + {K01, K02, K03}, \ + {K11, K12, K13}, \ +}