diff options
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/config.h | 30 | ||||
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/keymap.c | 73 | ||||
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/lfkpad.c | 102 | ||||
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/lfkpad.h | 36 | ||||
| -rw-r--r-- | keyboards/lfkeyboards/lfkpad/rules.mk | 2 |
6 files changed, 106 insertions, 139 deletions
diff --git a/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/config.h b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/config.h new file mode 100644 index 000000000..a12154341 --- /dev/null +++ b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/config.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* Copyright 2021 Pascal Pfeil | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | /* 1000Hz USB polling */ | ||
| 20 | #define USB_POLLING_INTERVAL_MS 1 | ||
| 21 | |||
| 22 | /* Send up to 4 key press events per scan */ | ||
| 23 | #define QMK_KEYS_PER_SCAN 4 | ||
| 24 | |||
| 25 | /* Force NKRO on boot up */ | ||
| 26 | #define FORCE_NKRO | ||
| 27 | |||
| 28 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true | ||
| 29 | |||
| 30 | #define RGB_DISABLE_TIMEOUT 900000 | ||
diff --git a/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/keymap.c b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/keymap.c new file mode 100644 index 000000000..b2b97f442 --- /dev/null +++ b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/keymap.c | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* Copyright 2021 Pascal Pfeil | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 20 | [0] = LAYOUT_numpad_6x4( | ||
| 21 | KC_ESC, KC_TAB, KC_BSPC, MO(1), | ||
| 22 | KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, | ||
| 23 | KC_P7, KC_P8, KC_P9, | ||
| 24 | KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
| 25 | KC_P1, KC_P2, KC_P3, | ||
| 26 | KC_P0, KC_PDOT, KC_PENT | ||
| 27 | ), | ||
| 28 | |||
| 29 | /* RGB */ | ||
| 30 | [1] = LAYOUT_numpad_6x4( | ||
| 31 | RGB_SAI, RGB_VAI, RGB_HUI, _______, | ||
| 32 | RGB_SAD, RGB_VAD, RGB_HUD, RESET, | ||
| 33 | RGB_M_X, RGB_M_G, RGB_MOD, | ||
| 34 | RGB_M_SW,RGB_M_SN,RGB_M_K, RGB_RMOD, | ||
| 35 | RGB_M_P, RGB_M_B, RGB_M_R, | ||
| 36 | XXXXXXX, XXXXXXX, RGB_TOG | ||
| 37 | ), | ||
| 38 | |||
| 39 | /* VIA wants four keymaps */ | ||
| 40 | [2] = LAYOUT_numpad_6x4( | ||
| 41 | _______, _______, _______, _______, | ||
| 42 | _______, _______, _______, _______, | ||
| 43 | _______, _______, _______, | ||
| 44 | _______, _______, _______, _______, | ||
| 45 | _______, _______, _______, | ||
| 46 | _______, _______, _______ | ||
| 47 | ), | ||
| 48 | |||
| 49 | /* VIA wants four keymaps */ | ||
| 50 | [3] = LAYOUT_numpad_6x4( | ||
| 51 | _______, _______, _______, _______, | ||
| 52 | _______, _______, _______, _______, | ||
| 53 | _______, _______, _______, | ||
| 54 | _______, _______, _______, _______, | ||
| 55 | _______, _______, _______, | ||
| 56 | _______, _______, _______ | ||
| 57 | ), | ||
| 58 | }; | ||
| 59 | |||
| 60 | const uint8_t number_leds[] = {8, 9, 10, 11, 12, 13, 15, 16, 17}; | ||
| 61 | const uint8_t number_leds_size = sizeof(number_leds) / sizeof(uint8_t); | ||
| 62 | |||
| 63 | bool led_update_user(led_t led_state) { | ||
| 64 | for (uint8_t i = 0; i < number_leds_size; i++) | ||
| 65 | if (led_state.num_lock) | ||
| 66 | // set to whatever the other leds are doing | ||
| 67 | // this is needed so that upon disabling num lock, the leds don't stay red | ||
| 68 | rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), numer_leds[i]); | ||
| 69 | else | ||
| 70 | rgblight_setrgb_red_at(numer_leds[i]); // set to red | ||
| 71 | |||
| 72 | return true; | ||
| 73 | } | ||
diff --git a/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/rules.mk b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/rules.mk new file mode 100644 index 000000000..36b7ba9cb --- /dev/null +++ b/keyboards/lfkeyboards/lfkpad/keymaps/pascalpfeil/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | LTO_ENABLE = yes | ||
diff --git a/keyboards/lfkeyboards/lfkpad/lfkpad.c b/keyboards/lfkeyboards/lfkpad/lfkpad.c index b91b7da67..fffa26ca3 100644 --- a/keyboards/lfkeyboards/lfkpad/lfkpad.c +++ b/keyboards/lfkeyboards/lfkpad/lfkpad.c | |||
| @@ -8,19 +8,9 @@ | |||
| 8 | #include "TWIlib.h" | 8 | #include "TWIlib.h" |
| 9 | #include "lighting.h" | 9 | #include "lighting.h" |
| 10 | 10 | ||
| 11 | uint16_t click_hz = CLICK_HZ; | ||
| 12 | uint16_t click_time = CLICK_MS; | ||
| 13 | uint8_t click_toggle = CLICK_ENABLED; | ||
| 14 | |||
| 15 | void matrix_init_kb(void) { | 11 | void matrix_init_kb(void) { |
| 16 | matrix_init_user(); | 12 | matrix_init_user(); |
| 17 | 13 | ||
| 18 | #ifndef AUDIO_ENABLE | ||
| 19 | // If we're not using the audio pin, drive it low | ||
| 20 | setPinOutput(C6); | ||
| 21 | writePinLow(C6); | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #ifdef ISSI_ENABLE | 14 | #ifdef ISSI_ENABLE |
| 25 | issi_init(); | 15 | issi_init(); |
| 26 | #endif | 16 | #endif |
| @@ -68,97 +58,6 @@ void matrix_scan_kb(void) { | |||
| 68 | matrix_scan_user(); | 58 | matrix_scan_user(); |
| 69 | } | 59 | } |
| 70 | 60 | ||
| 71 | void click(uint16_t freq, uint16_t duration) { | ||
| 72 | #ifdef AUDIO_ENABLE | ||
| 73 | if (freq >= 100 && freq <= 20000 && duration < 100) { | ||
| 74 | play_note(freq, 10); | ||
| 75 | |||
| 76 | for (uint16_t i = 0; i < duration; i++) { | ||
| 77 | _delay_ms(1); | ||
| 78 | } | ||
| 79 | |||
| 80 | stop_all_notes(); | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | } | ||
| 84 | |||
| 85 | bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | ||
| 86 | if (click_toggle && record->event.pressed) { | ||
| 87 | click(click_hz, click_time); | ||
| 88 | } | ||
| 89 | |||
| 90 | if (keycode == RESET) { | ||
| 91 | reset_keyboard_kb(); | ||
| 92 | } | ||
| 93 | |||
| 94 | return process_record_user(keycode, record); | ||
| 95 | } | ||
| 96 | |||
| 97 | void action_function(keyrecord_t *event, uint8_t id, uint8_t opt) { | ||
| 98 | #ifdef AUDIO_ENABLE | ||
| 99 | int8_t sign = 1; | ||
| 100 | #endif | ||
| 101 | |||
| 102 | if (id == LFK_ESC_TILDE) { | ||
| 103 | // Send ~ on shift-esc | ||
| 104 | void (*method)(uint8_t) = (event->event.pressed) ? &add_key : &del_key; | ||
| 105 | uint8_t shifted = get_mods() & MOD_MASK_SHIFT; | ||
| 106 | |||
| 107 | if (layer_state == 0) { | ||
| 108 | method(shifted ? KC_GRAVE : KC_ESCAPE); | ||
| 109 | } else { | ||
| 110 | method(shifted ? KC_ESCAPE : KC_GRAVE); | ||
| 111 | } | ||
| 112 | send_keyboard_report(); | ||
| 113 | } else if (event->event.pressed) { | ||
| 114 | switch (id) { | ||
| 115 | case LFK_SET_DEFAULT_LAYER: | ||
| 116 | // set/save the current base layer to eeprom, falls through to LFK_CLEAR | ||
| 117 | eeconfig_update_default_layer(1UL << opt); | ||
| 118 | default_layer_set(1UL << opt); | ||
| 119 | case LFK_CLEAR: | ||
| 120 | // Go back to default layer | ||
| 121 | layer_clear(); | ||
| 122 | break; | ||
| 123 | #ifdef AUDIO_ENABLE | ||
| 124 | case LFK_CLICK_FREQ_LOWER: | ||
| 125 | sign = -1; // continue to next statement | ||
| 126 | case LFK_CLICK_FREQ_HIGHER: | ||
| 127 | click_hz += sign * 100; | ||
| 128 | click(click_hz, click_time); | ||
| 129 | break; | ||
| 130 | case LFK_CLICK_TOGGLE: | ||
| 131 | if (click_toggle) { | ||
| 132 | click_toggle = 0; | ||
| 133 | click(4000, 100); | ||
| 134 | click(1000, 100); | ||
| 135 | } else { | ||
| 136 | click_toggle = 1; | ||
| 137 | click(1000, 100); | ||
| 138 | click(4000, 100); | ||
| 139 | } | ||
| 140 | break; | ||
| 141 | case LFK_CLICK_TIME_SHORTER: | ||
| 142 | sign = -1; // continue to next statement | ||
| 143 | case LFK_CLICK_TIME_LONGER: | ||
| 144 | click_time += sign; | ||
| 145 | click(click_hz, click_time); | ||
| 146 | break; | ||
| 147 | #endif | ||
| 148 | } | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | void reset_keyboard_kb() { | ||
| 153 | #ifdef WATCHDOG_ENABLE | ||
| 154 | MCUSR = 0; | ||
| 155 | wdt_disable(); | ||
| 156 | wdt_reset(); | ||
| 157 | #endif | ||
| 158 | |||
| 159 | reset_keyboard(); | ||
| 160 | } | ||
| 161 | |||
| 162 | // LFK lighting info | 61 | // LFK lighting info |
| 163 | const uint8_t rgb_matrices[] = { 0, 1 }; | 62 | const uint8_t rgb_matrices[] = { 0, 1 }; |
| 164 | const uint8_t rgb_sequence[] = { | 63 | const uint8_t rgb_sequence[] = { |
| @@ -168,7 +67,6 @@ const uint8_t rgb_sequence[] = { | |||
| 168 | 17, 18, 9, 8, | 67 | 17, 18, 9, 8, |
| 169 | 19, 21, 11, | 68 | 19, 21, 11, |
| 170 | 22, 14, 12, | 69 | 22, 14, 12, |
| 171 | |||
| 172 | 16, 26, | 70 | 16, 26, |
| 173 | 4, 25, | 71 | 4, 25, |
| 174 | 13, 24, | 72 | 13, 24, |
diff --git a/keyboards/lfkeyboards/lfkpad/lfkpad.h b/keyboards/lfkeyboards/lfkpad/lfkpad.h index 0f34150db..5ca8a3c50 100644 --- a/keyboards/lfkeyboards/lfkpad/lfkpad.h +++ b/keyboards/lfkeyboards/lfkpad/lfkpad.h | |||
| @@ -2,42 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #include "quantum.h" | 3 | #include "quantum.h" |
| 4 | 4 | ||
| 5 | typedef struct RGB_Color { | ||
| 6 | uint16_t red; | ||
| 7 | uint16_t green; | ||
| 8 | uint16_t blue; | ||
| 9 | } RGB_Color; | ||
| 10 | |||
| 11 | typedef struct Layer_Info { | ||
| 12 | uint32_t layer; | ||
| 13 | uint32_t mask; | ||
| 14 | RGB_Color color; | ||
| 15 | } Layer_Info; | ||
| 16 | |||
| 17 | extern const uint32_t layer_count; | ||
| 18 | extern const Layer_Info layer_info[]; | ||
| 19 | |||
| 20 | enum action_functions { | ||
| 21 | LFK_CLEAR = 0, // Resets all layers | ||
| 22 | LFK_ESC_TILDE, // esc+lshift = ~ | ||
| 23 | LFK_SET_DEFAULT_LAYER, // changes and saves current base layer to eeprom | ||
| 24 | LFK_CLICK_TOGGLE, // Adjusts click duration | ||
| 25 | LFK_CLICK_FREQ_HIGHER, // Adjusts click frequency | ||
| 26 | LFK_CLICK_FREQ_LOWER, // Adjusts click frequency | ||
| 27 | LFK_CLICK_TIME_LONGER, // Adjusts click duration | ||
| 28 | LFK_CLICK_TIME_SHORTER, // Adjusts click duration | ||
| 29 | LFK_DEBUG_SETTINGS, // prints LED and click settings to HID | ||
| 30 | LFK_LED_TEST // cycles through switch and RGB LEDs | ||
| 31 | }; | ||
| 32 | |||
| 33 | #define CLICK_HZ 500 | ||
| 34 | #define CLICK_MS 2 | ||
| 35 | #define CLICK_ENABLED 0 | ||
| 36 | |||
| 37 | void reset_keyboard_kb(void); | ||
| 38 | void click(uint16_t freq, uint16_t duration); | ||
| 39 | |||
| 40 | // readability | ||
| 41 | #define ___ KC_NO | 5 | #define ___ KC_NO |
| 42 | 6 | ||
| 43 | #define LAYOUT_numpad_6x4( \ | 7 | #define LAYOUT_numpad_6x4( \ |
diff --git a/keyboards/lfkeyboards/lfkpad/rules.mk b/keyboards/lfkeyboards/lfkpad/rules.mk index 91d754803..13951e4c6 100644 --- a/keyboards/lfkeyboards/lfkpad/rules.mk +++ b/keyboards/lfkeyboards/lfkpad/rules.mk | |||
| @@ -25,7 +25,7 @@ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | |||
| 25 | NKRO_ENABLE = no # USB Nkey Rollover | 25 | NKRO_ENABLE = no # USB Nkey Rollover |
| 26 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 26 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality |
| 27 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | 27 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 28 | RGBLIGHT_CUSTOM_DRIVER = yes # RGB code is implemented in lefkeyboards, not qmk base | 28 | RGBLIGHT_CUSTOM_DRIVER = yes # RGB code is implemented in lfkeyboards, not qmk base |
| 29 | MIDI_ENABLE = no # MIDI support | 29 | MIDI_ENABLE = no # MIDI support |
| 30 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 30 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 31 | AUDIO_ENABLE = no # Audio output on port C6 | 31 | AUDIO_ENABLE = no # Audio output on port C6 |
