From 2febf9b9f7d610fc2eca666a842272cb90a87919 Mon Sep 17 00:00:00 2001 From: h-youhei Date: Tue, 22 Nov 2016 20:40:12 +0900 Subject: [PATCH 01/25] Add japanese keymap --- quantum/keymap_extras/keymap_jp.h | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 quantum/keymap_extras/keymap_jp.h diff --git a/quantum/keymap_extras/keymap_jp.h b/quantum/keymap_extras/keymap_jp.h new file mode 100644 index 000000000..e81b5952e --- /dev/null +++ b/quantum/keymap_extras/keymap_jp.h @@ -0,0 +1,62 @@ +/* JP106-layout (Japanese Standard) + * + * For more information, see + * http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/usbkeycode.html + * note: This website is written in Japanese. + */ + + +#ifndef KEYMAP_JP_H +#define KEYMAP_JP_H + + +#include "keymap.h" + + +#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi +#define JP_YEN KC_INT3 // yen, | +#define JP_CIRC KC_EQL // ^, ~ +#define JP_AT KC_LBRC // @, ` +#define JP_LBRC KC_RBRC // [, { +#define JP_COLN KC_QUOT // :, * +#define JP_RBRC KC_NUHS // ], } +#define JP_BSLS KC_INT1 // \, _ +#define JP_MHEN KC_INT5 // muhenkan +#define JP_HENK KC_INT4 // henkan +#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi + + +//Aliases for shifted symbols +#define JP_DQT LSFT(KC_2) // " +#define JP_AMPR LSFT(KC_6) // & +#define JP_QUOT LSFT(KC_7) // ' +#define JP_LPRN LSFT(KC_8) // ( +#define JP_RPRN LSFT(KC_9) // ) +#define JP_EQL LSFT(KC_MINS) // = +#define JP_TILD LSFT(JP_CIRC) // ~ +#define JP_PIPE LSFT(JP_YEN) // | +#define JP_GRV LSFT(JP_AT) // ` +#define JP_LCBR LSFT(JP_LBRC) // { +#define JP_PLUS LSFT(KC_SCLN) // + +#define JP_ASTR LSFT(JP_COLN) // * +#define JP_RCBR LSFT(JP_RBRC) // } +#define JP_UNDS LSFT(JP_BSLS) // _ + + +// These symbols are correspond to US101-layout. +#define JP_MINS KC_MINS // - +#define JP_SCLN KC_SCLN // ; +#define JP_COMM KC_COMM // , +#define JP_DOT KC_DOT // . +#define JP_SLSH KC_SLSH // / +// shifted +#define JP_EXLM KC_EXLM // ! +#define JP_HASH KC_HASH // # +#define JP_DLR KC_DLR // $ +#define JP_PERC KC_PERC // % +#define JP_LT KC_LT // < +#define JP_GT KC_GT // > +#define JP_QUES KC_QUES // ? + + +#endif From d37becc0a9203c4c7d52aca6190b4b3d9fb69a59 Mon Sep 17 00:00:00 2001 From: PureSpider Date: Tue, 22 Nov 2016 22:12:57 +0100 Subject: [PATCH 02/25] Set backlight status to on if it's at maximum brightness already and the brightness increase keybind is used Before it was turned on but the status wasn't set to on, so you had to push the backlight toggle bind twice to turn it off again --- tmk_core/common/backlight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c index c9e8fd3fd..0e0ad2d15 100644 --- a/tmk_core/common/backlight.c +++ b/tmk_core/common/backlight.c @@ -36,9 +36,9 @@ void backlight_increase(void) if(backlight_config.level < BACKLIGHT_LEVELS) { backlight_config.level++; - backlight_config.enable = 1; - eeconfig_update_backlight(backlight_config.raw); } + backlight_config.enable = 1; + eeconfig_update_backlight(backlight_config.raw); dprintf("backlight increase: %u\n", backlight_config.level); backlight_set(backlight_config.level); } From 5893f0fa1fcecfface25ce570f37e51031a14489 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Wed, 23 Nov 2016 16:22:57 +1100 Subject: [PATCH 03/25] Fixed NO_SUSPEND_POWER_DOWN handling --- tmk_core/common/avr/suspend.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 8a7272bbc..939bda15e 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -47,6 +47,7 @@ void suspend_idle(uint8_t time) sleep_disable(); } +#ifndef NO_SUSPEND_POWER_DOWN /* Power down MCU with watchdog timer * wdto: watchdog timer timeout defined in * WDTO_15MS @@ -61,6 +62,7 @@ void suspend_idle(uint8_t time) * WDTO_8S */ static uint8_t wdt_timeout = 0; + static void power_down(uint8_t wdto) { #ifdef PROTOCOL_LUFA @@ -98,10 +100,13 @@ static void power_down(uint8_t wdto) // Disable watchdog after sleep wdt_disable(); } +#endif void suspend_power_down(void) { +#ifndef NO_SUSPEND_POWER_DOWN power_down(WDTO_15MS); +#endif } __attribute__ ((weak)) void matrix_power_up(void) {} @@ -109,7 +114,9 @@ __attribute__ ((weak)) void matrix_power_down(void) {} bool suspend_wakeup_condition(void) { #ifdef BACKLIGHT_ENABLE +#ifndef NO_SUSPEND_POWER_DOWN backlight_set(0); +#endif #endif matrix_power_up(); matrix_scan(); @@ -126,7 +133,6 @@ void suspend_wakeup_init(void) // clear keyboard state clear_keyboard(); #ifdef BACKLIGHT_ENABLE - backlight_set(0); backlight_init(); #endif led_set(host_keyboard_leds()); From cf3926a8e13edb76193b8af25b497f9ef61161fd Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Wed, 23 Nov 2016 19:45:50 +1100 Subject: [PATCH 04/25] Fixed NO_SUSPEND_POWER_DOWN handling --- tmk_core/common/avr/suspend.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 939bda15e..0c81e8361 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -113,11 +113,6 @@ __attribute__ ((weak)) void matrix_power_up(void) {} __attribute__ ((weak)) void matrix_power_down(void) {} bool suspend_wakeup_condition(void) { -#ifdef BACKLIGHT_ENABLE -#ifndef NO_SUSPEND_POWER_DOWN - backlight_set(0); -#endif -#endif matrix_power_up(); matrix_scan(); matrix_power_down(); @@ -135,7 +130,7 @@ void suspend_wakeup_init(void) #ifdef BACKLIGHT_ENABLE backlight_init(); #endif -led_set(host_keyboard_leds()); + led_set(host_keyboard_leds()); } #ifndef NO_SUSPEND_POWER_DOWN From 3be13d1ffb43216aff1300cdce79512559bdde7c Mon Sep 17 00:00:00 2001 From: ofples Date: Fri, 25 Nov 2016 09:15:12 +0200 Subject: [PATCH 05/25] Added protocol.mk to build --- build_keyboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/build_keyboard.mk b/build_keyboard.mk index 61aebf393..055ce632a 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -199,6 +199,7 @@ endif VPATH += $(KEYBOARD_PATH) VPATH += $(COMMON_VPATH) +include $(TMK_PATH)/protocol.mk include $(TMK_PATH)/common.mk SRC += $(TMK_COMMON_SRC) From 03d6e165bb0baf9d0093250d3c3c0771290df4d6 Mon Sep 17 00:00:00 2001 From: ofples Date: Fri, 25 Nov 2016 09:17:40 +0200 Subject: [PATCH 06/25] Added missing endif for ifdef __AVR_ATmega32U4__ and removed the unnecessary one at the end of the file --- quantum/config_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/config_common.h b/quantum/config_common.h index 8ed5f4a10..443473292 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -76,6 +76,7 @@ } while(0) # else # error "USART configuration is needed." +# endif #endif // I'm fairly sure these aren't needed, but oh well - Jack @@ -125,4 +126,3 @@ #endif -#endif From 0c9d66eb59add717397ba83d508577073412ce86 Mon Sep 17 00:00:00 2001 From: ofples Date: Fri, 25 Nov 2016 09:20:41 +0200 Subject: [PATCH 07/25] Removed comment --- quantum/config_common.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/quantum/config_common.h b/quantum/config_common.h index 443473292..6b525fe1c 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -79,8 +79,6 @@ # endif #endif -// I'm fairly sure these aren't needed, but oh well - Jack - /* * PS/2 Interrupt configuration */ From 97e7486d4c8818f4a6b3e619729d6f4f6524a7d1 Mon Sep 17 00:00:00 2001 From: ofples Date: Fri, 25 Nov 2016 12:10:44 +0200 Subject: [PATCH 08/25] Added documentation for PS/2 mouse in readme --- readme.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/readme.md b/readme.md index 8615b48d5..0157b9072 100644 --- a/readme.md +++ b/readme.md @@ -1157,6 +1157,45 @@ The firmware supports 5 different light effects, and the color (hue, saturation, Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20. +## PS/2 Mouse Support + +Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. +In order to do this you must first enable the option in your Makefile. + + PS2_MOUSE_ENABLE = yes + +Then, decide whether to use interrupts (better if your microcontroller supports them) or busywait, and enable the relevant option. + + PS2_USE_INT = yes + // PS2_USE_BUSYWAIT = yes + +If you're using a teensy and have hooked up the clock on your PS/2 device to D1 and the data to D0, you're all set. +Otherwise, you will need to update the following defines in your `config.h`: + + #define PS2_CLOCK_PORT PORTD + #define PS2_CLOCK_PIN PIND + #define PS2_CLOCK_DDR DDRD + #define PS2_CLOCK_BIT 1 + + #define PS2_DATA_PORT PORTD + #define PS2_DATA_PIN PIND + #define PS2_DATA_DDR DDRD + #define PS2_DATA_BIT 0 + +And with `PS2_USE_INT` also define these macros: + + #define PS2_INT_INIT() do { \ + EICRA |= ((1< Date: Sat, 26 Nov 2016 13:11:40 +0700 Subject: [PATCH 09/25] My Promethium keyboard firmware --- keyboards/handwired/promethium/Makefile | 3 + keyboards/handwired/promethium/config.h | 164 ++++ .../promethium/keymaps/priyadi/Makefile | 28 + .../promethium/keymaps/priyadi/config.h | 17 + .../promethium/keymaps/priyadi/flash.sh | 3 + .../promethium/keymaps/priyadi/keymap.c | 725 ++++++++++++++++++ .../promethium/keymaps/priyadi/readme.md | 0 .../handwired/promethium/keymaps/readme.md | 22 + keyboards/handwired/promethium/promethium.c | 6 + keyboards/handwired/promethium/promethium.h | 99 +++ keyboards/handwired/promethium/readme.md | 12 + keyboards/handwired/promethium/rgbsps.c | 24 + keyboards/handwired/promethium/rgbsps.h | 4 + keyboards/handwired/promethium/rules.mk | 75 ++ 14 files changed, 1182 insertions(+) create mode 100644 keyboards/handwired/promethium/Makefile create mode 100644 keyboards/handwired/promethium/config.h create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/Makefile create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/config.h create mode 100755 keyboards/handwired/promethium/keymaps/priyadi/flash.sh create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/keymap.c create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/readme.md create mode 100644 keyboards/handwired/promethium/keymaps/readme.md create mode 100644 keyboards/handwired/promethium/promethium.c create mode 100644 keyboards/handwired/promethium/promethium.h create mode 100644 keyboards/handwired/promethium/readme.md create mode 100644 keyboards/handwired/promethium/rgbsps.c create mode 100644 keyboards/handwired/promethium/rgbsps.h create mode 100644 keyboards/handwired/promethium/rules.mk diff --git a/keyboards/handwired/promethium/Makefile b/keyboards/handwired/promethium/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/handwired/promethium/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h new file mode 100644 index 000000000..5a2afe6ab --- /dev/null +++ b/keyboards/handwired/promethium/config.h @@ -0,0 +1,164 @@ +/* +Copyright 2012 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 0x6660 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Priyadi +#define PRODUCT Promethium Keyboard +#define DESCRIPTION Promethium Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* default pin-out */ +#define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 } +#define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \ +) + +/* + * 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 + +/* PS/2 mouse */ +#ifdef PS2_USE_BUSYWAIT +# define PS2_CLOCK_PORT PORTD +# define PS2_CLOCK_PIN PIND +# define PS2_CLOCK_DDR DDRD +# define PS2_CLOCK_BIT 1 +# define PS2_DATA_PORT PORTD +# define PS2_DATA_PIN PIND +# define PS2_DATA_DDR DDRD +# define PS2_DATA_BIT 2 +#endif + +/* PS/2 mouse interrupt version */ +#ifdef PS2_USE_INT +/* uses INT1 for clock line(ATMega32U4) */ +#define PS2_CLOCK_PORT PORTD +#define PS2_CLOCK_PIN PIND +#define PS2_CLOCK_DDR DDRD +#define PS2_CLOCK_BIT 3 +#define PS2_DATA_PORT PORTD +#define PS2_DATA_PIN PIND +#define PS2_DATA_DDR DDRD +#define PS2_DATA_BIT 2 + +#define PS2_INT_INIT() do { \ + EICRA |= ((1< | ( | ) | ' | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | _ | + | { | } | [ | ] | " | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_PUNC] = KEYMAP( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV , + XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Num + * ,-----------------------------------------------------------------------------------. + * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | x | | | 0 | , | . | + | - | + * `-----------------------------------------------------------------------------------' + */ +[_NUM] = KEYMAP( + KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT, + KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR, + _______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS +), + +/* Func + * ,-----------------------------------------------------------------------------------. + * | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F9 | F10 | F11 | F12 | | | | Home | End | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_FUNC] = KEYMAP( + XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL, + XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS, + _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Emoji + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_EMOJI] = KEYMAP( + X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW), + X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS), + X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH), + X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK) +), + +/* GUI + * ,-----------------------------------------------------------------------------------. + * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Win | | Prev | Play | Next | | | | | | |Colmak| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | OSX | | | | | BL- | BL+ | | | | |Workmn| + * `-----------------------------------------------------------------------------------' + */ +[_GUI] = KEYMAP( + _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______, + LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY, + WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK, + OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN +), + +}; + +#ifdef AUDIO_ENABLE +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_workman[][2] = SONG(DVORAK_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND); +float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND); +float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2)); +#endif + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + #ifdef AUDIO_ENABLE + // faux clicky + if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0); + #endif + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case WORKMAN: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_workman, false, 0); + #endif + persistant_default_layer_set(1UL<<_WORKMAN); + } + return false; + break; + + + + case PUNC: + if (record->event.pressed) { + layer_on(_PUNC); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_gui(); + } else { + led_layer_punc();; + } + } else { + layer_off(_PUNC); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_EMOJI)) { + led_layer_emoji(); + } else { + led_layer_normal();; + } + } + return false; + break; + case EMOJI: + if (record->event.pressed) { + layer_on(_EMOJI); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_gui(); + } else { + led_layer_emoji();; + } + } else { + layer_off(_EMOJI); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_PUNC)) { + led_layer_punc(); + } else { + led_layer_normal();; + } + } + return false; + break; + case NUM: + if (record->event.pressed) { + layer_on(_NUM); + led_layer_num(); + } else { + layer_off(_NUM); + led_layer_normal(); + } + return false; + break; + case FUNC: + if (record->event.pressed) { + layer_on(_FUNC); + led_layer_func(); + } else { + layer_off(_FUNC); + led_layer_normal(); + } + return false; + break; + + + case LINUX: + set_unicode_input_mode(UC_LNX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_linux, false, 0); + #endif + return false; + break; + case WIN: + set_unicode_input_mode(UC_WINC); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_windows, false, 0); + #endif + return false; + break; + case OSX: + set_unicode_input_mode(UC_OSX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_osx, false, 0); + #endif + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif + set_unicode_input_mode(UC_LNX); + led_init(); +} + +// void init_rgblight(void) { +// for (uint8_t i = 0; i < RGBLED_NUM; i++) { +// led[i].r = 255; +// led[i].g = 85; +// led[i].b = 0; +// } +// ws2812_setleds(led, RGBLED_NUM); +// } + + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/promethium/keymaps/priyadi/readme.md b/keyboards/handwired/promethium/keymaps/priyadi/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/keyboards/handwired/promethium/keymaps/readme.md b/keyboards/handwired/promethium/keymaps/readme.md new file mode 100644 index 000000000..527691389 --- /dev/null +++ b/keyboards/handwired/promethium/keymaps/readme.md @@ -0,0 +1,22 @@ +# How to add your own keymap + +Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: + + _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] + +\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements + +and contain the following files: + +* `keymap.c` +* `readme.md` *recommended* +* `config.h` *optional*, found automatically when compiling +* `Makefile` *optional*, found automatically when compling + +When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: + + * **folder_name** description + +# List of Promethium keymaps + + diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c new file mode 100644 index 000000000..a0035cce1 --- /dev/null +++ b/keyboards/handwired/promethium/promethium.c @@ -0,0 +1,6 @@ +#include "promethium.h" + +void matrix_init_kb(void) { + + matrix_init_user(); +} \ No newline at end of file diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h new file mode 100644 index 000000000..fb0dc1683 --- /dev/null +++ b/keyboards/handwired/promethium/promethium.h @@ -0,0 +1,99 @@ +#ifndef PROMETHIUM_H +#define PROMETHIUM_H + +#include "quantum.h" + +#define KEYMAP( \ + k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ + k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ + k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ + k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \ +) \ +{ \ + {k11, k12, k13, k14, k15, k16}, \ + {k21, k22, k23, k24, k25, k26}, \ + {k31, k32, k33, k34, k35, k36}, \ + {k41, k42, k43, k44, k45, k46}, \ + {k17, k18, k19, k1a, k1b, k1c}, \ + {k27, k28, k29, k2a, k2b, k2c}, \ + {k37, k38, k39, k3a, k3b, k3c}, \ + {k47, k48, k49, k4a, k4b, k4c} \ +} + +enum led_sequence { + LED_IND_EMOJI, + LED_IND_NUM, + LED_IND_FUNC, + + LED_IND_BATTERY, + LED_IND_USB, + LED_IND_BLUETOOTH, + + LED_TAB, + LED_ESC, + LED_LSFT, + LED_LCTL, + + LED_LGUI, + LED_Z, + LED_A, + LED_Q, + + LED_W, + LED_S, + LED_X, + LED_LALT, + + LED_PUNC, + LED_C, + LED_D, + LED_E, + + LED_R, + LED_F, + LED_V, + LED_NUM, + + LED_LSPC, + LED_B, + LED_G, + LED_T, + + LED_TRACKPOINT1, + LED_TRACKPOINT2, + LED_TRACKPOINT3, + + LED_RSPC, + LED_N, + LED_HH, + LED_Y, + + LED_U, + LED_J, + LED_M, + LED_FUNC, + + LED_EMOJI, + LED_COMM, + LED_K, + LED_I, + + LED_O, + LED_L, + LED_DOT, + LED_RALT, + + LED_RGUI, + LED_SLSH, + LED_SCLN, + LED_P, + + LED_BKSP, + LED_ENT, + LED_RSFT, + LED_RCTL +}; + +#endif + + diff --git a/keyboards/handwired/promethium/readme.md b/keyboards/handwired/promethium/readme.md new file mode 100644 index 000000000..64e2c3a16 --- /dev/null +++ b/keyboards/handwired/promethium/readme.md @@ -0,0 +1,12 @@ +Promethium Keyboard Firmware +============================ +A handwired Planck based keyboard using the Adafruit Feather 32u4 Bluefruit LE controller. + +Features: + +* Single piece split form factor +* Vertical staggered +* Trackpoint +* Bluetooth LE *TBD* +* Battery +* Per switch RGB LED \ No newline at end of file diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c new file mode 100644 index 000000000..ea922ec3f --- /dev/null +++ b/keyboards/handwired/promethium/rgbsps.c @@ -0,0 +1,24 @@ +#include "light_ws2812.h" +#include "rgbsps.h" + +struct cRGB led[RGBSPS_NUM]; + +void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) { + led[index].r = r; + led[index].g = g; + led[index].b = b; +} + +void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b) { + for (uint16_t i = 0; i < RGBSPS_NUM; i++) { + rgbsps_set(i, r, g, b); + } +} + +void rgbsps_turnoff(void) { + rgbsps_setall(0, 0, 0); +} + +void rgbsps_send(void) { + ws2812_setleds(led, RGBSPS_NUM); +} \ No newline at end of file diff --git a/keyboards/handwired/promethium/rgbsps.h b/keyboards/handwired/promethium/rgbsps.h new file mode 100644 index 000000000..6da197f75 --- /dev/null +++ b/keyboards/handwired/promethium/rgbsps.h @@ -0,0 +1,4 @@ +void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b); +void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b); +void rgbsps_turnoff(void); +void rgbsps_send(void); \ No newline at end of file diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk new file mode 100644 index 000000000..835b13c4f --- /dev/null +++ b/keyboards/handwired/promethium/rules.mk @@ -0,0 +1,75 @@ + +# MCU name +#MCU = at90usb1287 +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 = 8000000 + +# +# 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 +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration +NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +UNICODEMAP_ENABLE = yes +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +PS2_MOUSE_ENABLE ?= yes +PS2_USE_INT ?= yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +include $(TMK_DIR)/protocol.mk +SRC += $(QUANTUM_DIR)/light_ws2812.c +SRC += rgbsps.c \ No newline at end of file From 9a071f051ca9dffdf64b68ea59b2424e37bc51e7 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:24:53 +0700 Subject: [PATCH 10/25] Make PS2 init delay configurable. Some devices are not fully powered up after 1s. --- tmk_core/protocol/ps2_mouse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index c3e8b3c1c..82f6966e8 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c @@ -26,6 +26,9 @@ along with this program. If not, see . #include "print.h" #include "debug.h" +#ifndef PS2_INIT_DELAY +#define PS2_INIT_DELAY 1000 +#endif static report_mouse_t mouse_report = {}; @@ -39,7 +42,7 @@ uint8_t ps2_mouse_init(void) { ps2_host_init(); - _delay_ms(1000); // wait for powering up + _delay_ms(PS2_INIT_DELAY); // wait for powering up // send Reset rcv = ps2_host_send(0xFF); From b94e5b2aa6636326b2eaa75a2c562ea074e1535a Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:44:50 +0700 Subject: [PATCH 11/25] change init delay to 2000ms --- keyboards/handwired/promethium/promethium.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h index fb0dc1683..8f2a8c3be 100644 --- a/keyboards/handwired/promethium/promethium.h +++ b/keyboards/handwired/promethium/promethium.h @@ -3,6 +3,8 @@ #include "quantum.h" +#define PS2_INIT_DELAY 2000 + #define KEYMAP( \ k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ From 6313ec7ef960ad76182020f031cd09803d7a7d51 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:46:05 +0700 Subject: [PATCH 12/25] protocols.mk is already included in latest QMK --- keyboards/handwired/promethium/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 835b13c4f..0842780cc 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -70,6 +70,5 @@ PS2_USE_INT ?= yes # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend -include $(TMK_DIR)/protocol.mk SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += rgbsps.c \ No newline at end of file From 2cf9b9375878d3810fbdfe0c215ee4dcb379a163 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:47:03 +0700 Subject: [PATCH 13/25] remove ifdef on chip type --- keyboards/handwired/promethium/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index 5a2afe6ab..473af67d3 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -116,7 +116,6 @@ along with this program. If not, see . /* PS/2 mouse USART version */ #ifdef PS2_USE_USART -#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) /* XCK for clock line and RXD for data line */ #define PS2_CLOCK_PORT PORTD #define PS2_CLOCK_PIN PIND @@ -158,7 +157,6 @@ along with this program. If not, see . #define PS2_USART_ERROR (UCSR1A & ((1< Date: Sat, 26 Nov 2016 13:55:41 +0700 Subject: [PATCH 14/25] PS2 pins configuration belongs to each keyboards config.h Each keyboard might have different pin configuration. And keeping this here will trigger redefinition warning on keyboards that have PS2 defines. --- quantum/config_common.h | 46 ----------------------------------------- 1 file changed, 46 deletions(-) diff --git a/quantum/config_common.h b/quantum/config_common.h index 6b525fe1c..21960f1a0 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -78,49 +78,3 @@ # error "USART configuration is needed." # endif #endif - -/* - * PS/2 Interrupt configuration - */ -#ifdef PS2_USE_INT -/* uses INT1 for clock line(ATMega32U4) */ -#define PS2_CLOCK_PORT PORTD -#define PS2_CLOCK_PIN PIND -#define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 1 - -#define PS2_DATA_PORT PORTD -#define PS2_DATA_PIN PIND -#define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 0 - -#define PS2_INT_INIT() do { \ - EICRA |= ((1< Date: Sat, 26 Nov 2016 14:02:38 +0700 Subject: [PATCH 15/25] Fix unterminated ifndef --- quantum/config_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quantum/config_common.h b/quantum/config_common.h index 21960f1a0..4d3939dae 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -78,3 +78,5 @@ # error "USART configuration is needed." # endif #endif + +#endif \ No newline at end of file From f837406ace5a3072e98f0bd0e3f4c84704762195 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 14:23:55 +0700 Subject: [PATCH 16/25] A few addition to PS2 documentation. --- readme.md | 146 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 118 insertions(+), 28 deletions(-) diff --git a/readme.md b/readme.md index 0157b9072..3eb67882a 100644 --- a/readme.md +++ b/readme.md @@ -1160,41 +1160,131 @@ Please note the USB port can only supply a limited amount of power to the keyboa ## PS/2 Mouse Support Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. -In order to do this you must first enable the option in your Makefile. - PS2_MOUSE_ENABLE = yes +Then, decide whether to use USART (best), interrupts (better) or busywait (not recommended), and enable the relevant option. -Then, decide whether to use interrupts (better if your microcontroller supports them) or busywait, and enable the relevant option. +### Busywait version - PS2_USE_INT = yes - // PS2_USE_BUSYWAIT = yes +Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. -If you're using a teensy and have hooked up the clock on your PS/2 device to D1 and the data to D0, you're all set. -Otherwise, you will need to update the following defines in your `config.h`: - - #define PS2_CLOCK_PORT PORTD - #define PS2_CLOCK_PIN PIND - #define PS2_CLOCK_DDR DDRD - #define PS2_CLOCK_BIT 1 +In rules.mk: - #define PS2_DATA_PORT PORTD - #define PS2_DATA_PIN PIND - #define PS2_DATA_DDR DDRD - #define PS2_DATA_BIT 0 +``` +PS2_MOUSE_ENABLE = yes +PS2_USE_BUSYWAIT = yes +``` -And with `PS2_USE_INT` also define these macros: +In your keyboard config.h: - #define PS2_INT_INIT() do { \ - EICRA |= ((1< Date: Sat, 26 Nov 2016 15:26:02 +0700 Subject: [PATCH 17/25] add macro error when a required define is missing --- quantum/config_common.h | 118 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/quantum/config_common.h b/quantum/config_common.h index 4d3939dae..0a2dba78f 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -79,4 +79,122 @@ # endif #endif +#ifdef PS2_USE_BUSYWAIT +# ifndef PS2_CLOCK_PORT +# error "PS2_CLOCK_PORT has to be defined" +# endif +# ifndef PS2_CLOCK_PIN +# error "PS2_CLOCK_PIN has to be defined" +# endif +# ifndef PS2_CLOCK_DDR +# error "PS2_CLOCK_DDR has to be defined" +# endif +# ifndef PS2_CLOCK_BIT +# error "PS2_CLOCK_BIT has to be defined" +# endif +# ifndef PS2_DATA_PORT +# error "PS2_DATA_PORT has to be defined" +# endif +# ifndef PS2_DATA_PIN +# error "PS2_DATA_PIN has to be defined" +# endif +# ifndef PS2_DATA_DDR +# error "PS2_DATA_DDR has to be defined" +# endif +# ifndef PS2_DATA_BIT +# error "PS2_DATA_BIT has to be defined" +# endif +#endif + +#ifdef PS2_USE_INT +# ifndef PS2_CLOCK_PORT +# error "PS2_CLOCK_PORT has to be defined" +# endif +# ifndef PS2_CLOCK_PIN +# error "PS2_CLOCK_PIN has to be defined" +# endif +# ifndef PS2_CLOCK_DDR +# error "PS2_CLOCK_DDR has to be defined" +# endif +# ifndef PS2_CLOCK_BIT +# error "PS2_CLOCK_BIT has to be defined" +# endif +# ifndef PS2_DATA_PORT +# error "PS2_DATA_PORT has to be defined" +# endif +# ifndef PS2_DATA_PIN +# error "PS2_DATA_PIN has to be defined" +# endif +# ifndef PS2_DATA_DDR +# error "PS2_DATA_DDR has to be defined" +# endif +# ifndef PS2_DATA_BIT +# error "PS2_DATA_BIT has to be defined" +# endif +# ifndef PS2_INT_INIT +# error "PS2_INT_INIT has to be defined" +# endif +# ifndef PS2_INT_ON +# error "PS2_INT_ON has to be defined" +# endif +# ifndef PS2_INT_OFF +# error "PS2_INT_OFF has to be defined" +# endif +# ifndef PS2_INT_VECT +# error "PS2_INT_VECT has to be defined" +# endif +#endif + +#ifdef PS2_USE_USART +# ifndef PS2_CLOCK_PORT +# error "PS2_CLOCK_PORT has to be defined" +# endif +# ifndef PS2_CLOCK_PIN +# error "PS2_CLOCK_PIN has to be defined" +# endif +# ifndef PS2_CLOCK_DDR +# error "PS2_CLOCK_DDR has to be defined" +# endif +# ifndef PS2_CLOCK_BIT +# error "PS2_CLOCK_BIT has to be defined" +# endif +# ifndef PS2_DATA_PORT +# error "PS2_DATA_PORT has to be defined" +# endif +# ifndef PS2_DATA_PIN +# error "PS2_DATA_PIN has to be defined" +# endif +# ifndef PS2_DATA_DDR +# error "PS2_DATA_DDR has to be defined" +# endif +# ifndef PS2_DATA_BIT +# error "PS2_DATA_BIT has to be defined" +# endif +# ifndef PS2_USART_INIT +# error "PS2_USART_INIT has to be defined" +# endif +# ifndef PS2_USART_RX_INT_ON +# error "PS2_USART_RX_INT_ON has to be defined" +# endif +# ifndef PS2_USART_RX_POLL_ON +# error "PS2_USART_RX_POLL_ON has to be defined" +# endif +# ifndef PS2_USART_OFF +# error "PS2_USART_OFF has to be defined" +# endif +# ifndef PS2_USART_RX_READY +# error "PS2_USART_RX_READY has to be defined" +# endif +# ifndef PS2_USART_RX_DATA +# error "PS2_USART_RX_DATA has to be defined" +# endif +# ifndef PS2_USART_ERROR +# error "PS2_USART_ERROR has to be defined" +# endif +# ifndef PS2_USART_RX_VECT +# error "PS2_USART_RX_VECT has to be defined" +# endif +#endif + + #endif \ No newline at end of file From f2214ce1cb6cfe7a0efabe870a2c00fb8451ee80 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 15:57:48 +0700 Subject: [PATCH 18/25] remove define checks. didn't work because of include ordering. --- quantum/config_common.h | 118 ---------------------------------------- 1 file changed, 118 deletions(-) diff --git a/quantum/config_common.h b/quantum/config_common.h index 0a2dba78f..4d3939dae 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -79,122 +79,4 @@ # endif #endif -#ifdef PS2_USE_BUSYWAIT -# ifndef PS2_CLOCK_PORT -# error "PS2_CLOCK_PORT has to be defined" -# endif -# ifndef PS2_CLOCK_PIN -# error "PS2_CLOCK_PIN has to be defined" -# endif -# ifndef PS2_CLOCK_DDR -# error "PS2_CLOCK_DDR has to be defined" -# endif -# ifndef PS2_CLOCK_BIT -# error "PS2_CLOCK_BIT has to be defined" -# endif -# ifndef PS2_DATA_PORT -# error "PS2_DATA_PORT has to be defined" -# endif -# ifndef PS2_DATA_PIN -# error "PS2_DATA_PIN has to be defined" -# endif -# ifndef PS2_DATA_DDR -# error "PS2_DATA_DDR has to be defined" -# endif -# ifndef PS2_DATA_BIT -# error "PS2_DATA_BIT has to be defined" -# endif -#endif - -#ifdef PS2_USE_INT -# ifndef PS2_CLOCK_PORT -# error "PS2_CLOCK_PORT has to be defined" -# endif -# ifndef PS2_CLOCK_PIN -# error "PS2_CLOCK_PIN has to be defined" -# endif -# ifndef PS2_CLOCK_DDR -# error "PS2_CLOCK_DDR has to be defined" -# endif -# ifndef PS2_CLOCK_BIT -# error "PS2_CLOCK_BIT has to be defined" -# endif -# ifndef PS2_DATA_PORT -# error "PS2_DATA_PORT has to be defined" -# endif -# ifndef PS2_DATA_PIN -# error "PS2_DATA_PIN has to be defined" -# endif -# ifndef PS2_DATA_DDR -# error "PS2_DATA_DDR has to be defined" -# endif -# ifndef PS2_DATA_BIT -# error "PS2_DATA_BIT has to be defined" -# endif -# ifndef PS2_INT_INIT -# error "PS2_INT_INIT has to be defined" -# endif -# ifndef PS2_INT_ON -# error "PS2_INT_ON has to be defined" -# endif -# ifndef PS2_INT_OFF -# error "PS2_INT_OFF has to be defined" -# endif -# ifndef PS2_INT_VECT -# error "PS2_INT_VECT has to be defined" -# endif -#endif - -#ifdef PS2_USE_USART -# ifndef PS2_CLOCK_PORT -# error "PS2_CLOCK_PORT has to be defined" -# endif -# ifndef PS2_CLOCK_PIN -# error "PS2_CLOCK_PIN has to be defined" -# endif -# ifndef PS2_CLOCK_DDR -# error "PS2_CLOCK_DDR has to be defined" -# endif -# ifndef PS2_CLOCK_BIT -# error "PS2_CLOCK_BIT has to be defined" -# endif -# ifndef PS2_DATA_PORT -# error "PS2_DATA_PORT has to be defined" -# endif -# ifndef PS2_DATA_PIN -# error "PS2_DATA_PIN has to be defined" -# endif -# ifndef PS2_DATA_DDR -# error "PS2_DATA_DDR has to be defined" -# endif -# ifndef PS2_DATA_BIT -# error "PS2_DATA_BIT has to be defined" -# endif -# ifndef PS2_USART_INIT -# error "PS2_USART_INIT has to be defined" -# endif -# ifndef PS2_USART_RX_INT_ON -# error "PS2_USART_RX_INT_ON has to be defined" -# endif -# ifndef PS2_USART_RX_POLL_ON -# error "PS2_USART_RX_POLL_ON has to be defined" -# endif -# ifndef PS2_USART_OFF -# error "PS2_USART_OFF has to be defined" -# endif -# ifndef PS2_USART_RX_READY -# error "PS2_USART_RX_READY has to be defined" -# endif -# ifndef PS2_USART_RX_DATA -# error "PS2_USART_RX_DATA has to be defined" -# endif -# ifndef PS2_USART_ERROR -# error "PS2_USART_ERROR has to be defined" -# endif -# ifndef PS2_USART_RX_VECT -# error "PS2_USART_RX_VECT has to be defined" -# endif -#endif - - #endif \ No newline at end of file From 8ee389c9b6e6757c228534b095e609d5a9501102 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:11:40 +0700 Subject: [PATCH 19/25] My Promethium keyboard firmware --- keyboards/handwired/promethium/Makefile | 3 + keyboards/handwired/promethium/config.h | 164 ++++ .../promethium/keymaps/priyadi/Makefile | 28 + .../promethium/keymaps/priyadi/config.h | 17 + .../promethium/keymaps/priyadi/flash.sh | 3 + .../promethium/keymaps/priyadi/keymap.c | 725 ++++++++++++++++++ .../promethium/keymaps/priyadi/readme.md | 0 .../handwired/promethium/keymaps/readme.md | 22 + keyboards/handwired/promethium/promethium.c | 6 + keyboards/handwired/promethium/promethium.h | 99 +++ keyboards/handwired/promethium/readme.md | 12 + keyboards/handwired/promethium/rgbsps.c | 24 + keyboards/handwired/promethium/rgbsps.h | 4 + keyboards/handwired/promethium/rules.mk | 75 ++ 14 files changed, 1182 insertions(+) create mode 100644 keyboards/handwired/promethium/Makefile create mode 100644 keyboards/handwired/promethium/config.h create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/Makefile create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/config.h create mode 100755 keyboards/handwired/promethium/keymaps/priyadi/flash.sh create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/keymap.c create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/readme.md create mode 100644 keyboards/handwired/promethium/keymaps/readme.md create mode 100644 keyboards/handwired/promethium/promethium.c create mode 100644 keyboards/handwired/promethium/promethium.h create mode 100644 keyboards/handwired/promethium/readme.md create mode 100644 keyboards/handwired/promethium/rgbsps.c create mode 100644 keyboards/handwired/promethium/rgbsps.h create mode 100644 keyboards/handwired/promethium/rules.mk diff --git a/keyboards/handwired/promethium/Makefile b/keyboards/handwired/promethium/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/handwired/promethium/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h new file mode 100644 index 000000000..5a2afe6ab --- /dev/null +++ b/keyboards/handwired/promethium/config.h @@ -0,0 +1,164 @@ +/* +Copyright 2012 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 0x6660 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Priyadi +#define PRODUCT Promethium Keyboard +#define DESCRIPTION Promethium Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* default pin-out */ +#define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 } +#define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \ +) + +/* + * 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 + +/* PS/2 mouse */ +#ifdef PS2_USE_BUSYWAIT +# define PS2_CLOCK_PORT PORTD +# define PS2_CLOCK_PIN PIND +# define PS2_CLOCK_DDR DDRD +# define PS2_CLOCK_BIT 1 +# define PS2_DATA_PORT PORTD +# define PS2_DATA_PIN PIND +# define PS2_DATA_DDR DDRD +# define PS2_DATA_BIT 2 +#endif + +/* PS/2 mouse interrupt version */ +#ifdef PS2_USE_INT +/* uses INT1 for clock line(ATMega32U4) */ +#define PS2_CLOCK_PORT PORTD +#define PS2_CLOCK_PIN PIND +#define PS2_CLOCK_DDR DDRD +#define PS2_CLOCK_BIT 3 +#define PS2_DATA_PORT PORTD +#define PS2_DATA_PIN PIND +#define PS2_DATA_DDR DDRD +#define PS2_DATA_BIT 2 + +#define PS2_INT_INIT() do { \ + EICRA |= ((1< | ( | ) | ' | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | _ | + | { | } | [ | ] | " | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_PUNC] = KEYMAP( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV , + XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Num + * ,-----------------------------------------------------------------------------------. + * | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | x | | | 0 | , | . | + | - | + * `-----------------------------------------------------------------------------------' + */ +[_NUM] = KEYMAP( + KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT, + KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR, + _______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS +), + +/* Func + * ,-----------------------------------------------------------------------------------. + * | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F9 | F10 | F11 | F12 | | | | Home | End | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_FUNC] = KEYMAP( + XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL, + XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS, + _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Emoji + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_EMOJI] = KEYMAP( + X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW), + X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS), + X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH), + X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK) +), + +/* GUI + * ,-----------------------------------------------------------------------------------. + * | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Win | | Prev | Play | Next | | | | | | |Colmak| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | OSX | | | | | BL- | BL+ | | | | |Workmn| + * `-----------------------------------------------------------------------------------' + */ +[_GUI] = KEYMAP( + _______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______, + LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY, + WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK, + OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN +), + +}; + +#ifdef AUDIO_ENABLE +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_workman[][2] = SONG(DVORAK_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND); +float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND); +float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2)); +#endif + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + #ifdef AUDIO_ENABLE + // faux clicky + if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0); + #endif + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case WORKMAN: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_workman, false, 0); + #endif + persistant_default_layer_set(1UL<<_WORKMAN); + } + return false; + break; + + + + case PUNC: + if (record->event.pressed) { + layer_on(_PUNC); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_gui(); + } else { + led_layer_punc();; + } + } else { + layer_off(_PUNC); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_EMOJI)) { + led_layer_emoji(); + } else { + led_layer_normal();; + } + } + return false; + break; + case EMOJI: + if (record->event.pressed) { + layer_on(_EMOJI); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_GUI)) { + led_layer_gui(); + } else { + led_layer_emoji();; + } + } else { + layer_off(_EMOJI); + update_tri_layer(_PUNC, _EMOJI, _GUI); + if (IS_LAYER_ON(_PUNC)) { + led_layer_punc(); + } else { + led_layer_normal();; + } + } + return false; + break; + case NUM: + if (record->event.pressed) { + layer_on(_NUM); + led_layer_num(); + } else { + layer_off(_NUM); + led_layer_normal(); + } + return false; + break; + case FUNC: + if (record->event.pressed) { + layer_on(_FUNC); + led_layer_func(); + } else { + layer_off(_FUNC); + led_layer_normal(); + } + return false; + break; + + + case LINUX: + set_unicode_input_mode(UC_LNX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_linux, false, 0); + #endif + return false; + break; + case WIN: + set_unicode_input_mode(UC_WINC); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_windows, false, 0); + #endif + return false; + break; + case OSX: + set_unicode_input_mode(UC_OSX); + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_osx, false, 0); + #endif + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif + set_unicode_input_mode(UC_LNX); + led_init(); +} + +// void init_rgblight(void) { +// for (uint8_t i = 0; i < RGBLED_NUM; i++) { +// led[i].r = 255; +// led[i].g = 85; +// led[i].b = 0; +// } +// ws2812_setleds(led, RGBLED_NUM); +// } + + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/promethium/keymaps/priyadi/readme.md b/keyboards/handwired/promethium/keymaps/priyadi/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/keyboards/handwired/promethium/keymaps/readme.md b/keyboards/handwired/promethium/keymaps/readme.md new file mode 100644 index 000000000..527691389 --- /dev/null +++ b/keyboards/handwired/promethium/keymaps/readme.md @@ -0,0 +1,22 @@ +# How to add your own keymap + +Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: + + _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] + +\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements + +and contain the following files: + +* `keymap.c` +* `readme.md` *recommended* +* `config.h` *optional*, found automatically when compiling +* `Makefile` *optional*, found automatically when compling + +When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: + + * **folder_name** description + +# List of Promethium keymaps + + diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c new file mode 100644 index 000000000..a0035cce1 --- /dev/null +++ b/keyboards/handwired/promethium/promethium.c @@ -0,0 +1,6 @@ +#include "promethium.h" + +void matrix_init_kb(void) { + + matrix_init_user(); +} \ No newline at end of file diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h new file mode 100644 index 000000000..fb0dc1683 --- /dev/null +++ b/keyboards/handwired/promethium/promethium.h @@ -0,0 +1,99 @@ +#ifndef PROMETHIUM_H +#define PROMETHIUM_H + +#include "quantum.h" + +#define KEYMAP( \ + k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ + k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ + k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ + k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \ +) \ +{ \ + {k11, k12, k13, k14, k15, k16}, \ + {k21, k22, k23, k24, k25, k26}, \ + {k31, k32, k33, k34, k35, k36}, \ + {k41, k42, k43, k44, k45, k46}, \ + {k17, k18, k19, k1a, k1b, k1c}, \ + {k27, k28, k29, k2a, k2b, k2c}, \ + {k37, k38, k39, k3a, k3b, k3c}, \ + {k47, k48, k49, k4a, k4b, k4c} \ +} + +enum led_sequence { + LED_IND_EMOJI, + LED_IND_NUM, + LED_IND_FUNC, + + LED_IND_BATTERY, + LED_IND_USB, + LED_IND_BLUETOOTH, + + LED_TAB, + LED_ESC, + LED_LSFT, + LED_LCTL, + + LED_LGUI, + LED_Z, + LED_A, + LED_Q, + + LED_W, + LED_S, + LED_X, + LED_LALT, + + LED_PUNC, + LED_C, + LED_D, + LED_E, + + LED_R, + LED_F, + LED_V, + LED_NUM, + + LED_LSPC, + LED_B, + LED_G, + LED_T, + + LED_TRACKPOINT1, + LED_TRACKPOINT2, + LED_TRACKPOINT3, + + LED_RSPC, + LED_N, + LED_HH, + LED_Y, + + LED_U, + LED_J, + LED_M, + LED_FUNC, + + LED_EMOJI, + LED_COMM, + LED_K, + LED_I, + + LED_O, + LED_L, + LED_DOT, + LED_RALT, + + LED_RGUI, + LED_SLSH, + LED_SCLN, + LED_P, + + LED_BKSP, + LED_ENT, + LED_RSFT, + LED_RCTL +}; + +#endif + + diff --git a/keyboards/handwired/promethium/readme.md b/keyboards/handwired/promethium/readme.md new file mode 100644 index 000000000..64e2c3a16 --- /dev/null +++ b/keyboards/handwired/promethium/readme.md @@ -0,0 +1,12 @@ +Promethium Keyboard Firmware +============================ +A handwired Planck based keyboard using the Adafruit Feather 32u4 Bluefruit LE controller. + +Features: + +* Single piece split form factor +* Vertical staggered +* Trackpoint +* Bluetooth LE *TBD* +* Battery +* Per switch RGB LED \ No newline at end of file diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c new file mode 100644 index 000000000..ea922ec3f --- /dev/null +++ b/keyboards/handwired/promethium/rgbsps.c @@ -0,0 +1,24 @@ +#include "light_ws2812.h" +#include "rgbsps.h" + +struct cRGB led[RGBSPS_NUM]; + +void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) { + led[index].r = r; + led[index].g = g; + led[index].b = b; +} + +void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b) { + for (uint16_t i = 0; i < RGBSPS_NUM; i++) { + rgbsps_set(i, r, g, b); + } +} + +void rgbsps_turnoff(void) { + rgbsps_setall(0, 0, 0); +} + +void rgbsps_send(void) { + ws2812_setleds(led, RGBSPS_NUM); +} \ No newline at end of file diff --git a/keyboards/handwired/promethium/rgbsps.h b/keyboards/handwired/promethium/rgbsps.h new file mode 100644 index 000000000..6da197f75 --- /dev/null +++ b/keyboards/handwired/promethium/rgbsps.h @@ -0,0 +1,4 @@ +void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b); +void rgbsps_setall(uint8_t r, uint8_t g, uint8_t b); +void rgbsps_turnoff(void); +void rgbsps_send(void); \ No newline at end of file diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk new file mode 100644 index 000000000..835b13c4f --- /dev/null +++ b/keyboards/handwired/promethium/rules.mk @@ -0,0 +1,75 @@ + +# MCU name +#MCU = at90usb1287 +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 = 8000000 + +# +# 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 +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration +NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +UNICODEMAP_ENABLE = yes +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +PS2_MOUSE_ENABLE ?= yes +PS2_USE_INT ?= yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +include $(TMK_DIR)/protocol.mk +SRC += $(QUANTUM_DIR)/light_ws2812.c +SRC += rgbsps.c \ No newline at end of file From b5019bef055d3b3a90b8b42268b9ad874600782b Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:44:50 +0700 Subject: [PATCH 20/25] change init delay to 2000ms --- keyboards/handwired/promethium/promethium.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/handwired/promethium/promethium.h b/keyboards/handwired/promethium/promethium.h index fb0dc1683..8f2a8c3be 100644 --- a/keyboards/handwired/promethium/promethium.h +++ b/keyboards/handwired/promethium/promethium.h @@ -3,6 +3,8 @@ #include "quantum.h" +#define PS2_INIT_DELAY 2000 + #define KEYMAP( \ k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ From 7f3c9c6a395a921d2914fc5cac1ac8f9441c33eb Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:46:05 +0700 Subject: [PATCH 21/25] protocols.mk is already included in latest QMK --- keyboards/handwired/promethium/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 835b13c4f..0842780cc 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -70,6 +70,5 @@ PS2_USE_INT ?= yes # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend -include $(TMK_DIR)/protocol.mk SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += rgbsps.c \ No newline at end of file From 0f39ab52192c0e34f0aea5ff6bb1fa2ded427b6e Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 26 Nov 2016 13:47:03 +0700 Subject: [PATCH 22/25] remove ifdef on chip type --- keyboards/handwired/promethium/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index 5a2afe6ab..473af67d3 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -116,7 +116,6 @@ along with this program. If not, see . /* PS/2 mouse USART version */ #ifdef PS2_USE_USART -#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) /* XCK for clock line and RXD for data line */ #define PS2_CLOCK_PORT PORTD #define PS2_CLOCK_PIN PIND @@ -158,7 +157,6 @@ along with this program. If not, see . #define PS2_USART_ERROR (UCSR1A & ((1< Date: Sat, 26 Nov 2016 23:53:15 +0700 Subject: [PATCH 23/25] fix strict-prototypes warning --- quantum/process_keycode/process_unicode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h index 065eeb5f6..f17cfa6cf 100644 --- a/quantum/process_keycode/process_unicode.h +++ b/quantum/process_keycode/process_unicode.h @@ -22,6 +22,7 @@ void register_hex(uint16_t hex); bool process_unicode(uint16_t keycode, keyrecord_t *record); #ifdef UNICODEMAP_ENABLE +void unicode_map_input_error(void); bool process_unicode_map(uint16_t keycode, keyrecord_t *record); #endif From a182cbc0319d54122e12dfa48e782e8e122c7df6 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sun, 27 Nov 2016 00:34:29 +0700 Subject: [PATCH 24/25] Update Unicode documentation --- readme.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 3eb67882a..cd65e0e69 100644 --- a/readme.md +++ b/readme.md @@ -911,7 +911,33 @@ In `quantum/keymap_extras/`, you'll see various language files - these work the ## Unicode support -You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout, see [this article](http://www.poynton.com/notes/misc/mac-unicode-hex-input.html) to learn more) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. +There are three Unicode keymap definition method available in QMK: + +### UNICODE_ENABLE + +Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in +keymap file, where *n* is a 4 digit hexadecimal. + +### UNICODEMAP_ENABLE + +Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping +table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. +The keycode function is `X(n)` where *n* is the array index of the mapping +table. + +### UCIS_ENABLE + +TBD + +Unicode input in QMK works by inputing a sequence of characters to the OS, +sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted. + +This is the current list of Unicode input method in QMK: + +* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex. +* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else. +* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead. +* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows. ## Backlight Breathing From 12c1314b024b0e24dc561d8f8816561a4ca8ff42 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sun, 27 Nov 2016 00:40:31 +0700 Subject: [PATCH 25/25] update docs --- keyboards/handwired/promethium/readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keyboards/handwired/promethium/readme.md b/keyboards/handwired/promethium/readme.md index 64e2c3a16..e63d2f1ad 100644 --- a/keyboards/handwired/promethium/readme.md +++ b/keyboards/handwired/promethium/readme.md @@ -5,8 +5,9 @@ A handwired Planck based keyboard using the Adafruit Feather 32u4 Bluefruit LE c Features: * Single piece split form factor -* Vertical staggered +* Columnar stagger * Trackpoint * Bluetooth LE *TBD* * Battery -* Per switch RGB LED \ No newline at end of file +* Per switch RGB LED +* Proximity sensor for energy conservation *TBD* \ No newline at end of file