summaryrefslogtreecommitdiffstats
path: root/keyboards/keyhive/uno
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keyhive/uno')
-rw-r--r--keyboards/keyhive/uno/keymaps/demo/keymap.c123
-rw-r--r--keyboards/keyhive/uno/rev1/config.h53
2 files changed, 176 insertions, 0 deletions
diff --git a/keyboards/keyhive/uno/keymaps/demo/keymap.c b/keyboards/keyhive/uno/keymaps/demo/keymap.c
new file mode 100644
index 0000000000..7ebc4dcd99
--- /dev/null
+++ b/keyboards/keyhive/uno/keymaps/demo/keymap.c
@@ -0,0 +1,123 @@
+/* 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 <http://www.gnu.org/licenses/>.
+ */
+
+#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
+
+enum encoder_names {
+ _ENCODER,
+};
+
+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("\n\nI am uno!");
+ break;
+ case 3:
+ SEND_STRING("\n\nI can do all sorts of useless things!");
+ break;
+ case 4:
+ SEND_STRING("\n\nAnd I have a built-in RGB LED!\n\n\n");
+ 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_BACKSPACE));
+ 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(1);
+ // Uncomment to enable rainbow mode when plugged in.
+ // Otherwise, the LED will be revealed after a few keypresses.
+ //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/keyhive/uno/rev1/config.h b/keyboards/keyhive/uno/rev1/config.h
new file mode 100644
index 0000000000..58d3a58ec2
--- /dev/null
+++ b/keyboards/keyhive/uno/rev1/config.h
@@ -0,0 +1,53 @@
+/* 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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+#include "config_common.h"
+
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Uno default pinout */
+#define DIRECT_PINS { \
+ { B6 } \
+}
+
+#ifdef RGBLIGHT_ENABLE
+#define RGB_DI_PIN F6
+#define RGBLED_NUM 1
+#endif
+
+// #define RGB_DI_PIN E2
+// #ifdef RGB_DI_PIN
+// #define RGBLED_NUM 16
+// #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 */
+// /*== 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