From 9ce35e823b945aca427f11e1a4ae26d6ea672ff4 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Tue, 24 Jul 2018 01:13:11 +0200 Subject: [PATCH] Keyboard: Base for the nicekey keyboard (#3475) * Base for the nicekey keyboard * Fixed formatting of readme --- keyboards/handwired/nicekey/config.h | 75 +++++++++++++++++++ .../nicekey/keymaps/default/keymap.c | 75 +++++++++++++++++++ keyboards/handwired/nicekey/nicekey.c | 1 + keyboards/handwired/nicekey/nicekey.h | 1 + keyboards/handwired/nicekey/readme.md | 18 +++++ keyboards/handwired/nicekey/rules.mk | 61 +++++++++++++++ 6 files changed, 231 insertions(+) create mode 100644 keyboards/handwired/nicekey/config.h create mode 100644 keyboards/handwired/nicekey/keymaps/default/keymap.c create mode 100644 keyboards/handwired/nicekey/nicekey.c create mode 100644 keyboards/handwired/nicekey/nicekey.h create mode 100644 keyboards/handwired/nicekey/readme.md create mode 100644 keyboards/handwired/nicekey/rules.mk diff --git a/keyboards/handwired/nicekey/config.h b/keyboards/handwired/nicekey/config.h new file mode 100644 index 0000000000..652711be84 --- /dev/null +++ b/keyboards/handwired/nicekey/config.h @@ -0,0 +1,75 @@ +/* +Copyright 2015 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Lukas +#define PRODUCT nicekey +#define DESCRIPTION a compliment one key keyboard + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +#define MATRIX_COL_PINS { C6 } +#define MATRIX_ROW_PINS { B6 } +#define UNUSED_PINS + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + + + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/handwired/nicekey/keymaps/default/keymap.c b/keyboards/handwired/nicekey/keymaps/default/keymap.c new file mode 100644 index 0000000000..5732377156 --- /dev/null +++ b/keyboards/handwired/nicekey/keymaps/default/keymap.c @@ -0,0 +1,75 @@ +#include QMK_KEYBOARD_H + +enum custom_keycodes { + RANDOM_STRING_MACRO = SAFE_RANGE +}; + +const int delay = 100; +const char *sentences[] = { + "I hope you have a great day!\n", + "You are an awesome person.\n", + "I wish I knew you better, you seem nice!\n", + "Your views restore my faith in humanity\n", + "You are as cool as a norm-critical disney princess\n", + "You have impeccable manners.\n", + "You are making me smile\n", + "You are making a difference\n", + "You bring out the best in other people\n", + "You are all that and a super-size bag of chips.\n", + "You are not someone I pretend to not see in public.\n", + "Are you a beaver, because damn.\n", + "I bet you make babies smile.\n", + "You are awkward, in a cute way. Like an elevator ride, but with puppies.\n", + "Looking like a complete idiot with you is really fun.\n", + "If you cooked something really bad, I would tell you instead of eating it.\n", + "I love how passionate you are about your hobby.\n", + "Our conversations always make me feel better.\n", + "It is amazing how far out of your way you go to help people.\n", + "I am so glad that you wrote something here.\n", + "Hey you! How nice to see a friendly person in my feed!\n", + "I hope we know each other for a long time.\n", + "I bet if Britney Spears knew you, 2008 would have gone a lot differently.\n", + "I would trust you with my passwords.\n", + "You are a great problem solver\n", + "I would love to hear you laugh!\n", + "Please, have a monologue about your week, I just want to listen to you!\n", + "You are very far from being Trump.\n", + "I think my dog might like you more than me\n", + "I feel like you would be a great person to do a group project with\n", + "I bet animals love you\n", + "I bet even Kanye would like you more than himself\n", + "You are just doing a great job at life\n", + "I like how you are challenging me.\n", + "You would do be a great mother!\n", + "I... Baked bread for you.\n", + "Wow. You.\n", + "You would not have let that balrog pass!\n", + "Thank you.\n", + "You would be standing out in a crowd\n", + "Your sense of style is amazing.\n", + "You have a beautiful mind.\n", + "I like that big juicy brain of yours\n", + "I would share my cinnamon bun with you\n", + "I like you more than i like my moms apple pie\n", + "You give me the same feeling as a summers night\n", + "I enjoy you more than the click of my mechanical switch\n", + "I would let you pop my bubble wrap\n", + "Being near you is like being inside of a poem\n" +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + int sentences_size = sizeof(sentences) / sizeof(sentences[0]); + int i = rand() % sentences_size; + switch(keycode) { + case RANDOM_STRING_MACRO: + send_string_with_delay(sentences[i], delay); + return false; + } + } + return true; +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + {{ RANDOM_STRING_MACRO }} +}; diff --git a/keyboards/handwired/nicekey/nicekey.c b/keyboards/handwired/nicekey/nicekey.c new file mode 100644 index 0000000000..9720b0d0cb --- /dev/null +++ b/keyboards/handwired/nicekey/nicekey.c @@ -0,0 +1 @@ +#include "nicekey.h" diff --git a/keyboards/handwired/nicekey/nicekey.h b/keyboards/handwired/nicekey/nicekey.h new file mode 100644 index 0000000000..7a4a4835e6 --- /dev/null +++ b/keyboards/handwired/nicekey/nicekey.h @@ -0,0 +1 @@ +#include "quantum.h" \ No newline at end of file diff --git a/keyboards/handwired/nicekey/readme.md b/keyboards/handwired/nicekey/readme.md new file mode 100644 index 0000000000..a867e907e6 --- /dev/null +++ b/keyboards/handwired/nicekey/readme.md @@ -0,0 +1,18 @@ +# nicekey handwired + +![The first NiceKey](https://s3.eu-central-1.amazonaws.com/mindlevel/nicekey.jpg) + + +Custom handwired nicekey, a one key keyboard that writes random compliments. + +Keyboard Maintainer: spydon +Hardware Supported: Custom handwired one key +Hardware Availability: + +Switch must be connected to pins C6 and B6. + +Make example for this keyboard (after setting up your build environment): + + make handwired/nicekey:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/handwired/nicekey/rules.mk b/keyboards/handwired/nicekey/rules.mk new file mode 100644 index 0000000000..cfa693a73b --- /dev/null +++ b/keyboards/handwired/nicekey/rules.mk @@ -0,0 +1,61 @@ + + +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA \ No newline at end of file