From e370b31660530f4926755418340a96c2d50e192a Mon Sep 17 00:00:00 2001 From: skullY Date: Tue, 30 Apr 2019 08:12:38 -0700 Subject: [PATCH] Remove the unnecessary for loop --- keyboards/clueboard/2x1800/2019/2019.c | 16 ++++++++++------ keyboards/clueboard/2x1800/2019/2019.h | 11 +++++++++++ keyboards/clueboard/2x1800/2019/config.h | 15 +++++++++------ .../2x1800/2019/keymaps/default/keymap.c | 2 +- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/keyboards/clueboard/2x1800/2019/2019.c b/keyboards/clueboard/2x1800/2019/2019.c index 9249c2d7e1..a8f4984a3b 100644 --- a/keyboards/clueboard/2x1800/2019/2019.c +++ b/keyboards/clueboard/2x1800/2019/2019.c @@ -43,12 +43,10 @@ void matrix_scan_kb(void) { uint8_t tilt_read = (readPin(SHAKE_PIN_A) << 4) | readPin(SHAKE_PIN_B); // Check to see if the tilt sensor has changed state since our last read - for (uint8_t i = 0; i < 2; i++) { - if (tilt_state != tilt_read) { - shake_timer = timer_read(); - detected_shakes++; - tilt_state = tilt_read; - } + if (tilt_state != tilt_read) { + shake_timer = timer_read(); + detected_shakes++; + tilt_state = tilt_read; } if ((detected_shakes > 0) && (timer_elapsed(shake_timer) > SHAKE_TIMEOUT)) { @@ -66,6 +64,12 @@ void matrix_scan_kb(void) { } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + if (keycode == ENC_BTN1) { + + } + } + return process_record_user(keycode, record); } diff --git a/keyboards/clueboard/2x1800/2019/2019.h b/keyboards/clueboard/2x1800/2019/2019.h index b3c11dc469..c32ffdbede 100644 --- a/keyboards/clueboard/2x1800/2019/2019.h +++ b/keyboards/clueboard/2x1800/2019/2019.h @@ -17,6 +17,17 @@ #include "quantum.h" +enum TWOx1800_keycodes { + ENC_BTN1 = SAFE_RANGE, + ENC_BTN2, + ENC_BTN3, + ENC_BTN4, + NEW_SAFE_RANGE +}; + +#undef SAFE_RANGE +#define SAFE_RANGE NEW_SAFE_RANGE + // This a shortcut to help you visually see your layout. // The first section contains all of the arguments // The second converts the arguments into a two-dimensional array diff --git a/keyboards/clueboard/2x1800/2019/config.h b/keyboards/clueboard/2x1800/2019/config.h index 3950906ca5..a52a896d07 100644 --- a/keyboards/clueboard/2x1800/2019/config.h +++ b/keyboards/clueboard/2x1800/2019/config.h @@ -15,8 +15,7 @@ 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 +#pragma once #include "config_common.h" @@ -197,7 +196,13 @@ along with this program. If not, see . /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 1 -#endif +/* + * Drawing mode + */ +#define DRAWING_ENABLE +//#define UNDO_KEY LGUI(KC_Z) // What key to send for undo +//#define UNDO_KEY LCTL(KC_Z) +#define UNDO_KEY LGUI(KC_SLSH) /* * Shake to undo configuration @@ -207,6 +212,4 @@ along with this program. If not, see . #define SHAKE_PIN_B E5 #define SHAKE_TIMEOUT 500 // How long after shaking stops before we register it #define SHAKE_COUNT 8 // How many shakes it takes to activate -//#define SHAKE_KEY LGUI(KC_Z) // What key to send after a shake -//#define SHAKE_KEY LCTL(KC_Z) -#define SHAKE_KEY LGUI(KC_SLSH) +#define SHAKE_KEY UNDO_KEY // What key to send after a shake diff --git a/keyboards/clueboard/2x1800/2019/keymaps/default/keymap.c b/keyboards/clueboard/2x1800/2019/keymaps/default/keymap.c index 7ebd14a35d..49de1aa03c 100644 --- a/keyboards/clueboard/2x1800/2019/keymaps/default/keymap.c +++ b/keyboards/clueboard/2x1800/2019/keymaps/default/keymap.c @@ -17,7 +17,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_all( \ - KC_BTN1, KC_BTN2, KC_BTN3, KC_BTN4, \ + ENC_BTN1, ENC_BTN2, ENC_BTN3, ENC_BTN4, \ KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, \ \ KC_PMNS, KC_NLCK, KC_PSLS, KC_PAST, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \