diff --git a/build_keyboard.mk b/build_keyboard.mk index c1e554003..ce505de12 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -213,6 +213,7 @@ endif VPATH += $(KEYBOARD_PATH) VPATH += $(COMMON_VPATH) +include $(TMK_PATH)/protocol.mk include $(TMK_PATH)/common.mk SRC += $(TMK_COMMON_SRC) 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..473af67d3 --- /dev/null +++ b/keyboards/handwired/promethium/config.h @@ -0,0 +1,162 @@ +/* +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..8f2a8c3be --- /dev/null +++ b/keyboards/handwired/promethium/promethium.h @@ -0,0 +1,101 @@ +#ifndef PROMETHIUM_H +#define PROMETHIUM_H + +#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, \ + 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..e63d2f1ad --- /dev/null +++ b/keyboards/handwired/promethium/readme.md @@ -0,0 +1,13 @@ +Promethium Keyboard Firmware +============================ +A handwired Planck based keyboard using the Adafruit Feather 32u4 Bluefruit LE controller. + +Features: + +* Single piece split form factor +* Columnar stagger +* Trackpoint +* Bluetooth LE *TBD* +* Battery +* Per switch RGB LED +* Proximity sensor for energy conservation *TBD* \ 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..0842780cc --- /dev/null +++ b/keyboards/handwired/promethium/rules.mk @@ -0,0 +1,74 @@ + +# 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 + +SRC += $(QUANTUM_DIR)/light_ws2812.c +SRC += rgbsps.c \ No newline at end of file diff --git a/quantum/config_common.h b/quantum/config_common.h index f3897dc2c..17c11faeb 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -77,53 +77,7 @@ } while(0) # else # error "USART configuration is needed." -#endif - -// I'm fairly sure these aren't needed, but oh well - Jack - -/* - * 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< +#define JP_QUES KC_QUES // ? + + +#endif 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 diff --git a/readme.md b/readme.md index 18ad1a794..a92ae4c1d 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 @@ -1157,6 +1183,135 @@ 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. + +Then, decide whether to use USART (best), interrupts (better) or busywait (not recommended), and enable the relevant option. + +### Busywait version + +Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. + +In rules.mk: + +``` +PS2_MOUSE_ENABLE = yes +PS2_USE_BUSYWAIT = yes +``` + +In your keyboard config.h: + +``` +#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 +``` + +### Interrupt version + +The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data. + +In rules.mk: + +``` +PS2_MOUSE_ENABLE = yes +PS2_USE_INT = yes +``` + +In your keyboard config.h: + +``` +#ifdef PS2_USE_INT +#define PS2_CLOCK_PORT PORTD +#define PS2_CLOCK_PIN PIND +#define PS2_CLOCK_DDR DDRD +#define PS2_CLOCK_BIT 2 +#define PS2_DATA_PORT PORTD +#define PS2_DATA_PIN PIND +#define PS2_DATA_DDR DDRD +#define PS2_DATA_BIT 5 + +#define PS2_INT_INIT() do { \ + EICRA |= ((1< * 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,19 +100,19 @@ 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) {} __attribute__ ((weak)) void matrix_power_down(void) {} bool suspend_wakeup_condition(void) { -#ifdef BACKLIGHT_ENABLE - backlight_set(0); -#endif matrix_power_up(); matrix_scan(); matrix_power_down(); @@ -126,10 +128,9 @@ void suspend_wakeup_init(void) // clear keyboard state clear_keyboard(); #ifdef BACKLIGHT_ENABLE - backlight_set(0); backlight_init(); #endif -led_set(host_keyboard_leds()); + led_set(host_keyboard_leds()); } #ifndef NO_SUSPEND_POWER_DOWN 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); } 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);