diff options
author | Drashna Jael're <drashna@live.com> | 2022-01-30 13:23:13 -0800 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2022-01-30 13:23:13 -0800 |
commit | b57f8a8b9fd50bdb39473e7730400e14b879da72 (patch) | |
tree | 430a140a24cf571b87423bdcd1fa5ad0a0461364 | |
parent | 1be1bebc043483c5a8fc77ed8b2705676a6cb05c (diff) | |
parent | 941b1d35b8e40a9c93301a1131ef3f3336fee0b5 (diff) | |
download | qmk_firmware-b57f8a8b9fd50bdb39473e7730400e14b879da72.tar.gz qmk_firmware-b57f8a8b9fd50bdb39473e7730400e14b879da72.zip |
Merge remote-tracking branch 'origin/master' into develop
22 files changed, 793 insertions, 184 deletions
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/chconf.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/chconf.h new file mode 100644 index 0000000000..8b55eaeef0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/chconf.h @@ -0,0 +1,38 @@ +/* Copyright 2020 QMK + * + * 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 <http://www.gnu.org/licenses/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f411/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_FREQUENCY 10000 + +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE + +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE + +#define CH_CFG_FACTORY_SEMAPHORES TRUE + +#define CH_CFG_FACTORY_MAILBOXES TRUE + +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE + +#define CH_CFG_FACTORY_PIPES TRUE + +#include_next <chconf.h> diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h new file mode 100644 index 0000000000..4633db2fc6 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h @@ -0,0 +1,109 @@ +/* + +Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#undef PRODUCT +#define PRODUCT Charybdis Nano (Blackpill) + +#undef MATRIX_ROW_PINS +#define MATRIX_ROW_PINS \ + { B12, B13, B14, B15 } +#undef MATRIX_COL_PINS +#define MATRIX_COL_PINS \ + { A15, B3, B4, B5, B6 } + + +#undef MATRIX_ROW_PINS_RIGHT +#define MATRIX_ROW_PINS_RIGHT \ + { B12, B13, B14, B15 } +#undef MATRIX_COL_PINS_RIGHT +#define MATRIX_COL_PINS_RIGHT \ + { A15, B3, B4, B5, B6 } + +#define USB_VBUS_PIN B10 +#define SPLIT_HAND_PIN C14 // high = left, low = right + +// WS2812 RGB LED strip input and number of LEDs +#undef RGB_DI_PIN +#define RGB_DI_PIN A1 +#undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 +#define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 +#define WS2812_PWM_CHANNEL 2 // default: 2 +#define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 +#define WS2812_EXTERNAL_PULLUP +//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy). +#define WS2812_DMA_STREAM STM32_DMA1_STREAM7 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +#define WS2812_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +#define WS2812_PWM_TARGET_PERIOD 800000 + +#define DEBUG_LED_PIN C13 + +/* Audio config */ +#define AUDIO_PIN B1 +#define AUDIO_PWM_DRIVER PWMD3 +#define AUDIO_PWM_CHANNEL 4 +#define AUDIO_PWM_PAL_MODE 2 +#define AUDIO_STATE_TIMER GPTD4 + +/* serial.c configuration for split keyboard */ +#undef SOFT_SERIAL_PIN +#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +#define SERIAL_USART_TX_PIN A2 +#define SERIAL_USART_RX_PIN A3 +#define SERIAL_USART_DRIVER SD2 +#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +#define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100 +// #define SERIAL_USART_PIN_SWAP // swap RX and TX pins on master +// To use the highest possible baudrate (3.75Mbit/s) uncomment the following +// line, this can result in dropped communications so lower the speed if there +// are many timeouts. +// #define SERIAL_USART_SPEED (STM32_PCLK2 >> 4) + +#define CRC8_USE_TABLE +#define CRC8_OPTIMIZE_SPEED + +/* spi config for eeprom and pmw3360 sensor */ +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_SCK_PAL_MODE 5 +#define SPI_MOSI_PIN A7 +#define SPI_MOSI_PAL_MODE 5 +#define SPI_MISO_PIN A6 +#define SPI_MISO_PAL_MODE 5 + +/* eeprom config */ +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 +#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 +// #define EXTERNAL_EEPROM_BYTE_COUNT 8196 +// #define EXTERNAL_EEPROM_PAGE_SIZE 32 +// #define EXTERNAL_EEPROM_ADDRESS_SIZE 2 + +/* pmw3360 config */ +#undef PMW3360_CS_PIN +#define PMW3360_CS_PIN B0 +#define PMW3360_SPI_MODE 3 +#define PMW3360_SPI_DIVISOR 64 + + +# define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 +# define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 +# define CHARYBDIS_MINIMUM_SNIPING_DPI 200 +# define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h new file mode 100644 index 0000000000..39644726c3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_SERIAL TRUE +#define HAL_USE_I2C TRUE +#define HAL_USE_SPI TRUE +#define SPI_USE_WAIT TRUE +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD +#define HAL_USE_GPT TRUE + +#include_next <halconf.h> diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..aba169dbb5 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c @@ -0,0 +1,100 @@ +/* + * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> + * Copyright 2021 Drashna Jael're @drashna + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "drashna.h" + +#define LAYOUT_charybdis_3x5_wrapper(...) LAYOUT_charybdis_3x5(__VA_ARGS__) +#define LAYOUT_charybdis_3x5_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_charybdis_3x5 ( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + ALT_T(K11), K12, K13, K14, GUI_T(K15), LGUI_T(K16), K17, K18, K19, LALT_T(K1A), \ + CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), \ + LSFT_T(KC_GRV), KC_SPC, BK_LWER, DL_RAIS, RSFT_T(KC_ENT) \ + ) +#define LAYOUT_charybdis_3x5_base_wrapper(...) LAYOUT_charybdis_3x5_base(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_DEFAULT_LAYER_1] = LAYOUT_charybdis_3x5_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + + [_DEFAULT_LAYER_2] = LAYOUT_charybdis_3x5_base_wrapper( + ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, + ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, + ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ + ), + [_DEFAULT_LAYER_3] = LAYOUT_charybdis_3x5_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + + [_DEFAULT_LAYER_4] = LAYOUT_charybdis_3x5_base_wrapper( + _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, + _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, + _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ + ), + + [_MOUSE] = LAYOUT_charybdis_3x5( + _______, _______, _______, S_D_MOD, DPI_MOD, KC_WH_U, _______, _______, _______, _______, + _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, + _______, _______, _______, S_D_RMOD,DPI_RMOD, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, + _______, SNIPING, _______, _______, _______ + ), + [_LOWER] = LAYOUT_charybdis_3x5_wrapper( + _________________LOWER_L1__________________, _________________LOWER_R1__________________, + _________________LOWER_L2__________________, _________________LOWER_R2__________________, + _________________LOWER_L3__________________, _________________LOWER_R3__________________, + _______, _______, _______, _______, AUTO_CTN + ), + [_RAISE] = LAYOUT_charybdis_3x5_wrapper( + _________________RAISE_L1__________________, _________________RAISE_R1__________________, + _________________RAISE_L2__________________, _________________RAISE_R2__________________, + _________________RAISE_L3__________________, _________________RAISE_R3__________________, + REBOOT, KEYLOCK, _______, _______, _______ + ), + [_ADJUST] = LAYOUT_charybdis_3x5_wrapper( + _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, + _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, + _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, + EEP_RST, KC_NUKE, _______, _______, RESET + ), +}; + +void matrix_init_keyemap(void) { setPinInputHigh(A0); } + +void matrix_scan_keymap(void) { + if (!readPin(A0)) { + reset_keyboard(); + } +} + +#ifdef USB_VBUS_PIN +bool usb_vbus_state(void) { + setPinInputLow(USB_VBUS_PIN); + wait_us(5); + return readPin(USB_VBUS_PIN); +} +#endif diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h new file mode 100644 index 0000000000..d868eae48e --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h @@ -0,0 +1,55 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include_next "mcuconf.h" + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_I2C_I2C1_RX_DMA_STREAM +#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) +#undef STM32_I2C_I2C1_TX_DMA_STREAM +#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) + +#undef STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 TRUE + +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + +#undef STM32_SPI_SPI1_RX_DMA_STREAM +#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) +#undef STM32_SPI_SPI1_TX_DMA_STREAM +#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +#undef STM32_SERIAL_USE_USART2 +#define STM32_SERIAL_USE_USART2 TRUE + +#undef STM32_UART_USART2_RX_DMA_STREAM +#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +#undef STM32_UART_USART2_TX_DMA_STREAM +#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) + +#undef STM32_GPT_USE_TIM4 +#define STM32_GPT_USE_TIM4 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..d23bf99aac --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = STM32F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +KEYBOARD_SHARED_EP = yes +MOUSE_SHARED_EP = yes + +EEPROM_DRIVER = spi +WS2812_DRIVER = pwm +SERIAL_DRIVER = usart +AUDIO_DRIVER = pwm_hardware + +AUDIO_SUPPORTED = yes +AUDIO_ENABLE = yes +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +CONSOLE_ENABLE = yes + +AUTOCORRECTION_ENABLE = yes diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h index 0b33138ec0..c3a30d2bc8 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h @@ -16,9 +16,7 @@ #pragma once -#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 } - -#define DEBOUNCE 60 +#define DEBOUNCE 45 #define ENCODER_DEFAULT_POS 0x3 #ifdef OLED_DRIVER_SH1107 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index b5310b37dd..fa1e8897ee 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -60,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_MOUSE] = LAYOUT_5x6_right( - _______, _______, _______, _______, _______, _______, DPI_CONFIG, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, + _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, DPI_CONFIG, _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN3, @@ -70,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______ ), [_GAMEPAD] = LAYOUT_5x6_right( - KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, DPI_CONFIG, _______, _______, _______, _______, _______, + KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, _______, _______, _______, _______, _______, _______, KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, _______, _______, _______, _______, _______, _______, @@ -145,7 +145,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [_MEDIA] = { { _______, _______ }, { _______, _______ } }, [_RAISE] = { { _______, _______ }, { KC_PGDN, KC_PGUP } }, [_LOWER] = { { RGB_MOD, RGB_RMOD}, { RGB_HUD, RGB_HUI } }, - [_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _F______ } }, + [_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _______ } }, }; // clang-format on #else @@ -165,5 +165,49 @@ bool encoder_update_user(uint8_t index, bool clockwise) { #endif #ifdef OLED_ENABLE +extern uint16_t typing_mode; + oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_180; } + +void oled_render_large_display(void) { + if (is_keyboard_left()) { + render_wpm_graph(54, 64); + } else { + oled_advance_page(true); + oled_advance_page(true); + + static const char PROGMEM logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + oled_write_P(logo, false); + + oled_set_cursor(1, 14); + oled_write_ln_P(PSTR("Unicode:"), false); + switch (typing_mode) { + case KC_WIDE: + oled_write_P(PSTR(" Wide"), false); + break; + case KC_SCRIPT: + oled_write_P(PSTR(" Script"), false); + break; + case KC_BLOCKS: + oled_write_P(PSTR(" Blocks"), false); + break; + case KC_REGIONAL: + oled_write_P(PSTR(" Regional"), false); + break; + case KC_AUSSIE: + oled_write_P(PSTR(" Aussie"), false); + break; + case KC_ZALGO: + oled_write_P(PSTR(" Zalgo"), false); + break; + default: + oled_write_P(PSTR(" Normal"), false); + break; + } + } +} #endif diff --git a/keyboards/splitkb/kyria/keymaps/drashna/config.h b/keyboards/splitkb/kyria/keymaps/drashna/config.h index 8239e28cdc..89a162a9b1 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/config.h +++ b/keyboards/splitkb/kyria/keymaps/drashna/config.h @@ -19,17 +19,21 @@ #define EE_HANDS #ifdef OLED_ENABLE -# define OLED_DISPLAY_128X64 +# ifdef OLED_DRIVER_SH1107 +# undef OLED_DISPLAY_128X64 +# define OLED_DISPLAY_128X128 +# endif #endif #ifdef RGBLIGHT_ENABLE # define RGBLIGHT_SLEEP -# define RGBLIGHT_LIMIT_VAL 200 +# undef RGBLIGHT_LIMIT_VAL +# define RGBLIGHT_LIMIT_VAL 120 # define RGBLIGHT_HUE_STEP 8 # define RGBLIGHT_SAT_STEP 8 # define RGBLIGHT_VAL_STEP 8 # define RGBLIGHT_SPLIT -// # define RGBLIGHT_LAYERS +# define RGBLIGHT_LAYERS #endif #define KEYLOGGER_LENGTH 10 @@ -41,3 +45,6 @@ #define BOOTMAGIC_LITE_COLUMN 7 #define BOOTMAGIC_LITE_ROW_RIGHT 4 #define BOOTMAGIC_LITE_COLUMN_RIGHT 7 + +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 diff --git a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c index 1346616b20..41ef4b2705 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c @@ -121,7 +121,32 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { // clang-format on #ifdef OLED_ENABLE -oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_180; } +oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { +#ifdef OLED_DRIVER_SH1107 + return OLED_ROTATION_0; +#else + return OLED_ROTATION_180; +#endif +} + +void oled_render_large_display(void) { + if (is_keyboard_left()) { + render_wpm_graph(54, 64); + } else { + static const char PROGMEM kyria_logo[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,240,252,255, 31, 7, 1, 0, 0,192,240,252,254,255,247,243,177,176, 48, 48, 48, 48, 48, 48, 48,120,254,135, 1, 0, 0,255,255, 0, 0, 1,135,254,120, 48, 48, 48, 48, 48, 48, 48,176,177,243,247,255,254,252,240,192, 0, 0, 1, 7, 31,255,252,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,254,255,255, 1, 1, 7, 30,120,225,129,131,131,134,134,140,140,152,152,177,183,254,248,224,255,255,224,248,254,183,177,152,152,140,140,134,134,131,131,129,225,120, 30, 7, 1, 1,255,255,254, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0,255,255, 0, 0,192,192, 48, 48, 0, 0,240,240, 0, 0, 0, 0, 0, 0,240,240, 0, 0,240,240,192,192, 48, 48, 48, 48,192,192, 0, 0, 48, 48,243,243, 0, 0, 0, 0, 0, 0, 48, 48, 48, 48, 48, 48,192,192, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,127,255,255,128,128,224,120, 30,135,129,193,193, 97, 97, 49, 49, 25, 25,141,237,127, 31, 7,255,255, 7, 31,127,237,141, 25, 25, 49, 49, 97, 97,193,193,129,135, 30,120,224,128,128,255,255,127, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0, 63, 63, 3, 3, 12, 12, 48, 48, 0, 0, 0, 0, 51, 51, 51, 51, 51, 51, 15, 15, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 63, 63, 48, 48, 0, 0, 12, 12, 51, 51, 51, 51, 51, 51, 63, 63, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 63,255,248,224,128, 0, 0, 3, 15, 63,127,255,239,207,141, 13, 12, 12, 12, 12, 12, 12, 12, 30,127,225,128, 0, 0,255,255, 0, 0,128,225,127, 30, 12, 12, 12, 12, 12, 12, 12, 13,141,207,239,255,127, 63, 15, 3, 0, 0,128,224,248,255, 63, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, 7, 15, 62,124,248,240,224,192,128, 1, 3, 7, 15, 30, 28, 60, 56,120,112,112,224,224,225,231,254,248,255,255,248,254,231,225,224,224,112,112,120, 56, 60, 28, 30, 15, 7, 3, 1,128,192,224,240,248,124, 62, 15, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + // clang-format on + oled_write_raw_P(kyria_logo, sizeof(kyria_logo)); + } +} #endif #ifdef ENCODER_ENABLE diff --git a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk index 3cdfe1becd..ddba0780a2 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk +++ b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk @@ -20,8 +20,10 @@ ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c) CTPC = yes AUTOCORRECTION_ENABLE = yes CAPS_WORD_ENABLE = yes + DEBUG_MATRIX_SCAN_RATE_ENABLE = api else LTO_ENABLE = yes BOOTLOADER = qmk-hid BOOTLOADER_SIZE = 512 + CUSTOM_UNICODE_ENABLE = no endif diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index ffc777692e..f01aab433e 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -105,16 +105,9 @@ void matrix_scan_user(void) { run_diablo_macro_check(); #endif // TAP_DANCE_ENABLE -#if defined(RGBLIGHT_ENABLE) - matrix_scan_rgb_light(); -#endif // RGBLIGHT_ENABLE #if defined(RGB_MATRIX_ENABLE) matrix_scan_rgb_matrix(); #endif -#if defined(POINTING_DEVICE_ENABLE) - matrix_scan_pointing(); -#endif - matrix_scan_secret(); matrix_scan_keymap(); diff --git a/users/drashna/config.h b/users/drashna/config.h index a6b4beb741..f55ed36bc2 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -279,7 +279,7 @@ # define OLED_DISPLAY_WIDTH 128 # define OLED_DISPLAY_HEIGHT 128 # define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) -# define OLED_BLOCK_TYPE uint16_t +# define OLED_BLOCK_TYPE uint32_t # define OLED_SOURCE_MAP \ { 0, 8, 16, 24, 32, 40, 48, 56 } # define OLED_TARGET_MAP \ @@ -288,4 +288,7 @@ # define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) # define OLED_COM_PINS COM_PINS_ALT # define OLED_IC OLED_IC_SH1107 +# ifndef OLED_BRIGHTNESS +# define OLED_BRIGHTNESS 50 +# endif #endif diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index 012a57f7e4..160a880215 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -10,7 +10,7 @@ # include "autocorrection/autocorrection.h" #endif #ifdef __AVR__ -#include <avr/wdt.h> +# include <avr/wdt.h> #endif uint16_t copy_paste_timer; @@ -36,7 +36,7 @@ __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t * @return true Continue processing keycode and send to host * @return false Stop process keycode and do not send to host */ -bool process_record_user(uint16_t keycode, keyrecord_t *record) { +bool process_record_user(uint16_t keycode, keyrecord_t *record) { // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); @@ -234,7 +234,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *re software_reset(); } return false; - } return true; } diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index db2058e5d1..5acd51da9b 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -181,7 +181,6 @@ bool process_record_aussie(uint16_t keycode, keyrecord_t *record) { bool process_record_zalgo(uint16_t keycode, keyrecord_t *record) { if ((KC_A <= keycode) && (keycode <= KC_0)) { if (record->event.pressed) { - tap_code16_nomods(keycode); int number = (rand() % (8 + 1 - 2)) + 2; @@ -285,13 +284,11 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { } else if (typing_mode == KC_ZALGO) { return process_record_zalgo(keycode, record); } - return process_unicode_common(keycode, record); + return true; } /** * @brief Initialize the default unicode mode on firmware startu * */ -void matrix_init_unicode(void) { - unicode_input_mode_init(); -} +void matrix_init_unicode(void) { unicode_input_mode_init(); } diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 440b905fd0..c850c5336f 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -1,4 +1,5 @@ /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2021 John Ezra - wpm graph * * 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 @@ -15,17 +16,17 @@ */ #include "drashna.h" -#ifdef CUSTOM_UNICODE_ENABLE +#ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" #endif #include <string.h> extern bool host_driver_disabled; -uint32_t oled_timer = 0; -char keylog_str[OLED_KEYLOGGER_LENGTH] = {0}; -static uint16_t log_timer = 0; -static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; +uint32_t oled_timer = 0; +char keylog_str[OLED_KEYLOGGER_LENGTH] = {0}; +static uint16_t log_timer = 0; +static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; deferred_token kittoken; @@ -112,7 +113,7 @@ void update_log(void) { */ void render_keylogger_status(void) { #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(1, 7); + oled_set_cursor(1, 6); #endif oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false); oled_write(keylog_str, false); @@ -127,7 +128,7 @@ void render_keylogger_status(void) { */ void render_default_layer_state(void) { #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(5, 2); + oled_set_cursor(1, 1); #endif oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); switch (get_highest_layer(default_layer_state)) { @@ -155,111 +156,166 @@ void render_default_layer_state(void) { */ void render_layer_state(void) { #ifdef OLED_DISPLAY_VERBOSE - static const char PROGMEM tri_layer_image[4][3][18] = { + // clang-format off + static const char PROGMEM tri_layer_image[][3][24] = { + // base { { - 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, - 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, - 0x20, 0x20, 0x40, 0x40, 0x80, 0x80 + 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, + 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, + 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, + 0x40, 0x80, 0x80, 0x00, 0x00, 0x00 }, { - 0x88, 0x88, 0x5D, 0x5D, 0x3E, 0x3E, - 0x7C, 0x7C, 0xF8, 0xF8, 0x7C, 0x7C, - 0x3E, 0x3E, 0x5D, 0x5D, 0x88, 0x88 + 0x00, 0x00, 0x00, 0x88, 0x88, 0x5D, + 0x5D, 0x3E, 0x3E, 0x7C, 0x7C, 0xF8, + 0xF8, 0x7C, 0x7C, 0x3E, 0x3E, 0x5D, + 0x5D, 0x88, 0x88, 0x00, 0x00, 0x00 }, { - 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, - 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, - 0x02, 0x02, 0x01, 0x01, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, + 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + // raise { { - 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, - 0xF0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF0, - 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80 + 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, + 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, + 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, + 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00 }, { - 0x88, 0x88, 0x55, 0x55, 0x23, 0x23, - 0x47, 0x47, 0x8F, 0x8F, 0x47, 0x47, - 0x23, 0x23, 0x55, 0x55, 0x88, 0x88 + 0x00, 0x00, 0x00, 0x88, 0x88, 0x55, + 0x55, 0x23, 0x23, 0x47, 0x47, 0x8F, + 0x8F, 0x47, 0x47, 0x23, 0x23, 0x55, + 0x55, 0x88, 0x88, 0x00, 0x00, 0x00 }, { - 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, - 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, - 0x02, 0x02, 0x01, 0x01, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, + 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + // lower { { - 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, - 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, - 0x20, 0x20, 0x40, 0x40, 0x80, 0x80 + 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, + 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, + 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, + 0x40, 0x80, 0x80, 0x00, 0x00, 0x00 }, { - 0x88, 0x88, 0xD5, 0xD5, 0xE2, 0xE2, - 0xC4, 0xC4, 0x88, 0x88, 0xC4, 0xC4, - 0xE2, 0xE2, 0xD5, 0xD5, 0x88, 0x88 + 0x00, 0x00, 0x00, 0x88, 0x88, 0xD5, + 0xD5, 0xE2, 0xE2, 0xC4, 0xC4, 0x88, + 0x88, 0xC4, 0xC4, 0xE2, 0xE2, 0xD5, + 0xD5, 0x88, 0x88, 0x00, 0x00, 0x00 }, { - 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, - 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07, - 0x03, 0x03, 0x01, 0x01, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, + 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + // adjust { { - 0x80, 0x80, 0x40, 0xC0, 0x60, 0xA0, - 0x50, 0xB0, 0x58, 0xA8, 0x50, 0xB0, - 0x60, 0xA0, 0x40, 0xC0, 0x80, 0x80 + 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, + 0xC0, 0x60, 0xA0, 0x50, 0xB0, 0x58, + 0xA8, 0x50, 0xB0, 0x60, 0xA0, 0x40, + 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00 }, { - 0x88, 0x88, 0x5D, 0xD5, 0x6B, 0xB6, - 0x6D, 0xD6, 0xAD, 0xDA, 0x6D, 0xD6, - 0x6B, 0xB6, 0x5D, 0xD5, 0x88, 0x88 + 0x00, 0x00, 0x00, 0x88, 0x88, 0x5D, + 0xD5, 0x6B, 0xB6, 0x6D, 0xD6, 0xAD, + 0xDA, 0x6D, 0xD6, 0x6B, 0xB6, 0x5D, + 0xD5, 0x88, 0x88, 0x00, 0x00, 0x00 }, { - 0x00, 0x00, 0x01, 0x01, 0x03, 0x02, - 0x05, 0x06, 0x0D, 0x0A, 0x05, 0x06, - 0x03, 0x02, 0x01, 0x01, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x03, 0x02, 0x05, 0x06, 0x0D, + 0x0A, 0x05, 0x06, 0x03, 0x02, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + // blank + { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }, + // better gamepad + { + { 0, 0, 0,192,224,224,112,240,240,240,240,144,144,240,240,240,240,112,224,224,192, 0, 0, 0 }, + { 128,248,255,255,255,254,252,230,195,195,230,255,255,254,247,227,246,253,254,255,255,255,248,128 }, + { 7, 15, 15, 15, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 15, 7 } + + }, + // mouse + { + { 0, 0, 0, 0, 0, 0, 0, 0,192, 32, 32, 32,160, 32, 32, 32,192, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0,240, 15, 0, 0, 0, 3, 0, 0, 0, 15,240, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 3, 6, 4, 4, 4, 4, 4, 4, 4, 6, 3, 0, 0, 0, 0, 0, 0 } } }; - uint8_t layer_is = 0; + + // clang-format on + uint8_t layer_is[4] = { 0, 4, 4, 4}; if (layer_state_is(_ADJUST)) { - layer_is = 3; + layer_is[0] = 3; } else if (layer_state_is(_RAISE)) { - layer_is = 1; + layer_is[0] = 1; } else if (layer_state_is(_LOWER)) { - layer_is = 2; + layer_is[0] = 2; } + if (layer_state_is(_MOUSE)) { + layer_is[1] = 6; + } + if (layer_state_is(_GAMEPAD)) { + layer_is[2] = 5; + } + + oled_set_cursor(1, 2); - oled_write_raw_P(tri_layer_image[layer_is][0], sizeof(tri_layer_image[0][0])); - oled_set_cursor(5, 3); + oled_write_raw_P(tri_layer_image[layer_is[0]][0], sizeof(tri_layer_image[0][0])); + oled_set_cursor(5, 2); + oled_write_raw_P(tri_layer_image[layer_is[1]][0], sizeof(tri_layer_image[0][0])); + oled_set_cursor(9, 2); + oled_write_raw_P(tri_layer_image[layer_is[2]][0], sizeof(tri_layer_image[0][0])); + oled_set_cursor(14, 2); oled_write_P(PSTR("Diablo2"), layer_state_is(_DIABLOII)); - oled_write_P(PSTR(" "), false); - oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO)); oled_advance_page(true); oled_set_cursor(1, 3); - oled_write_raw_P(tri_layer_image[layer_is][1], sizeof(tri_layer_image[0][0])); - oled_set_cursor(5, 4); - oled_write_P(PSTR("GamePad"), layer_state_is(_GAMEPAD)); - oled_write_P(PSTR(" "), false); - oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE)); + oled_write_raw_P(tri_layer_image[layer_is[0]][1], sizeof(tri_layer_image[0][0])); + oled_set_cursor(5, 3); + oled_write_raw_P(tri_layer_image[layer_is[1]][1], sizeof(tri_layer_image[0][0])); + oled_set_cursor(9, 3); + oled_write_raw_P(tri_layer_image[layer_is[2]][1], sizeof(tri_layer_image[0][0])); + oled_set_cursor(14, 3); + oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO)); oled_advance_page(true); oled_set_cursor(1, 4); - oled_write_raw_P(tri_layer_image[layer_is][2], sizeof(tri_layer_image[0][0])); - + oled_write_raw_P(tri_layer_image[layer_is[0]][2], sizeof(tri_layer_image[0][0])); + oled_set_cursor(5, 4); + oled_write_raw_P(tri_layer_image[layer_is[1]][2], sizeof(tri_layer_image[0][0])); + oled_set_cursor(9, 4); + oled_write_raw_P(tri_layer_image[layer_is[2]][2], sizeof(tri_layer_image[0][0])); + oled_set_cursor(14, 4); + oled_write_P(PSTR("Media"), layer_state_is(_MEDIA)); #else oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false); oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER)); oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE)); - oled_advance_page(true); #endif + oled_advance_page(true); } /** @@ -288,9 +344,14 @@ void render_keylock_status(uint8_t led_usb_state) { * @brief Renders the matrix scan rate to the host system * */ -void render_matrix_scan_rate(void) { +void render_matrix_scan_rate(uint8_t padding) { #ifdef DEBUG_MATRIX_SCAN_RATE oled_write_P(PSTR("MS:"), false); + if (padding) { + for (uint8_t n = padding; n > 0; n--) { + oled_write_P(PSTR(" "), false); + } + } oled_write(get_u16_str(get_matrix_scan_rate(), ' '), false); #endif } @@ -337,7 +398,7 @@ void render_bootmagic_status(void) { bool is_bootmagic_on; #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(7, 4); + oled_set_cursor(7, 3); is_bootmagic_on = !keymap_config.swap_lctl_lgui; #else is_bootmagic_on = keymap_config.swap_lctl_lgui; @@ -366,11 +427,12 @@ void render_bootmagic_status(void) { oled_write_P(PSTR(" "), false); #ifdef AUTOCORRECTION_ENABLE oled_write_P(PSTR("CRCT"), userspace_config.autocorrection); + oled_write_P(PSTR(" "), false); #else oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui); #endif #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(7, 5); + oled_set_cursor(7, 4); if (keymap_config.swap_lctl_lgui) { oled_write_P(logo[1][1], is_bootmagic_on); } else { @@ -382,6 +444,7 @@ void render_bootmagic_status(void) { #ifdef SWAP_HANDS_ENABLE oled_write_P(PSTR(" "), false); oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands); + oled_write_P(PSTR(" "), false); #endif } @@ -402,7 +465,7 @@ void render_user_status(void) { # endif #endif #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(1, 6); + oled_set_cursor(1, 5); #endif oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); #if !defined(OLED_DISPLAY_VERBOSE) @@ -434,9 +497,9 @@ void render_user_status(void) { oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false); static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}}; oled_write_P(cat_mode[0], host_driver_disabled); -#if defined(CUSTOM_UNICODE_ENABLE) - static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; - oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false); +#if defined(UNICODE_COMMON_ENABLE) + static const char PROGMEM uc_mod_status[5][3] = {{0xEC, 0xED, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0xEA, 0xEB, 0}}; + oled_write_P(uc_mod_status[get_unicode_input_mode()], false); #endif if (userspace_config.nuke_switch) { #if !defined(OLED_DISPLAY_VERBOSE) @@ -466,6 +529,67 @@ void render_wpm(uint8_t padding) { #endif } +//============= USER CONFIG PARAMS =============== +// wpm graph originally designed by john-ezra + +// for 128x128: +// max_lines_graph = 54; +// vertical_offset = 64; +// for 128x64: +// max_lines_graph = 64; +// vertical_offset = 0; + +void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) { + static uint16_t timer = 0; + static uint8_t x = OLED_DISPLAY_HEIGHT - 1; + uint8_t currwpm = get_current_wpm(); + float max_wpm = OLED_WPM_GRAPH_MAX_WPM; + + if (timer_elapsed(timer) > OLED_WPM_GRAPH_REFRESH_INTERVAL) { // check if it's been long enough before refreshing graph + x = (max_lines_graph - 1) - ((currwpm / max_wpm) * (max_lines_graph - 1)); // main calculation to plot graph line + for (uint8_t i = 0; i <= OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS - 1; i++) { // first draw actual value line + oled_write_pixel(3, x + i + vertical_offset, true); + } +# ifdef OLED_WPM_GRAPH_VERTICAL_LINE + static uint8_t vert_count = 0; + if (vert_count == OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL) { + vert_count = 0; + while (x <= (max_lines_graph - 1)) { + oled_write_pixel(3, x + vertical_offset, true); + x++; + } + } else { + for (uint8_t i = (max_lines_graph - 1); i > x; i--) { + if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) { + oled_write_pixel(3, i + vertical_offset, true); + } + } + vert_count++; + } +# else + for (int i = (max_lines_graph - 1); i > x; i--) { + if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) { + oled_write_pixel(3, i + vertical_offset, true); + } + } +# endif + oled_pan(false); // then move the entire graph one pixel to the right + static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; + for (uint8_t i = 0; i < 7; i++) { + oled_set_cursor(0, i + 8); + oled_write_raw_P(display_border, sizeof(display_border)); + oled_set_cursor(21, i + 8); + oled_write_raw_P(display_border, sizeof(display_border)); + } + static const char PROGMEM footer_image[] = {0, 3, 4, 8, 16, 32, 64, 128, 128, 128, 128, 128, 128, 128, 192, 224, 240, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 240, 224, 192, 128, 128, 128, 128, 128, 128, 128, 64, 32, 16, 8, 4, 3, 0}; + oled_set_cursor(0, 15); + + oled_write_raw_P(footer_image, sizeof(footer_image)); + + timer = timer_read(); // refresh the timer for the next iteration + } +} + #if defined(POINTING_DEVICE_ENABLE) void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) { oled_write_P(PSTR("CPI:"), false); @@ -481,11 +605,9 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) { __attribute__((weak)) void oled_driver_render_logo_right(void) { #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(0, 2); - render_default_layer_state(); -#else - render_default_layer_state(); + oled_set_cursor(0, 1); #endif + render_default_layer_state(); } // WPM-responsive animation stuff here @@ -510,8 +632,8 @@ __attribute__((weak)) void oled_driver_render_logo_right(void) { # error frame size too large #endif -static uint8_t animation_frame = 0; -static uint8_t animation_type = 0; +static uint8_t animation_frame = 0; +static uint8_t animation_type = 0; void render_kitty(void) { // Images credit j-inc(/James Incandenza) and pixelbenny. @@ -770,28 +892,28 @@ void render_kitty(void) { // clang-format on for (uint8_t i = 0; i < 4; i++) { - oled_set_cursor(1, i + 2); + oled_set_cursor(1, i + 1); oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE); } } uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { - uint32_t anim_frame_duration = 500; - // can't change animation frame duration here, otherwise, it gets stuck. - // weirdly, it seems to work fine if it's in keymap.c but not here. - // Should move this block to the deferred execution? + static uint32_t anim_frame_duration = 500; #ifdef POINTING_DEVICE_ENABLE if (tap_toggling) { - animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES; - animation_type = 3; + animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES; + animation_type = 3; anim_frame_duration = 300; } else #endif { +#ifdef WPM_ENABLE if (get_current_wpm() <= OLED_SLEEP_SPEED) { +#endif animation_frame = (animation_frame + 1) % OLED_SLEEP_FRAMES; animation_type = 0; anim_frame_duration = 500; +#ifdef WPM_ENABLE } else if (get_current_wpm() > OLED_WAKE_SPEED) { animation_frame = (animation_frame + 1) % OLED_WAKE_FRAMES; animation_type = 1; @@ -801,13 +923,14 @@ uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { animation_type = 2; anim_frame_duration = 500; } +#endif } return anim_frame_duration; } void oled_driver_render_logo_left(void) { #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(0, 2); + oled_set_cursor(0, 1); render_kitty(); # if defined(KEYBOARD_handwired_tractyl_manuform) @@ -816,39 +939,82 @@ void oled_driver_render_logo_left(void) { # elif defined(KEYBOARD_bastardkb_charybdis) oled_set_cursor(6, 0); oled_write_P(PSTR("Charybdis"), true); +# elif defined(KEYBOARD_splitkb_kyria) + oled_set_cursor(7, 0); + oled_write_P(PSTR("SplitKB"), true); # else oled_set_cursor(8, 0); oled_write_P(PSTR("Left"), true); # endif - oled_set_cursor(7, 2); -# if defined(DEBUG_MATRIX_SCAN_RATE) - render_matrix_scan_rate(); -# elif defined(WPM_ENABLE) + oled_set_cursor(7, 1); +# if defined(WPM_ENABLE) render_wpm(1); +# elif defined(DEBUG_MATRIX_SCAN_RATE) + render_matrix_scan_rate(2); # endif - oled_write_P(PSTR(" "), false); -# if defined(KEYBOARD_handwired_tractyl_manuform) - render_pointing_dpi_status(kb_config_data.device_cpi, 1); -# elif defined(KEYBOARD_bastardkb_charybdis) - render_pointing_dpi_status(, 1); + oled_set_cursor(7, 2); +# if defined(KEYBOARD_bastardkb_charybdis) + render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1); + +// credit and thanks to jaspertandy on discord for these images + static const char PROGMEM mouse_logo[3][2][16] = { + // mouse icon + { + { 0, 0, 0, 252, 2, 2, 2, 58, 2, 2, 2, 252, 0, 0, 0, 0 }, + { 0, 0, 63, 96, 64, 64, 64, 64, 64, 64, 64, 96, 63, 0, 0, 0 } + }, + // crosshair icon + { + { 128, 240, 136, 228, 146, 138, 202, 127, 202, 138, 146, 228, 136, 240, 128, 0 }, + { 0, 7, 8, 19, 36, 40, 41, 127, 41, 40, 36, 19, 8, 7, 0, 0 } + }, + // dragscroll icon + { + { 0, 0, 112, 136, 156, 2, 15, 1, 15, 2, 140, 68, 56, 0, 0, 0 }, + { 0, 0, 2, 6, 15, 28, 60, 124, 60, 28, 15, 6, 2, 0, 0, 0 } + } + }; + + + uint8_t image_index = 0; +# ifdef OLED_DISPLAY_TEST + image_index = animation_frame; +# else + if (charybdis_get_pointer_sniping_enabled()) { + image_index = 1; + } else if (charybdis_get_pointer_dragscroll_enabled()) { + image_index = 2; + } +# endif + + oled_set_cursor(17, 1); + oled_write_raw_P(mouse_logo[image_index][0], 16); + oled_set_cursor(17, 2); + oled_write_raw_P(mouse_logo[image_index][1], 16); +# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE) + render_matrix_scan_rate(2); # endif - oled_set_cursor(0, 6); + + oled_set_cursor(0, 5); #else render_default_layer_state(); #endif } -void render_status_secondary(void) { -# if defined(KEYBOARD_handwired_tractyl_manuform) +void render_status_right(void) { +#if defined(KEYBOARD_handwired_tractyl_manuform) oled_set_cursor(7, 0); oled_write_P(PSTR("Manuform"), true); -# elif defined(KEYBOARD_bastardkb_charybdis) +#elif defined(KEYBOARD_bastardkb_charybdis) oled_set_cursor(6, 0); oled_write_P(PSTR("Charybdis"), true); -# else +#elif defined(KEYBOARD_splitkb_kyria) + oled_set_cursor(8, 0); + oled_write_P(PSTR("Kyria"), true); +#else oled_set_cursor(8, 0); oled_write_P(PSTR("Right"), true); -# endif +#endif oled_driver_render_logo_right(); /* Show Keyboard Layout */ render_layer_state(); @@ -859,16 +1025,18 @@ void render_status_secondary(void) { render_keylock_status(host_keyboard_leds()); } -void render_status_main(void) { +void render_status_left(void) { oled_driver_render_logo_left(); /* Show Keyboard Layout */ render_bootmagic_status(); render_user_status(); - // render_keylogger_status(); + render_keylogger_status(); } +__attribute__((weak)) void oled_render_large_display(void) {} + __attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; } oled_rotation_t oled_init_user(oled_rotation_t rotation) { @@ -883,12 +1051,14 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { return oled_init_keymap(rotation); } +__attribute__((weak)) bool oled_task_keymap(void) { return true; } + bool oled_task_user(void) { update_log(); if (is_keyboard_master()) { #ifndef OLED_DISPLAY_TEST - if (timer_elapsed32(oled_timer) > 30000) { + if (timer_elapsed32(oled_timer) > 60000) { oled_off(); return false; } else @@ -897,14 +1067,23 @@ bool oled_task_user(void) { oled_on(); } } + + if (!oled_task_keymap()) { + return false; + } + +#if defined(OLED_DISPLAY_128X128) + oled_set_cursor(0, 7); + oled_render_large_display(); +#endif + #if defined(OLED_DISPLAY_VERBOSE) - static const char PROGMEM header_image[] = { - 0,192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32,192, 0, - 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0 - }; - static const char PROGMEM footer_image[] = { - 0, 3, 4, 8, 16, 32, 64,128,128,128,128,128,128,128,192,224,240,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,240,224,192,128,128,128,128,128,128,128, 64, 32, 16, 8, 4, 3, 0 - }; + static const char PROGMEM header_image[] = { + 0, 192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 192, 0, + // 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0 + }; + static const char PROGMEM footer_image[] = {0, 3, 4, 8, 16, 32, 64, 128, 128, 128, 128, 128, 128, 128, 192, 224, 240, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 240, 224, 192, 128, 128, 128, 128, 128, 128, 128, 64, 32, 16, 8, 4, 3, 0}; + oled_set_cursor(0, 0); oled_write_raw_P(header_image, sizeof(header_image)); oled_set_cursor(0, 1); #endif @@ -912,16 +1091,10 @@ bool oled_task_user(void) { #ifndef OLED_DISPLAY_TEST if (is_keyboard_left()) { #endif - render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) + render_status_left(); #ifndef OLED_DISPLAY_TEST } else { - render_status_secondary(); - } -#endif - -#if defined(OLED_DISPLAY_128X128) - if (is_keyboard_left()) { - render_keylogger_status(); + render_status_right(); } #endif @@ -932,7 +1105,7 @@ bool oled_task_user(void) { # else num_of_rows = 7; # endif - for (uint8_t i= 1; i < num_of_rows; i++) { + for (uint8_t i = 1; i < num_of_rows; i++) { oled_set_cursor(0, i); oled_write_raw_P(display_border, sizeof(display_border)); oled_set_cursor(21, i); diff --git a/users/drashna/oled/oled_stuff.h b/users/drashna/oled/oled_stuff.h index 6ef2ac14cd..7245f6131c 100644 --- a/users/drashna/oled/oled_stuff.h +++ b/users/drashna/oled/oled_stuff.h @@ -28,7 +28,7 @@ void render_keylogger_status(void); void render_default_layer_state(void); void render_layer_state(void); void render_keylock_status(uint8_t led_usb_state); -void render_matrix_scan_rate(void); +void render_matrix_scan_rate(uint8_t padding); void render_mod_status(uint8_t modifiers); void render_bootmagic_status(void); void render_user_status(void); @@ -37,6 +37,8 @@ void render_wpm(uint8_t padding); void render_pointing_dpi_status(uint16_t cpi, uint8_t padding); void oled_driver_render_logo_left(void); void oled_driver_render_logo_right(void); +void oled_render_large_display(void); +void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset); #if defined(OLED_DISPLAY_128X128) || defined(OLED_DISPLAY_128X64) # define OLED_DISPLAY_VERBOSE @@ -47,7 +49,7 @@ void oled_driver_render_logo_right(void); # endif # define OLED_RENDER_LAYOUT_NAME "Layout: " # define OLED_RENDER_LAYOUT_QWERTY "Qwerty" -# define OLED_RENDER_LAYOUT_COLEMAK_DH "ColemkDH" +# define OLED_RENDER_LAYOUT_COLEMAK_DH "Colemak DH" # define OLED_RENDER_LAYOUT_COLEMAK "Colemak" # define OLED_RENDER_LAYOUT_DVORAK "Dvorak" # define OLED_RENDER_LAYOUT_WORKMAN "Workman" @@ -139,3 +141,19 @@ void oled_driver_render_logo_right(void); extern char keylog_str[OLED_KEYLOGGER_LENGTH]; + +#ifndef OLED_WPM_GRAPH_MAX_WPM +# define OLED_WPM_GRAPH_MAX_WPM 120 +#endif +#ifndef OLED_WPM_GRAPH_REFRESH_INTERVAL +# define OLED_WPM_GRAPH_REFRESH_INTERVAL 300 +#endif +#ifndef OLED_WPM_GRAPH_AREA_FILL_INTERVAL +# define OLED_WPM_GRAPH_AREA_FILL_INTERVAL 3 +#endif +#ifndef OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL +# define OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL 3 +#endif +#ifndef OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS +# define OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS 2 +#endif diff --git a/users/drashna/pointing/pointing.c b/users/drashna/pointing/pointing.c index 0116ce0900..0dcfe73f34 100644 --- a/users/drashna/pointing/pointing.c +++ b/users/drashna/pointing/pointing.c @@ -42,19 +42,15 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { layer_on(_MOUSE); } } - } - return pointing_device_task_keymap(mouse_report); -} - -void matrix_scan_pointing(void) { - if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { + } else if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) { layer_off(_MOUSE); - } - if (tap_toggling) { + } else if (tap_toggling) { if (!layer_state_is(_MOUSE)) { layer_on(_MOUSE); } } + + return pointing_device_task_keymap(mouse_report); } bool process_record_pointing(uint16_t keycode, keyrecord_t* record) { @@ -86,7 +82,7 @@ bool process_record_pointing(uint16_t keycode, keyrecord_t* record) { case MO(_MOUSE): #if defined(KEYBOARD_ploopy) || defined(KEYBOARD_handwired_tractyl_manuform) case DPI_CONFIG: -#elif defined(KEYBOARD_bastardkb_charybdis) +#elif defined(KEYBOARD_bastardkb_charybdis) && !defined(NO_CHARYBDIS_KEYCODES) case SAFE_RANGE ... (CHARYBDIS_SAFE_RANGE-1): #endif case KC_MS_UP ... KC_MS_WH_RIGHT: @@ -98,6 +94,12 @@ bool process_record_pointing(uint16_t keycode, keyrecord_t* record) { record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; mouse_timer = timer_read(); break; + case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX: + break; + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + if (record->event.pressed || !record->tap.count) { + break; + } default: if (IS_NOEVENT(record->event)) break; if ((keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) && (((keycode >> 0x8) & 0xF) == _MOUSE)) { diff --git a/users/drashna/rgb/rgb_stuff.c b/users/drashna/rgb/rgb_stuff.c index e0422334aa..09071f7151 100644 --- a/users/drashna/rgb/rgb_stuff.c +++ b/users/drashna/rgb/rgb_stuff.c @@ -23,9 +23,29 @@ static bool is_enabled; static bool is_rgblight_startup; static HSV old_hsv; static uint8_t old_mode; -static uint16_t rgblight_startup_loop_timer; +deferred_token rgb_startup_token; # endif +uint32_t rgb_startup_animation(uint32_t triger_time, void *cb_arg) { + if (is_rgblight_startup && is_keyboard_master()) { + static uint8_t counter = 0; + counter++; + rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255); + if (counter >= 255) { + is_rgblight_startup = false; + if (userspace_config.rgb_layer_change) { + layer_state_set_rgb_light(layer_state); + } else { + rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode); + } + if (!is_enabled) { + rgblight_disable_noeeprom(); + } + } + } + return is_rgblight_startup ? 10 : 0; +} + void keyboard_post_init_rgb_light(void) { # if defined(RGBLIGHT_STARTUP_ANIMATION) is_enabled = rgblight_is_enabled(); @@ -40,30 +60,8 @@ void keyboard_post_init_rgb_light(void) { if (userspace_config.rgb_layer_change) { layer_state_set_rgb_light(layer_state); } -} + rgb_startup_token = defer_exec(300, rgb_startup_animation, NULL); -void matrix_scan_rgb_light(void) { -# if defined(RGBLIGHT_STARTUP_ANIMATION) - if (is_rgblight_startup && is_keyboard_master()) { - if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) { - static uint8_t counter; - counter++; - rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255); - rgblight_startup_loop_timer = sync_timer_read(); - if (counter == 255) { - is_rgblight_startup = false; - if (userspace_config.rgb_layer_change) { - layer_state_set_rgb_light(layer_state); - } else { - rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode); - } - if (!is_enabled) { - rgblight_disable_noeeprom(); - } - } - } - } -# endif } layer_state_t layer_state_set_rgb_light(layer_state_t state) { diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 553cc2cbc7..4bc71b6939 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -58,6 +58,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) endif ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes) OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION + DEFERRED_EXEC_ENABLE = yes endif endif endif diff --git a/users/drashna/split/transport_sync.c b/users/drashna/split/transport_sync.c index 2509e448cb..4c113ec257 100644 --- a/users/drashna/split/transport_sync.c +++ b/users/drashna/split/transport_sync.c @@ -8,7 +8,7 @@ # include <avr/wdt.h> #endif -#ifdef CUSTOM_UNICODE_ENABLE +#ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" extern unicode_config_t unicode_config; #endif @@ -58,7 +58,7 @@ void watchdog_handler(uint8_t in_buflen, const void* in_data, uint8_t out_buflen #endif #ifdef OLED_ENABLE -#include "oled/oled_stuff.h" +# include "oled/oled_stuff.h" void keylogger_string_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { if (initiator2target_buffer_size == OLED_KEYLOGGER_LENGTH) { memcpy(&keylog_str, initiator2target_buffer, initiator2target_buffer_size); @@ -95,7 +95,7 @@ void user_transport_update(void) { #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) user_state.tap_toggling = tap_toggling; #endif -#ifdef UNICODE_ENABLE +#ifdef UNICODE_COMMON_ENABLE user_state.unicode_mode = unicode_config.input_mode; #endif #ifdef SWAP_HANDS_ENABLE @@ -108,7 +108,7 @@ void user_transport_update(void) { keymap_config.raw = transport_keymap_config; userspace_config.raw = transport_userspace_config; user_state.raw = transport_user_state; -#ifdef UNICODE_ENABLE +#ifdef UNICODE_COMMON_ENABLE unicode_config.input_mode = user_state.unicode_mode; #endif #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) @@ -128,7 +128,7 @@ void user_transport_sync(void) { static uint32_t last_config = 0, last_sync[4], last_user_state = 0; bool needs_sync = false; #ifdef OLED_ENABLE - static char keylog_temp[OLED_KEYLOGGER_LENGTH] = { 0 }; + static char keylog_temp[OLED_KEYLOGGER_LENGTH] = {0}; #endif // Check if the state values are different @@ -228,7 +228,6 @@ void user_transport_sync(void) { } } #endif - } void housekeeping_task_user(void) { diff --git a/users/drashna/split/transport_sync.h b/users/drashna/split/transport_sync.h index 884586dfdd..f38fdcf1ef 100644 --- a/users/drashna/split/transport_sync.h +++ b/users/drashna/split/transport_sync.h @@ -15,7 +15,7 @@ typedef union { bool audio_enable :1; bool audio_clicky_enable :1; bool tap_toggling :1; - bool unicode_mode :1; + uint8_t unicode_mode :3; bool swap_hands :1; bool host_driver_disabled :1; }; |