From cfc9a358c584e65782b2dade05d31700719a18e7 Mon Sep 17 00:00:00 2001 From: jvbroek <70871975+jvbroek@users.noreply.github.com> Date: Sun, 15 Nov 2020 17:43:20 -0700 Subject: [PATCH] [Keyboard] Add "Uno" (#10579) * Add all files * Update keyboards/uno/config.h Co-authored-by: Joel Challis * Update keyboards/uno/config.h Co-authored-by: Joel Challis * Update keyboards/uno/rules.mk Co-authored-by: Joel Challis * Update keyboards/uno/keymaps/default/keymap.c Co-authored-by: Joel Challis * Update keyboards/uno/keymaps/default/keymap.c Co-authored-by: Joel Challis * Update keyboards/uno/info.json Co-authored-by: Ryan * Update keyboards/uno/readme.md Co-authored-by: Ryan * Update readme.md Co-authored-by: Joshua Broekhuijsen Co-authored-by: Joel Challis Co-authored-by: Ryan --- keyboards/uno/config.h | 69 ++++++++++++++++ keyboards/uno/info.json | 13 +++ keyboards/uno/keymaps/default/keymap.c | 102 ++++++++++++++++++++++++ keyboards/uno/keymaps/default/readme.md | 4 + keyboards/uno/readme.md | 19 +++++ keyboards/uno/rules.mk | 22 +++++ keyboards/uno/uno.c | 17 ++++ keyboards/uno/uno.h | 24 ++++++ 8 files changed, 270 insertions(+) create mode 100644 keyboards/uno/config.h create mode 100644 keyboards/uno/info.json create mode 100644 keyboards/uno/keymaps/default/keymap.c create mode 100644 keyboards/uno/keymaps/default/readme.md create mode 100644 keyboards/uno/readme.md create mode 100644 keyboards/uno/rules.mk create mode 100644 keyboards/uno/uno.c create mode 100644 keyboards/uno/uno.h diff --git a/keyboards/uno/config.h b/keyboards/uno/config.h new file mode 100644 index 000000000..1cae17f50 --- /dev/null +++ b/keyboards/uno/config.h @@ -0,0 +1,69 @@ +/* Copyright 2020 Snipeye + * + * 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 0xFEED +#define PRODUCT_ID 0xACC8 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Broekhuijsen +#define PRODUCT Uno + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +/* Uno default pinout */ +#define DIRECT_PINS { \ + { B6 } \ +} +#define UNUSED_PINS + +#define RGB_DI_PIN F6 +#ifdef RGB_DI_PIN +#define RGBLED_NUM 1 +// #define RGBLIGHT_HUE_STEP 32 +// #define RGBLIGHT_SAT_STEP 32 +// #define RGBLIGHT_VAL_STEP 32 +// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +// /*== all animations enable ==*/ +#define RGBLIGHT_ANIMATIONS +// /*== or choose animations ==*/ +// #define RGBLIGHT_EFFECT_BREATHING +// #define RGBLIGHT_EFFECT_RAINBOW_MOOD +// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL +// #define RGBLIGHT_EFFECT_SNAKE +// #define RGBLIGHT_EFFECT_KNIGHT +// #define RGBLIGHT_EFFECT_CHRISTMAS +// #define RGBLIGHT_EFFECT_STATIC_GRADIENT +// #define RGBLIGHT_EFFECT_RGB_TEST +// #define RGBLIGHT_EFFECT_ALTERNATING +// /*== customize breathing effect ==*/ +// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +// /*==== use exp() and sin() ====*/ +// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/uno/info.json b/keyboards/uno/info.json new file mode 100644 index 000000000..3460c25d5 --- /dev/null +++ b/keyboards/uno/info.json @@ -0,0 +1,13 @@ +{ + "keyboard_name": "Uno", + "keyboard_folder": "uno", + "url": "https://www.reddit.com/r/mechmarket/comments/gyijm7/gb_uno/", + "maintainer": "Snipeye", + "width": 1, + "height": 1, + "layouts": { + "LAYOUT": { + "layout": [ {"x": 0, "y": 0 }] + } + } + } diff --git a/keyboards/uno/keymaps/default/keymap.c b/keyboards/uno/keymaps/default/keymap.c new file mode 100644 index 000000000..bb19ea7dd --- /dev/null +++ b/keyboards/uno/keymaps/default/keymap.c @@ -0,0 +1,102 @@ +/* Copyright 2020 Snipeye + * + * 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 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 + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + UNO + ) +}; + +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; + } + return false; +} + +void keyboard_post_init_user(void) { + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom(0, 0, 0); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); +} diff --git a/keyboards/uno/keymaps/default/readme.md b/keyboards/uno/keymaps/default/readme.md new file mode 100644 index 000000000..53b762f87 --- /dev/null +++ b/keyboards/uno/keymaps/default/readme.md @@ -0,0 +1,4 @@ +# The default keymap for uno +![Keymap](https://i.imgur.com/lCPZZpO.png) + +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. diff --git a/keyboards/uno/readme.md b/keyboards/uno/readme.md new file mode 100644 index 000000000..ce4cccd19 --- /dev/null +++ b/keyboards/uno/readme.md @@ -0,0 +1,19 @@ +# uno + + ![uno](https://i.imgur.com/OqPyWbbl.jpg) + +A 1-key, in-USB "board" for the lulz + + * Keyboard Maintainer: [Snipeye](https://github.com/Snipeye) + * Hardware Supported: uno pcb + * Hardware Availability: [GB](https://www.reddit.com/r/mechmarket/comments/gyijm7/gb_uno/) + + Make example for this keyboard (after setting up your build environment): + + make uno:default + + Flashing example for this keyboard: + + make uno:default:flash + + 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/uno/rules.mk b/keyboards/uno/rules.mk new file mode 100644 index 000000000..d23e95512 --- /dev/null +++ b/keyboards/uno/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # 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 = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output diff --git a/keyboards/uno/uno.c b/keyboards/uno/uno.c new file mode 100644 index 000000000..5ffb28865 --- /dev/null +++ b/keyboards/uno/uno.c @@ -0,0 +1,17 @@ +/* Copyright 2020 Snipeye + * + * 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 "uno.h" diff --git a/keyboards/uno/uno.h b/keyboards/uno/uno.h new file mode 100644 index 000000000..91d48d2ad --- /dev/null +++ b/keyboards/uno/uno.h @@ -0,0 +1,24 @@ +/* Copyright 2020 Snipeye + * + * 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" + +#define LAYOUT( \ + K00 \ +) { \ + { K00 } \ +}