From 93b2f23bba16348e2ea5d8c83d928e3a45e2b7cc Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 19 Apr 2017 01:38:08 +0700 Subject: Promethium rev2 * 10 more indicator LEDs * Piezo buzzer * Uses HC138 decoder to free up 5 pins * Trackpoint buttons are now part of matrix --- keyboards/handwired/promethium/config.h | 37 ++- .../handwired/promethium/keymaps/priyadi/Makefile | 1 + .../handwired/promethium/keymaps/priyadi/keymap.c | 48 ++-- keyboards/handwired/promethium/matrix.c | 306 +++++++++++++++++++++ keyboards/handwired/promethium/promethium.c | 5 + keyboards/handwired/promethium/rules.mk | 4 +- 6 files changed, 372 insertions(+), 29 deletions(-) create mode 100644 keyboards/handwired/promethium/matrix.c (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index 24f02993f..a13406b0d 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -35,12 +35,13 @@ along with this program. If not, see . #define DESCRIPTION /* key matrix size */ -#define MATRIX_ROWS 8 #define MATRIX_COLS 6 +#define MATRIX_ROWS 9 /* 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 MATRIX_COL_PINS { F4, F1, F0, D6, D0, D1 } +#define MATRIX_ROW_PINS { F5, F6, F7 } +#define TRACKPOINT_PINS { B7, B6, D7 } #define UNUSED_PINS /* @@ -152,17 +153,20 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#define PS2_INIT_DELAY 2000 +#define PS2_INIT_DELAY 3000 #define BATTERY_PIN 9 #define BATTERY_POLL 30000 #define MAX_VOLTAGE 4.2 #define MIN_VOLTAGE 3.2 +#define ___ KC_NO + #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, 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, \ + tp1, tp2, tp3 \ ) \ { \ {k11, k12, k13, k14, k15, k16}, \ @@ -172,18 +176,29 @@ along with this program. If not, see . {k17, k18, k19, k1a, k1b, k1c}, \ {k27, k28, k29, k2a, k2b, k2c}, \ {k37, k38, k39, k3a, k3b, k3c}, \ - {k47, k48, k49, k4a, k4b, k4c} \ + {k47, k48, k49, k4a, k4b, k4c}, \ + {tp1, tp2, tp3, ___, ___, ___} \ } #ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file enum led_sequence { + LED_IND_LINUX, + LED_IND_APPLE, + LED_IND_WINDOWS, + LED_IND_QWERTY, + LED_IND_ALT, + LED_IND_AUDIO, LED_IND_BLUETOOTH, LED_IND_USB, - LED_IND_BATTERY, + LED_IND_BATTERY, + LED_IND_CAPSLOCK, + LED_IND_GUI, LED_IND_FUN, LED_IND_NUM, + LED_IND_PUNC, LED_IND_EMOJI, + LED_IND_GREEK, LED_BKSP, LED_ENT, @@ -261,7 +276,7 @@ enum led_sequence { # define PS2_CLOCK_PORT PORTD # define PS2_CLOCK_PIN PIND # define PS2_CLOCK_DDR DDRD -# define PS2_CLOCK_BIT 1 +# define PS2_CLOCK_BIT 3 # define PS2_DATA_PORT PORTD # define PS2_DATA_PIN PIND # define PS2_DATA_DDR DDRD diff --git a/keyboards/handwired/promethium/keymaps/priyadi/Makefile b/keyboards/handwired/promethium/keymaps/priyadi/Makefile index 46fdfa011..e3428254f 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/Makefile +++ b/keyboards/handwired/promethium/keymaps/priyadi/Makefile @@ -19,6 +19,7 @@ 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 +FAUXCLICKY_ENABLE = 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 diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index cf7c67339..61af0a889 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -574,7 +574,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT , KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, C_RALT, KC_RCTL + KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, C_RALT, KC_RCTL, + _______, _______, _______ ), /* Dvorak @@ -593,7 +594,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, _______, _______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, _______, _______, KC_SLSH, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), #endif @@ -614,7 +616,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______, _______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), #endif @@ -635,7 +638,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_J, KC_U, KC_R, KC_L, KC_QUOT, _______, _______, KC_A, KC_S, KC_E, KC_T, KC_G, KC_Y, KC_N, KC_I, KC_O, KC_H, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), #endif @@ -656,7 +660,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______, _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______, _______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), #endif @@ -675,7 +680,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, X(LTEQ), X(GTEQ), _______, KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, X(NOTEQ),KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, _______, KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, X(PLMIN),KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______, + _______, _______, _______ ), /* Num @@ -690,10 +696,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_NUM] = KEYMAP( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), _______, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_1, KC_2, KC_3, S(KC_D), _______, KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______, - KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), _______, - _______, _______, KC_X, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_COLN, _______ + KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_7, KC_8, KC_9, S(KC_F), _______, + _______, _______, KC_X, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_COLN, _______, + _______, _______, _______ ), /* Func @@ -711,7 +718,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_INS, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL, KC_CAPS, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), /* Uppercase Greek @@ -729,7 +737,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, XXXXXXX, XXXXXXX,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______, _______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), KC_QUOT, _______, _______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), /* Lowercase Greek @@ -747,7 +756,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, XXXXXXX,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______, _______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), KC_QUOT, _______, _______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), KC_COMM, KC_DOT, KC_SLSH, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), /* Empty @@ -765,7 +775,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______ ), /* Emoji @@ -783,7 +794,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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) + X(POO), X(EYES), X(HUNRD),_______, X(SKULL),X(HORNS), X(HALO), X(FEAR),_______,X(YUMMY),X(DISAP),X(NOEVK), + _______, _______, _______ ), /* GUI @@ -801,7 +813,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX, KC_ESC, XXXXXXX, S(KC_TAB),KC_ESC, KC_TAB, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, KC_SPC, KC_SPC, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, _______ ), /* Sys @@ -816,10 +829,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_SYS] = KEYMAP( - XXXXXXX, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + DEBUG, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, FC_TOG, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______ ), diff --git a/keyboards/handwired/promethium/matrix.c b/keyboards/handwired/promethium/matrix.c new file mode 100644 index 000000000..2b7ce2bf5 --- /dev/null +++ b/keyboards/handwired/promethium/matrix.c @@ -0,0 +1,306 @@ +/* +Copyright 2012 Jun Wako +Copyright 2014 Jack Humbert +Copyright 2017 Priyadi Iman Nurcahyo + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include +#include +#if defined(__AVR__) +#include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" + + +/* Set 0 if debouncing isn't needed */ + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif + +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop16(matrix[i]) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop32(matrix[i]) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +#ifdef MATRIX_MASKED + extern const matrix_row_t matrix_mask[]; +#endif + +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +static const uint8_t tp_pins[3] = TRACKPOINT_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static void init_cols(void); +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); +static void unselect_rows(void); +static void select_row(uint8_t row); +static void unselect_row(uint8_t row); + +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) { + return MATRIX_COLS; +} + +void matrix_init(void) { + + // To use PORTF disable JTAG with writing JTD bit twice within four cycles. + #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__)) + MCUCR |= _BV(JTD); + MCUCR |= _BV(JTD); + #endif + + // initialize row and col + unselect_rows(); + init_cols(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); +} + +uint8_t matrix_scan(void +){ + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } + +# else + read_cols_on_row(matrix, current_row); +# endif + + } + +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + debouncing = false; + } +# endif + + matrix_scan_quantum(); + return 1; +} + +bool matrix_is_modified(void) +{ +#if (DEBOUNCING_DELAY > 0) + if (debouncing) return false; +#endif + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) + +{ + return (matrix[row] & ((matrix_row_t)1> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } + + // rows + DDRF |= ROW_MASK; + PORTF &= ~ROW_MASK; + + // trackpoint + for(uint8_t x = 0; x < 3; x++) { + uint8_t pin = tp_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) + { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // special case for trackpoint + if (current_row == 8) { + for(uint8_t tp_index = 0; tp_index < 3; tp_index++) { + + // Select the TP pin to read (active low) + uint8_t pin = tp_pins[tp_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << tp_index); + } + return (last_row_value != current_matrix[current_row]); + } + + // Select row and wait for row selecton to stabilize + select_row(current_row); + _delay_us(5); // without this wait it won't read stable value. + // wait_us(50); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + PORTF = row_bit[row] | (PORTF & ~ROW_MASK); +} + +static void unselect_row(uint8_t row) +{ +} + +static void unselect_rows(void) +{ +} + diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index 4943f8c9f..8b1a0c71f 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -2,6 +2,11 @@ #include "analog.h" #include "timer.h" #include "matrix.h" +#include "musical_notes.h" + +float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, .03125); +float fauxclicky_released_note[2] = MUSICAL_NOTE(_C3, .03125); +float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, .03125); // cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100} diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index e75cf4dde..a5e503ff7 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -67,10 +67,12 @@ PS2_MOUSE_ENABLE ?= yes PS2_USE_INT ?= yes ADAFRUIT_BLE_ENABLE ?= yes API_SYSEX_ENABLE ?= no +CUSTOM_MATRIX ?= 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 -SRC += $(QUANTUM_DIR)/analog.c \ No newline at end of file +SRC += $(QUANTUM_DIR)/analog.c +SRC += matrix.c -- cgit v1.2.3 From 3fa0b66289770ccc4d8a5b39eaf66ff3b7c67529 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 19 Apr 2017 02:52:57 +0700 Subject: Keymap updates and some adjustment for latest version of QMK --- .../handwired/promethium/keymaps/priyadi/Makefile | 1 + .../handwired/promethium/keymaps/priyadi/README.md | 4 +- .../handwired/promethium/keymaps/priyadi/keymap.c | 142 ++++++++++++++++++--- keyboards/handwired/promethium/rules.mk | 2 +- 4 files changed, 125 insertions(+), 24 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/Makefile b/keyboards/handwired/promethium/keymaps/priyadi/Makefile index e3428254f..bd1a06734 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/Makefile +++ b/keyboards/handwired/promethium/keymaps/priyadi/Makefile @@ -20,6 +20,7 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this PS2_MOUSE_ENABLE = yes PS2_USE_INT = yes FAUXCLICKY_ENABLE = yes +BLUETOOTH = AdafruitBLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/handwired/promethium/keymaps/priyadi/README.md b/keyboards/handwired/promethium/keymaps/priyadi/README.md index ddeaed939..48824b9f7 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/README.md +++ b/keyboards/handwired/promethium/keymaps/priyadi/README.md @@ -37,8 +37,8 @@ On Promethium, USB or Bluetooth output is detected on startup. If USB is connect SYS-W, SYS-L, SYS-M switch Unicode input method. SYS-Q, SYS-D, SYS-C, SYS-K, SYS-N switch to QWERTY, DVORAK, Colemak, Workman and Norman, respectively. -On Planck, SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases. +SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases. -On Promethium there are 6 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 57 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes. +On Promethium there are 16 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 67 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes. On Promethium, there's a LED to indicate battery level. Hue indicates level: green is full, red is empty. \ No newline at end of file diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 61af0a889..55e028f18 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -38,6 +38,19 @@ along with this program. If not, see . #endif #ifdef FAUXCLICKY_ENABLE #include "fauxclicky.h" +#ifdef RGBSPS_ENABLE +#undef FAUXCLICKY_OFF +#define FAUXCLICKY_OFF do { \ + fauxclicky_enabled = false; \ + rgbsps_set(LED_AUDIO, 0, 0, 0); \ + fauxclicky_stop(); \ +} while (0) +#undef FAUXCLICKY_ON +#define FAUXCLICKY_ON do { \ + fauxclicky_enabled = true; \ + rgbsps_set(LED_AUDIO, 8, 0, 8); \ +} while (0) +#endif #endif #include "outputselect.h" #include "led.h" @@ -128,8 +141,8 @@ enum planck_keycodes { #ifndef FAUXCLICKY_ENABLE FC_TOG, #endif -#ifndef ADAFRUIT_BLE_ENABLE - OUT_BLE, +#ifndef MODULE_ADAFRUIT_BLE + OUT_BT, #endif KEYCODE_END }; @@ -428,12 +441,23 @@ const uint8_t PROGMEM LED_FN[] = { }; const uint8_t PROGMEM LED_INDICATORS[] = { - LED_IND_EMOJI, - LED_IND_NUM, - LED_IND_FUN, - LED_IND_BATTERY, - LED_IND_USB, + LED_IND_LINUX, + LED_IND_APPLE, + LED_IND_WINDOWS, + LED_IND_QWERTY, + LED_IND_ALT, + LED_IND_AUDIO, LED_IND_BLUETOOTH, + LED_IND_USB, + + LED_IND_BATTERY, + LED_IND_CAPSLOCK, + LED_IND_GUI, + LED_IND_FUN, + LED_IND_NUM, + LED_IND_PUNC, + LED_IND_EMOJI, + LED_IND_GREEK, }; const uint8_t PROGMEM LED_TRACKPOINT[] = { @@ -486,15 +510,31 @@ void led_reset(void) { } } +void led_set_default_layer_indicator(void) { + uint8_t default_layer = biton32(default_layer_state); + if (default_layer == _QWERTY) { + rgbsps_set(LED_IND_QWERTY, 15, 10, 0); + rgbsps_set(LED_IND_ALT, 0, 0, 0); + } else { + rgbsps_set(LED_IND_QWERTY, 0, 0, 0); + rgbsps_set(LED_IND_ALT, 15, 10, 0); + } + rgbsps_send(); + return; +} + void led_set_layer_indicator(void) { static uint8_t oldlayer = 255; + led_reset(); + + rgbsps_set(LED_IND_GUI, 0, 0, 0); rgbsps_set(LED_IND_FUN, 0, 0, 0); - // rgbsps_set(LED_IND_NUM, 0, 0, 0); + rgbsps_set(LED_IND_NUM, 0, 0, 0); + rgbsps_set(LED_IND_PUNC, 0, 0, 0); + rgbsps_set(LED_IND_GREEK, 0, 0, 0); rgbsps_set(LED_IND_EMOJI, 0, 0, 0); - led_reset(); - uint8_t layer = biton32(layer_state); if (oldlayer == layer) { return; @@ -508,24 +548,57 @@ void led_set_layer_indicator(void) { } switch(layer) { + case _GUI: + rgbsps_set(LED_IND_GUI, 15, 0, 15); + break; case _FUN: rgbsps_set(LED_IND_FUN, 15, 0, 0); break; - // case _NUM: - // rgbsps_set(LED_IND_NUM, 0, 0, 15); - // break; + case _NUM: + rgbsps_set(LED_IND_NUM, 0, 0, 15); + break; + case _PUNC: + rgbsps_set(LED_IND_PUNC, 0, 15, 0); + break; + case _GREEKL: + case _GREEKU: + rgbsps_set(LED_IND_GREEK, 0, 15, 15); + break; case _EMOJI: rgbsps_set(LED_IND_EMOJI, 15, 15, 0); break; default: + rgbsps_set(LED_IND_GUI, 3, 3, 3); rgbsps_set(LED_IND_FUN, 3, 3, 3); - // rgbsps_set(LED_IND_NUM, 3, 3, 3); + rgbsps_set(LED_IND_NUM, 3, 3, 3); + rgbsps_set(LED_IND_PUNC, 3, 3, 3); + rgbsps_set(LED_IND_GREEK, 3, 3, 3); rgbsps_set(LED_IND_EMOJI, 3, 3, 3); } rgbsps_send(); } +void led_set_unicode_input_mode(void) { + rgbsps_set(LED_IND_LINUX, 0, 0, 0); + rgbsps_set(LED_IND_APPLE, 0, 0, 0); + rgbsps_set(LED_IND_WINDOWS, 0, 0, 0); + + switch (get_unicode_input_mode()) { + case UC_LNX: + rgbsps_set(LED_IND_LINUX, 15, 15, 15); + break; + case UC_OSX: + rgbsps_set(LED_IND_APPLE, 15, 15, 15); + break; + case UC_WIN: + case UC_WINC: + rgbsps_set(LED_IND_WINDOWS, 15, 15, 15); + break; + } + rgbsps_send(); +} + void led_set_output_ble(void) { rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); rgbsps_set(LED_IND_USB, 0, 0, 0); @@ -552,7 +625,16 @@ void led_init(void) { rgbsps_set(LED_TRACKPOINT1, 15, 0, 0); rgbsps_set(LED_TRACKPOINT2, 0, 0, 15); rgbsps_set(LED_TRACKPOINT3, 15, 0, 0); + + // unicode input mode + led_set_unicode_input_mode(); + + // layer indicator + led_set_layer_indicator(); + led_set_default_layer_indicator(); } + + #endif // RGBSPS_ENABLE // keymaps @@ -831,7 +913,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_SYS] = KEYMAP( DEBUG, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, FC_TOG, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BT, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______ ), @@ -842,6 +924,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void persistant_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); + led_set_default_layer_indicator(); } #ifdef DOUBLESPACE_LAYER_ENABLE @@ -1086,14 +1169,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // OS switchers case LINUX: set_unicode_input_mode(UC_LNX); +#ifdef RGBSPS_ENABLE + led_set_unicode_input_mode(); +#endif return false; break; case WIN: set_unicode_input_mode(UC_WINC); +#ifdef RGBSPS_ENABLE + led_set_unicode_input_mode(); +#endif return false; break; case OSX: set_unicode_input_mode(UC_OSX); +#ifdef RGBSPS_ENABLE + led_set_unicode_input_mode(); +#endif return false; break; @@ -1115,6 +1207,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // faux clicky indicator #ifdef FAUXCLICKY_ENABLE case FC_TOG: +#ifdef RGBSPS_ENABLE + if (fauxclicky_enabled) { + rgbsps_set(LED_IND_AUDIO, 0, 0, 0); + } else { + rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + } + rgbsps_send(); +#endif return true; break; #endif @@ -1123,12 +1223,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } void set_output_user(uint8_t output) { -#ifdef ADAFRUIT_BLE_ENABLE +#ifdef MODULE_ADAFRUIT_BLE switch(output) { case OUTPUT_USB: led_set_output_usb(); break; - case OUTPUT_ADAFRUIT_BLE: + case OUTPUT_BLUETOOTH: led_set_output_ble(); break; default: @@ -1147,12 +1247,12 @@ void matrix_init_user() { #endif // auto detect output on init -#ifdef ADAFRUIT_BLE_ENABLE +#ifdef MODULE_ADAFRUIT_BLE uint8_t output = auto_detect_output(); if (output == OUTPUT_USB) { set_output(OUTPUT_USB); } else { - set_output(OUTPUT_ADAFRUIT_BLE); + set_output(OUTPUT_BLUETOOTH); } #endif } @@ -1178,9 +1278,9 @@ void turn_off_capslock() { bool new_capslock = usb_led & (1< Date: Wed, 19 Apr 2017 02:55:19 +0700 Subject: Fix Planck compatibility --- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 55e028f18..efa5d9756 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -924,7 +924,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void persistant_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); +#ifdef RGBSPS_ENABLE led_set_default_layer_indicator(); +#endif } #ifdef DOUBLESPACE_LAYER_ENABLE -- cgit v1.2.3 From ce0efa6b9a92387af395fded796e8ccb8927b52d Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 19 Apr 2017 12:03:48 +0700 Subject: Fix LED sequence; bug fixes --- keyboards/handwired/promethium/config.h | 12 ++++++------ keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index a13406b0d..04f7caa55 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -205,7 +205,7 @@ enum led_sequence { LED_RSFT, LED_RCTL, - LED_RGUI, + LED_RALT, LED_SLSH, LED_SCLN, LED_P, @@ -213,9 +213,9 @@ enum led_sequence { LED_O, LED_L, LED_DOT, - LED_RALT, + LED_RGUI, - LED_EMOJI, + LED_GREEK, LED_COMM, LED_K, LED_I, @@ -244,7 +244,7 @@ enum led_sequence { LED_V, LED_NUM, - LED_PUNC, + LED_EMPTY, LED_C, LED_D, LED_E, @@ -252,9 +252,9 @@ enum led_sequence { LED_W, LED_S, LED_X, - LED_LALT, - LED_LGUI, + + LED_LALT, LED_Z, LED_A, LED_Q, diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index efa5d9756..7a18b02fd 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -434,10 +434,10 @@ const uint8_t PROGMEM LED_MODS[] = { }; const uint8_t PROGMEM LED_FN[] = { - LED_PUNC, + LED_EMPTY, LED_NUM, LED_FUN, - LED_EMOJI + LED_GREEK }; const uint8_t PROGMEM LED_INDICATORS[] = { @@ -632,6 +632,14 @@ void led_init(void) { // layer indicator led_set_layer_indicator(); led_set_default_layer_indicator(); + + // clicky + if (fauxclicky_enabled) { + rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + } else { + rgbsps_set(LED_IND_AUDIO, 0, 0, 0); + } + rgbsps_send(); } @@ -1211,9 +1219,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case FC_TOG: #ifdef RGBSPS_ENABLE if (fauxclicky_enabled) { - rgbsps_set(LED_IND_AUDIO, 0, 0, 0); - } else { rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + } else { + rgbsps_set(LED_IND_AUDIO, 0, 0, 0); } rgbsps_send(); #endif -- cgit v1.2.3 From f9d226ca50ba243133847d19893d2c3b844eec12 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 19 Apr 2017 12:35:05 +0700 Subject: tune clicks --- keyboards/handwired/promethium/promethium.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index 8b1a0c71f..544e94be5 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -4,9 +4,9 @@ #include "matrix.h" #include "musical_notes.h" -float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, .03125); -float fauxclicky_released_note[2] = MUSICAL_NOTE(_C3, .03125); -float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, .03125); +float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_C5, 0.25); +float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.25); +float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25); // cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100} -- cgit v1.2.3 From d8f1949029297b0bec395606bbaedf4f6d4c0760 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sat, 29 Apr 2017 13:21:27 +0700 Subject: Promethium update: demo LED, fix PS2 delay, fix LED ordering, change click frequency --- keyboards/handwired/promethium/config.h | 38 +++++++++++----------- .../handwired/promethium/keymaps/priyadi/config.h | 1 + .../handwired/promethium/keymaps/priyadi/keymap.c | 34 ++++++++++++++++++- keyboards/handwired/promethium/promethium.c | 4 +-- 4 files changed, 55 insertions(+), 22 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h index 04f7caa55..efb9ebdd7 100644 --- a/keyboards/handwired/promethium/config.h +++ b/keyboards/handwired/promethium/config.h @@ -153,7 +153,7 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#define PS2_INIT_DELAY 3000 +#define PS2_MOUSE_INIT_DELAY 2000 #define BATTERY_PIN 9 #define BATTERY_POLL 30000 #define MAX_VOLTAGE 4.2 @@ -234,35 +234,35 @@ enum led_sequence { LED_TRACKPOINT2, LED_TRACKPOINT1, - LED_LSPC, - LED_B, - LED_G, LED_T, + LED_G, + LED_B, + LED_LSPC, - LED_R, - LED_F, - LED_V, LED_NUM, + LED_V, + LED_F, + LED_R, - LED_EMPTY, - LED_C, - LED_D, LED_E, + LED_D, + LED_C, + LED_EMPTY, - LED_W, - LED_S, - LED_X, LED_LGUI, + LED_X, + LED_S, + LED_W, - LED_LALT, - LED_Z, - LED_A, LED_Q, + LED_A, + LED_Z, + LED_LALT, - LED_TAB, - LED_ESC, - LED_LSFT, LED_LCTL, + LED_LSFT, + LED_ESC, + LED_TAB, LED_TOTAL }; diff --git a/keyboards/handwired/promethium/keymaps/priyadi/config.h b/keyboards/handwired/promethium/keymaps/priyadi/config.h index 3f5dd5817..fa86e2247 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/config.h +++ b/keyboards/handwired/promethium/keymaps/priyadi/config.h @@ -14,6 +14,7 @@ #define PREVENT_STUCK_MODIFIERS #define RGBSPS_ENABLE +#define RGBSPS_DEMO_ENABLE #define UNICODE_TYPE_DELAY 0 diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 7a18b02fd..4cc3d6d60 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -144,6 +144,7 @@ enum planck_keycodes { #ifndef MODULE_ADAFRUIT_BLE OUT_BT, #endif + RGBDEMO, KEYCODE_END }; @@ -478,6 +479,27 @@ void led_turnoff_keys(void) { } } +#ifdef RGBSPS_DEMO_ENABLE +void led_demo(void) { + rgbsps_set(LED_IND_LINUX, 15, 15, 15); + rgbsps_set(LED_IND_APPLE, 15, 15, 15); + rgbsps_set(LED_IND_WINDOWS, 15, 15, 15); + rgbsps_set(LED_IND_QWERTY, 15, 10, 0); + rgbsps_set(LED_IND_ALT, 15, 10, 0); + rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); + rgbsps_set(LED_IND_USB, 15, 15, 15); + rgbsps_set(LED_IND_CAPSLOCK, 15, 0, 0); + rgbsps_set(LED_IND_GUI, 15, 0, 15); + rgbsps_set(LED_IND_FUN, 15, 0, 0); + rgbsps_set(LED_IND_NUM, 0, 0, 15); + rgbsps_set(LED_IND_PUNC, 0, 15, 0); + rgbsps_set(LED_IND_GREEK, 0, 15, 15); + rgbsps_set(LED_IND_EMOJI, 15, 15, 0); + rgbsps_send(); +} +#endif + void led_reset(void) { switch (glow_mode) { case GLOW_NONE: @@ -634,11 +656,14 @@ void led_init(void) { led_set_default_layer_indicator(); // clicky +#ifdef FAUXCLICKY_ENABLE if (fauxclicky_enabled) { rgbsps_set(LED_IND_AUDIO, 5, 11, 13); } else { rgbsps_set(LED_IND_AUDIO, 0, 0, 0); } +#endif + rgbsps_send(); } @@ -919,7 +944,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_SYS] = KEYMAP( - DEBUG, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + DEBUG, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, RGBDEMO, XXXXXXX, FC_TOG, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BT, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, @@ -1228,6 +1253,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; break; #endif + +#ifdef RGBSPS_DEMO_ENABLE + case RGBDEMO: + led_demo(); + return false; + break; +#endif } return true; } diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c index 544e94be5..3cc0f5a8c 100644 --- a/keyboards/handwired/promethium/promethium.c +++ b/keyboards/handwired/promethium/promethium.c @@ -4,8 +4,8 @@ #include "matrix.h" #include "musical_notes.h" -float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_C5, 0.25); -float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.25); +float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A4, 0.0625); +float fauxclicky_released_note[2] = MUSICAL_NOTE(_A4, 0.0625); float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25); // cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100} -- cgit v1.2.3 From 2f28652dcc22c74db4f3c60537fa07f6774451f9 Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sun, 30 Apr 2017 18:03:03 +0700 Subject: Syntax fix --- keyboards/handwired/promethium/matrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/matrix.c b/keyboards/handwired/promethium/matrix.c index 2b7ce2bf5..72dbe8d4d 100644 --- a/keyboards/handwired/promethium/matrix.c +++ b/keyboards/handwired/promethium/matrix.c @@ -133,8 +133,8 @@ void matrix_init(void) { matrix_init_quantum(); } -uint8_t matrix_scan(void -){ +uint8_t matrix_scan(void) +{ // Set row, read cols for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { # if (DEBOUNCING_DELAY > 0) -- cgit v1.2.3 From 343f8d368e7ce51a3b34705147b890445a12e3ea Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Sun, 30 Apr 2017 18:04:58 +0700 Subject: Simple RGB backlight theming --- keyboards/handwired/promethium/color.h | 15 +++ .../handwired/promethium/keymaps/priyadi/keymap.c | 145 +++++++++++---------- .../promethium/keymaps/priyadi/rgbtheme.h | 1 + .../promethium/keymaps/priyadi/rgbtheme_carbon.h | 36 +++++ .../promethium/keymaps/priyadi/rgbtheme_default.h | 36 +++++ 5 files changed, 161 insertions(+), 72 deletions(-) create mode 100644 keyboards/handwired/promethium/color.h create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/rgbtheme.h create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/rgbtheme_carbon.h create mode 100644 keyboards/handwired/promethium/keymaps/priyadi/rgbtheme_default.h (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/promethium/color.h b/keyboards/handwired/promethium/color.h new file mode 100644 index 000000000..077242d5f --- /dev/null +++ b/keyboards/handwired/promethium/color.h @@ -0,0 +1,15 @@ +#define COLOR_BLANK 0, 0, 0 + +#define COLOR_BLACK 0, 0, 0 +#define COLOR_WHITE 15,15,15 +#define COLOR_GRAY 7, 7, 7 + +#define COLOR_RED 15, 0, 0 +#define COLOR_GREEN 0,15, 0 +#define COLOR_BLUE 0, 0,15 + +#define COLOR_YELLOW 15,15, 0 +#define COLOR_MAGENTA 15, 0,15 +#define COLOR_CYAN 0,15,15 + +#define COLOR_ORANGE 15, 5, 0 \ No newline at end of file diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 4cc3d6d60..d562c7bbf 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -31,6 +31,7 @@ along with this program. If not, see . #include "quantum.h" #ifdef RGBSPS_ENABLE #include "rgbsps.h" +#include "rgbtheme.h" #endif #ifdef PS2_MOUSE_ENABLE #include "ps2_mouse.h" @@ -42,13 +43,13 @@ along with this program. If not, see . #undef FAUXCLICKY_OFF #define FAUXCLICKY_OFF do { \ fauxclicky_enabled = false; \ - rgbsps_set(LED_AUDIO, 0, 0, 0); \ + rgbsps_set(LED_AUDIO, COLOR_BLANK); \ fauxclicky_stop(); \ } while (0) #undef FAUXCLICKY_ON #define FAUXCLICKY_ON do { \ fauxclicky_enabled = true; \ - rgbsps_set(LED_AUDIO, 8, 0, 8); \ + rgbsps_set(LED_AUDIO, THEME_COLOR_AUDIO); \ } while (0) #endif #endif @@ -469,33 +470,33 @@ const uint8_t PROGMEM LED_TRACKPOINT[] = { void led_turnoff_keys(void) { for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 0, 0, 0); + rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), COLOR_BLACK); } for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { - rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 0, 0); + rgbsps_set(pgm_read_byte(&LED_MODS[i]), COLOR_BLACK); } for(uint8_t i = 0; i < COUNT(LED_FN); i++) { - rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 0); + rgbsps_set(pgm_read_byte(&LED_FN[i]), COLOR_BLACK); } } #ifdef RGBSPS_DEMO_ENABLE void led_demo(void) { - rgbsps_set(LED_IND_LINUX, 15, 15, 15); - rgbsps_set(LED_IND_APPLE, 15, 15, 15); - rgbsps_set(LED_IND_WINDOWS, 15, 15, 15); - rgbsps_set(LED_IND_QWERTY, 15, 10, 0); - rgbsps_set(LED_IND_ALT, 15, 10, 0); - rgbsps_set(LED_IND_AUDIO, 5, 11, 13); - rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); - rgbsps_set(LED_IND_USB, 15, 15, 15); - rgbsps_set(LED_IND_CAPSLOCK, 15, 0, 0); - rgbsps_set(LED_IND_GUI, 15, 0, 15); - rgbsps_set(LED_IND_FUN, 15, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 15); - rgbsps_set(LED_IND_PUNC, 0, 15, 0); - rgbsps_set(LED_IND_GREEK, 0, 15, 15); - rgbsps_set(LED_IND_EMOJI, 15, 15, 0); + rgbsps_set(LED_IND_LINUX, THEME_COLOR_LINUX); + rgbsps_set(LED_IND_APPLE, THEME_COLOR_APPLE); + rgbsps_set(LED_IND_WINDOWS, THEME_COLOR_WINDOWS); + rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY); + rgbsps_set(LED_IND_ALT, THEME_COLOR_ALT); + rgbsps_set(LED_IND_AUDIO, THEME_COLOR_AUDIO); + rgbsps_set(LED_IND_BLUETOOTH, THEME_COLOR_BLUETOOTH); + rgbsps_set(LED_IND_USB, THEME_COLOR_USB); + rgbsps_set(LED_IND_CAPSLOCK, THEME_COLOR_CAPSLOCK); + rgbsps_set(LED_IND_GUI, THEME_COLOR_GUI); + rgbsps_set(LED_IND_FUN, THEME_COLOR_FUN); + rgbsps_set(LED_IND_NUM, THEME_COLOR_NUM); + rgbsps_set(LED_IND_PUNC, THEME_COLOR_PUNC); + rgbsps_set(LED_IND_GREEK, THEME_COLOR_GREEK); + rgbsps_set(LED_IND_EMOJI, THEME_COLOR_EMOJI); rgbsps_send(); } #endif @@ -508,26 +509,26 @@ void led_reset(void) { case GLOW_MIN: led_turnoff_keys(); for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) { - rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 8, 8, 8); + rgbsps_set(pgm_read_byte(&LED_HOMING[i]), THEME_COLOR_GLOW1_HOME); } - rgbsps_set(LED_F, 15, 0, 0); - rgbsps_set(LED_J, 15, 0, 0); + rgbsps_set(LED_F, THEME_COLOR_GLOW1_HOMING); + rgbsps_set(LED_J, THEME_COLOR_GLOW1_HOMING); break; case GLOW_FULL: for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) { - rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 8, 8, 8); + rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), THEME_COLOR_GLOW2_ALPHA); } for(uint8_t i = 0; i < COUNT(LED_MODS); i++) { - rgbsps_set(pgm_read_byte(&LED_MODS[i]), 0, 15, 0); + rgbsps_set(pgm_read_byte(&LED_MODS[i]), THEME_COLOR_GLOW2_MODS); } for(uint8_t i = 0; i < COUNT(LED_FN); i++) { - rgbsps_set(pgm_read_byte(&LED_FN[i]), 0, 0, 15); + rgbsps_set(pgm_read_byte(&LED_FN[i]), THEME_COLOR_GLOW2_FN); } for(uint8_t i = 0; i < COUNT(LED_HOMING); i++) { - rgbsps_set(pgm_read_byte(&LED_HOMING[i]), 15, 0, 0); + rgbsps_set(pgm_read_byte(&LED_HOMING[i]), THEME_COLOR_GLOW2_HOME); } - rgbsps_set(LED_F, 15, 15, 0); - rgbsps_set(LED_J, 15, 15, 0); + rgbsps_set(LED_F, THEME_COLOR_GLOW2_HOMING); + rgbsps_set(LED_J, THEME_COLOR_GLOW2_HOMING); break; } } @@ -535,11 +536,11 @@ void led_reset(void) { void led_set_default_layer_indicator(void) { uint8_t default_layer = biton32(default_layer_state); if (default_layer == _QWERTY) { - rgbsps_set(LED_IND_QWERTY, 15, 10, 0); - rgbsps_set(LED_IND_ALT, 0, 0, 0); + rgbsps_set(LED_IND_QWERTY, THEME_COLOR_QWERTY); + rgbsps_set(LED_IND_ALT, COLOR_BLANK); } else { - rgbsps_set(LED_IND_QWERTY, 0, 0, 0); - rgbsps_set(LED_IND_ALT, 15, 10, 0); + rgbsps_set(LED_IND_QWERTY, COLOR_BLANK); + rgbsps_set(LED_IND_ALT, THEME_COLOR_ALT); } rgbsps_send(); return; @@ -550,12 +551,12 @@ void led_set_layer_indicator(void) { led_reset(); - rgbsps_set(LED_IND_GUI, 0, 0, 0); - rgbsps_set(LED_IND_FUN, 0, 0, 0); - rgbsps_set(LED_IND_NUM, 0, 0, 0); - rgbsps_set(LED_IND_PUNC, 0, 0, 0); - rgbsps_set(LED_IND_GREEK, 0, 0, 0); - rgbsps_set(LED_IND_EMOJI, 0, 0, 0); + rgbsps_set(LED_IND_GUI, COLOR_BLANK); + rgbsps_set(LED_IND_FUN, COLOR_BLANK); + rgbsps_set(LED_IND_NUM, COLOR_BLANK); + rgbsps_set(LED_IND_PUNC, COLOR_BLANK); + rgbsps_set(LED_IND_GREEK, COLOR_BLANK); + rgbsps_set(LED_IND_EMOJI, COLOR_BLANK); uint8_t layer = biton32(layer_state); if (oldlayer == layer) { @@ -571,71 +572,71 @@ void led_set_layer_indicator(void) { switch(layer) { case _GUI: - rgbsps_set(LED_IND_GUI, 15, 0, 15); + rgbsps_set(LED_IND_GUI, THEME_COLOR_GUI); break; case _FUN: - rgbsps_set(LED_IND_FUN, 15, 0, 0); + rgbsps_set(LED_IND_FUN, THEME_COLOR_FUN); break; case _NUM: - rgbsps_set(LED_IND_NUM, 0, 0, 15); + rgbsps_set(LED_IND_NUM, THEME_COLOR_NUM); break; case _PUNC: - rgbsps_set(LED_IND_PUNC, 0, 15, 0); + rgbsps_set(LED_IND_PUNC, THEME_COLOR_PUNC); break; case _GREEKL: case _GREEKU: - rgbsps_set(LED_IND_GREEK, 0, 15, 15); + rgbsps_set(LED_IND_GREEK, THEME_COLOR_GREEK); break; case _EMOJI: - rgbsps_set(LED_IND_EMOJI, 15, 15, 0); + rgbsps_set(LED_IND_EMOJI, THEME_COLOR_EMOJI); break; default: - rgbsps_set(LED_IND_GUI, 3, 3, 3); - rgbsps_set(LED_IND_FUN, 3, 3, 3); - rgbsps_set(LED_IND_NUM, 3, 3, 3); - rgbsps_set(LED_IND_PUNC, 3, 3, 3); - rgbsps_set(LED_IND_GREEK, 3, 3, 3); - rgbsps_set(LED_IND_EMOJI, 3, 3, 3); + rgbsps_set(LED_IND_GUI, THEME_COLOR_OTHERLAYER); + rgbsps_set(LED_IND_FUN, THEME_COLOR_OTHERLAYER); + rgbsps_set(LED_IND_NUM, THEME_COLOR_OTHERLAYER); + rgbsps_set(LED_IND_PUNC, THEME_COLOR_OTHERLAYER); + rgbsps_set(LED_IND_GREEK, THEME_COLOR_OTHERLAYER); + rgbsps_set(LED_IND_EMOJI, THEME_COLOR_OTHERLAYER); } rgbsps_send(); } void led_set_unicode_input_mode(void) { - rgbsps_set(LED_IND_LINUX, 0, 0, 0); - rgbsps_set(LED_IND_APPLE, 0, 0, 0); - rgbsps_set(LED_IND_WINDOWS, 0, 0, 0); + rgbsps_set(LED_IND_LINUX, COLOR_BLANK); + rgbsps_set(LED_IND_APPLE, COLOR_BLANK); + rgbsps_set(LED_IND_WINDOWS, COLOR_BLANK); switch (get_unicode_input_mode()) { case UC_LNX: - rgbsps_set(LED_IND_LINUX, 15, 15, 15); + rgbsps_set(LED_IND_LINUX, THEME_COLOR_LINUX); break; case UC_OSX: - rgbsps_set(LED_IND_APPLE, 15, 15, 15); + rgbsps_set(LED_IND_APPLE, THEME_COLOR_APPLE); break; case UC_WIN: case UC_WINC: - rgbsps_set(LED_IND_WINDOWS, 15, 15, 15); + rgbsps_set(LED_IND_WINDOWS, THEME_COLOR_WINDOWS); break; } rgbsps_send(); } void led_set_output_ble(void) { - rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 15); - rgbsps_set(LED_IND_USB, 0, 0, 0); + rgbsps_set(LED_IND_BLUETOOTH, THEME_COLOR_BLUETOOTH); + rgbsps_set(LED_IND_USB, COLOR_BLANK); rgbsps_send(); } void led_set_output_usb(void) { - rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0); - rgbsps_set(LED_IND_USB, 15, 15, 15); + rgbsps_set(LED_IND_BLUETOOTH, COLOR_BLANK); + rgbsps_set(LED_IND_USB, THEME_COLOR_USB); rgbsps_send(); } void led_set_output_none(void) { - rgbsps_set(LED_IND_BLUETOOTH, 0, 0, 0); - rgbsps_set(LED_IND_USB, 0, 0, 0); + rgbsps_set(LED_IND_BLUETOOTH, COLOR_BLANK); + rgbsps_set(LED_IND_USB, COLOR_BLANK); rgbsps_send(); } @@ -644,9 +645,9 @@ void led_init(void) { rgbsps_turnoff(); // set trackpoint color - rgbsps_set(LED_TRACKPOINT1, 15, 0, 0); - rgbsps_set(LED_TRACKPOINT2, 0, 0, 15); - rgbsps_set(LED_TRACKPOINT3, 15, 0, 0); + rgbsps_set(LED_TRACKPOINT1, THEME_COLOR_TP1); + rgbsps_set(LED_TRACKPOINT2, THEME_COLOR_TP2); + rgbsps_set(LED_TRACKPOINT3, THEME_COLOR_TP3); // unicode input mode led_set_unicode_input_mode(); @@ -658,9 +659,9 @@ void led_init(void) { // clicky #ifdef FAUXCLICKY_ENABLE if (fauxclicky_enabled) { - rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + rgbsps_set(LED_IND_AUDIO, THEME_COLOR_AUDIO); } else { - rgbsps_set(LED_IND_AUDIO, 0, 0, 0); + rgbsps_set(LED_IND_AUDIO, COLOR_BLANK); } #endif @@ -1244,9 +1245,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case FC_TOG: #ifdef RGBSPS_ENABLE if (fauxclicky_enabled) { - rgbsps_set(LED_IND_AUDIO, 5, 11, 13); + rgbsps_set(LED_IND_AUDIO, THEME_COLOR_AUDIO); } else { - rgbsps_set(LED_IND_AUDIO, 0, 0, 0); + rgbsps_set(LED_IND_AUDIO, COLOR_BLANK); } rgbsps_send(); #endif @@ -1320,9 +1321,9 @@ void turn_off_capslock() { bool new_capslock = usb_led & (1< Date: Thu, 11 May 2017 15:32:35 -0400 Subject: Fix spelling of "persistent" Fixes #1201. --- keyboards/handwired/atreus50/keymaps/default/keymap.c | 8 ++++---- keyboards/handwired/ortho5x13/keymaps/default/keymap.c | 8 ++++---- keyboards/handwired/promethium/keymaps/priyadi/keymap.c | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/atreus50/keymaps/default/keymap.c b/keyboards/handwired/atreus50/keymaps/default/keymap.c index 77cf942c3..739fb2685 100644 --- a/keyboards/handwired/atreus50/keymaps/default/keymap.c +++ b/keyboards/handwired/atreus50/keymaps/default/keymap.c @@ -147,7 +147,7 @@ float tone_goodbye[][2] = SONG(GOODBYE_SOUND); float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif -void persistant_default_layer_set(uint16_t default_layer) { +void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } @@ -159,7 +159,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_qwerty, false, 0); #endif - persistant_default_layer_set(1UL<<_QWERTY); + persistent_default_layer_set(1UL<<_QWERTY); } return false; break; @@ -168,7 +168,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_colemak, false, 0); #endif - persistant_default_layer_set(1UL<<_COLEMAK); + persistent_default_layer_set(1UL<<_COLEMAK); } return false; break; @@ -177,7 +177,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_dvorak, false, 0); #endif - persistant_default_layer_set(1UL<<_DVORAK); + persistent_default_layer_set(1UL<<_DVORAK); } return false; break; diff --git a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c index c1262a83d..971099747 100644 --- a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c +++ b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c @@ -186,7 +186,7 @@ float tone_goodbye[][2] = SONG(GOODBYE_SOUND); float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif -void persistant_default_layer_set(uint16_t default_layer) { +void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } @@ -198,7 +198,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_qwerty, false, 0); #endif - persistant_default_layer_set(1UL<<_QWERTY); + persistent_default_layer_set(1UL<<_QWERTY); } return false; break; @@ -207,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_colemak, false, 0); #endif - persistant_default_layer_set(1UL<<_COLEMAK); + persistent_default_layer_set(1UL<<_COLEMAK); } return false; break; @@ -216,7 +216,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef AUDIO_ENABLE PLAY_NOTE_ARRAY(tone_dvorak, false, 0); #endif - persistant_default_layer_set(1UL<<_DVORAK); + persistent_default_layer_set(1UL<<_DVORAK); } return false; break; diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index d562c7bbf..763fa5a27 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c @@ -955,7 +955,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -void persistant_default_layer_set(uint16_t default_layer) { +void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); #ifdef RGBSPS_ENABLE @@ -1134,14 +1134,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // layout switchers case QWERTY: if (record->event.pressed) { - persistant_default_layer_set(1UL<<_QWERTY); + persistent_default_layer_set(1UL<<_QWERTY); } return false; break; #ifdef LAYOUT_DVORAK case DVORAK: if (record->event.pressed) { - persistant_default_layer_set(1UL<<_DVORAK); + persistent_default_layer_set(1UL<<_DVORAK); } return false; break; @@ -1149,7 +1149,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef LAYOUT_COLEMAK case COLEMAK: if (record->event.pressed) { - persistant_default_layer_set(1UL<<_COLEMAK); + persistent_default_layer_set(1UL<<_COLEMAK); } return false; break; @@ -1157,7 +1157,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef LAYOUT_WORKMAN case WORKMAN: if (record->event.pressed) { - persistant_default_layer_set(1UL<<_WORKMAN); + persistent_default_layer_set(1UL<<_WORKMAN); } return false; break; @@ -1165,7 +1165,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #ifdef LAYOUT_NORMAN case NORMAN: if (record->event.pressed) { - persistant_default_layer_set(1UL<<_NORMAN); + persistent_default_layer_set(1UL<<_NORMAN); } return false; break; -- cgit v1.2.3 From 81e85a1a4e4b1b7c5bbf1fcffe967a60639778c0 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Fri, 26 May 2017 20:35:31 +0200 Subject: - Added integration of IBM Trackpoint --- keyboards/handwired/trackpoint/Makefile | 3 + keyboards/handwired/trackpoint/README.md | 7 ++ keyboards/handwired/trackpoint/config.h | 75 ++++++++++++++++++++++ .../handwired/trackpoint/keymaps/default/keymap.c | 7 ++ keyboards/handwired/trackpoint/rules.mk | 25 ++++++++ keyboards/handwired/trackpoint/trackpoint.c | 5 ++ keyboards/handwired/trackpoint/trackpoint.h | 13 ++++ 7 files changed, 135 insertions(+) create mode 100644 keyboards/handwired/trackpoint/Makefile create mode 100644 keyboards/handwired/trackpoint/README.md create mode 100644 keyboards/handwired/trackpoint/config.h create mode 100644 keyboards/handwired/trackpoint/keymaps/default/keymap.c create mode 100644 keyboards/handwired/trackpoint/rules.mk create mode 100644 keyboards/handwired/trackpoint/trackpoint.c create mode 100644 keyboards/handwired/trackpoint/trackpoint.h (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/trackpoint/Makefile b/keyboards/handwired/trackpoint/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/handwired/trackpoint/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/trackpoint/README.md b/keyboards/handwired/trackpoint/README.md new file mode 100644 index 000000000..764ad984a --- /dev/null +++ b/keyboards/handwired/trackpoint/README.md @@ -0,0 +1,7 @@ +# IBM Trackpoint demonstration + +This is just a simple demo to show how to integrate IBM Trackpoint in QMK. + +Some documentation: +* [How to wire IBM Trackpoint](https://github.com/alonswartz/trackpoint) +* [QMK documentation](https://docs.qmk.fm/) diff --git a/keyboards/handwired/trackpoint/config.h b/keyboards/handwired/trackpoint/config.h new file mode 100644 index 000000000..7558c03bf --- /dev/null +++ b/keyboards/handwired/trackpoint/config.h @@ -0,0 +1,75 @@ +#ifndef CONFIG_H + #define CONFIG_H + + #include "config_common.h" + + #define VENDOR_ID 0x1234 + #define PRODUCT_ID 0x5678 + #define DEVICE_VER 0x0001 + #define MANUFACTURER QMK + #define PRODUCT TRACKPOINT-DEMO + #define DESCRIPTION Simple demonstration for IBM Trackpoint integration + + #define MATRIX_ROWS 1 + #define MATRIX_COLS 3 + + #ifdef PS2_USE_USART + #define PS2_CLOCK_PORT PORTD + #define PS2_CLOCK_PIN PIND + #define PS2_CLOCK_DDR DDRD + #define PS2_CLOCK_BIT 5 + #define PS2_DATA_PORT PORTD + #define PS2_DATA_PIN PIND + #define PS2_DATA_DDR DDRD + #define PS2_DATA_BIT 2 + + /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ + /* set DDR of CLOCK as input to be slave */ + #define PS2_USART_INIT() do { \ + PS2_CLOCK_DDR &= ~(1<mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ + ) + +#endif diff --git a/keyboards/handwired/trackpoint/keymaps/default/keymap.c b/keyboards/handwired/trackpoint/keymaps/default/keymap.c new file mode 100644 index 000000000..22e46d98a --- /dev/null +++ b/keyboards/handwired/trackpoint/keymaps/default/keymap.c @@ -0,0 +1,7 @@ +#include "trackpoint.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( + KC_BTN1, KC_BTN3, KC_BTN2 \ + ) +}; diff --git a/keyboards/handwired/trackpoint/rules.mk b/keyboards/handwired/trackpoint/rules.mk new file mode 100644 index 000000000..0609dd304 --- /dev/null +++ b/keyboards/handwired/trackpoint/rules.mk @@ -0,0 +1,25 @@ +MCU = atmega32u4 +F_CPU = 16000000 +ARCH = AVR8 +F_USB = $(F_CPU) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT +OPT_DEFS += -DBOOTLOADER_SIZE=512 +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + +PS2_MOUSE_ENABLE ?= yes +PS2_USE_USART ?= yes + +ifndef QUANTUM_DIR + include ../../Makefile +endif diff --git a/keyboards/handwired/trackpoint/trackpoint.c b/keyboards/handwired/trackpoint/trackpoint.c new file mode 100644 index 000000000..124995a64 --- /dev/null +++ b/keyboards/handwired/trackpoint/trackpoint.c @@ -0,0 +1,5 @@ +#include "trackpoint.h" + +void matrix_init_kb(void) { + +} diff --git a/keyboards/handwired/trackpoint/trackpoint.h b/keyboards/handwired/trackpoint/trackpoint.h new file mode 100644 index 000000000..b5d73d7db --- /dev/null +++ b/keyboards/handwired/trackpoint/trackpoint.h @@ -0,0 +1,13 @@ +#ifndef TRACKPOINT_H +#define TRACKPOINT_H + +#include "quantum.h" + +#define KEYMAP( \ + k00, k01, k02 \ +) \ +{ \ + { k00, k01, k02} \ +} + +#endif -- cgit v1.2.3 From 6b994ecd82f660feb44bac376ae7d0147d40d818 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Fri, 26 May 2017 21:27:11 +0200 Subject: - Added schematic for Trackpoint demonstration --- keyboards/handwired/trackpoint/README.md | 3 +++ keyboards/handwired/trackpoint/wiring.png | Bin 0 -> 7217 bytes 2 files changed, 3 insertions(+) create mode 100644 keyboards/handwired/trackpoint/wiring.png (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/trackpoint/README.md b/keyboards/handwired/trackpoint/README.md index 764ad984a..a22fca295 100644 --- a/keyboards/handwired/trackpoint/README.md +++ b/keyboards/handwired/trackpoint/README.md @@ -2,6 +2,9 @@ This is just a simple demo to show how to integrate IBM Trackpoint in QMK. +Wiring used in the demonstration: +![Wiring example](./wiring.png) + Some documentation: * [How to wire IBM Trackpoint](https://github.com/alonswartz/trackpoint) * [QMK documentation](https://docs.qmk.fm/) diff --git a/keyboards/handwired/trackpoint/wiring.png b/keyboards/handwired/trackpoint/wiring.png new file mode 100644 index 000000000..45806e007 Binary files /dev/null and b/keyboards/handwired/trackpoint/wiring.png differ -- cgit v1.2.3