From 2d9bb42611d13531991441bb5c12714a90fe62e5 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Sat, 8 May 2021 22:56:05 -0700 Subject: [PATCH 01/34] Add keyboards/yanghu/unicorne initial files. --- keyboards/yanghu/unicorne/config.h | 80 ++++++++++++++++++++++++ keyboards/yanghu/unicorne/f411/halconf.h | 27 ++++++++ keyboards/yanghu/unicorne/f411/mcuconf.h | 34 ++++++++++ keyboards/yanghu/unicorne/f411/rules.mk | 5 ++ keyboards/yanghu/unicorne/rules.mk | 18 ++++++ keyboards/yanghu/unicorne/unicorne.c | 20 ++++++ keyboards/yanghu/unicorne/unicorne.h | 58 +++++++++++++++++ 7 files changed, 242 insertions(+) create mode 100644 keyboards/yanghu/unicorne/config.h create mode 100644 keyboards/yanghu/unicorne/f411/halconf.h create mode 100644 keyboards/yanghu/unicorne/f411/mcuconf.h create mode 100644 keyboards/yanghu/unicorne/f411/rules.mk create mode 100644 keyboards/yanghu/unicorne/rules.mk create mode 100644 keyboards/yanghu/unicorne/unicorne.c create mode 100644 keyboards/yanghu/unicorne/unicorne.h diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h new file mode 100644 index 000000000000..c29270a12015 --- /dev/null +++ b/keyboards/yanghu/unicorne/config.h @@ -0,0 +1,80 @@ +/* Copyright 2020 Yang Hu + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0204 +#define DEVICE_VER 0x0001 +#define MANUFACTURER yanghu +#define PRODUCT unicorne + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +#define MATRIX_COL_PINS \ + { A14, A15, B13, B14, B15, A13, A0, A1, A2, A3, A6, A7 } +#define MATRIX_ROW_PINS \ + { B9, B8, A10, A9 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +#define ENCODERS_PAD_A \ + { B12, B0 } +#define ENCODERS_PAD_B \ + { B10, B2 } + +/* Audio */ +#define MUSIC_MAP + +#define AUDIO_PIN A8 +#define AUDIO_PWM_PAL_MODE 1 +#define AUDIO_PWM_DRIVER PWMD1 +#define AUDIO_PWM_CHANNEL 1 +#define AUDIO_STATE_TIMER GPTD4 + +/* RGB LED */ +#define RGB_DI_PIN B1 +#define RGBLED_NUM 8 +#define RGBLIGHT_ANIMATIONS + +#define WS2812_PWM_DRIVER PWMD3 +#define WS2812_PWM_CHANNEL 4 +#define WS2812_PWM_PAL_MODE 2 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 +#define WS2812_DMA_CHANNEL 5 +#define WS2812_EXTERNAL_PULLUP + +/* OLED display */ +#define I2C_DRIVER I2CD1 +#define I2C1_SCL_BANK GPIOB +#define I2C1_SCL 6 +#define I2C1_SCL_PAL_MODE 4 +#define I2C1_SDA_BANK GPIOB +#define I2C1_SDA 7 +#define I2C1_SDA_PAL_MODE 4 +/* Use fast mode. For more details, see: +https://www.playembedded.org/blog/stm32-i2c-chibios/#7_I2Cv1_configuration_structure */ +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 diff --git a/keyboards/yanghu/unicorne/f411/halconf.h b/keyboards/yanghu/unicorne/f411/halconf.h new file mode 100644 index 000000000000..d28ae12fde5e --- /dev/null +++ b/keyboards/yanghu/unicorne/f411/halconf.h @@ -0,0 +1,27 @@ +/* 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 . + */ + +#pragma once + +/* PWM for AUDIO and RGB LED */ +#define HAL_USE_PWM TRUE +/* GPT and PAL for Audio */ +#define HAL_USE_GPT TRUE +#define HAL_USE_PAL TRUE +/* I2C for OLED display */ +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/yanghu/unicorne/f411/mcuconf.h b/keyboards/yanghu/unicorne/f411/mcuconf.h new file mode 100644 index 000000000000..f4dc31bff28a --- /dev/null +++ b/keyboards/yanghu/unicorne/f411/mcuconf.h @@ -0,0 +1,34 @@ +/* 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 . + */ + +#pragma once + +#include_next + +/* TIM1 PWM used for audio driver */ +#undef STM32_PWM_USE_TIM1 +#define STM32_PWM_USE_TIM1 TRUE +/* TIM5 GPT used for audio driver */ +#undef STM32_GPT_USE_TIM4 +#define STM32_GPT_USE_TIM4 TRUE + +/* TIM3 used for WS2812 driver */ +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +/* I2C used for OLED display */ +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/yanghu/unicorne/f411/rules.mk b/keyboards/yanghu/unicorne/f411/rules.mk new file mode 100644 index 000000000000..4f7f52e62bf9 --- /dev/null +++ b/keyboards/yanghu/unicorne/f411/rules.mk @@ -0,0 +1,5 @@ +# MCU name +MCU = STM32F411 + +# Address of the bootloader in system memory +STM32_BOOTLOADER_ADDRESS = 0x1FFF0000 diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk new file mode 100644 index 000000000000..6a5180153403 --- /dev/null +++ b/keyboards/yanghu/unicorne/rules.mk @@ -0,0 +1,18 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +EXTRAKEY_ENABLE = yes # Audio control and System control +MOUSEKEY_ENABLE = yes # Mouse keys +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +COMMAND_ENABLE = no # Commands for debug and configuration +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +ENCODER_ENABLE = yes # Enable rotary encoder support +AUDIO_ENABLE = yes # Audio output + +OLED_DRIVER_ENABLE = yes +WS2812_DRIVER = pwm +AUDIO_DRIVER = pwm_hardware + +DEFAULT_FOLDER = yanghu/unicorne/f411 + +LAYOUTS = ortho_4x12 + diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c new file mode 100644 index 000000000000..f8ee2d0db7a1 --- /dev/null +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -0,0 +1,20 @@ +/* Copyright 2020 Yang Hu + * + * 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 "unicorne.h" + +void matrix_init_kb(void) { matrix_init_user(); } + +void matrix_scan_kb(void) { matrix_scan_user(); } diff --git a/keyboards/yanghu/unicorne/unicorne.h b/keyboards/yanghu/unicorne/unicorne.h new file mode 100644 index 000000000000..9153bd975361 --- /dev/null +++ b/keyboards/yanghu/unicorne/unicorne.h @@ -0,0 +1,58 @@ +/* Copyright 2020 Yang Hu + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ + +// clang-format off +#define LAYOUT_unicorne( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37 \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ + { KC_NO, KC_NO, K30, K31, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO} \ +} + +#define LAYOUT_kc( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37 \ +) \ +LAYOUT_unicorne( \ + KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, \ + KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, \ + KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, \ + KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 \ +) +// clang-format on + +#define LAYOUT LAYOUT_unicorne From 52da82f592c910086f709d6aa0270ab9684abbd2 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Sun, 9 May 2021 11:32:36 -0700 Subject: [PATCH 02/34] add default keymap to yanghu/unicorne --- keyboards/yanghu/unicorne/config.h | 2 - .../yanghu/unicorne/keymaps/default/keymap.c | 45 +++++++++++++++++++ keyboards/yanghu/unicorne/rules.mk | 3 -- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 keyboards/yanghu/unicorne/keymaps/default/keymap.c diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index c29270a12015..940a27800ee8 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -43,8 +43,6 @@ { B10, B2 } /* Audio */ -#define MUSIC_MAP - #define AUDIO_PIN A8 #define AUDIO_PWM_PAL_MODE 1 #define AUDIO_PWM_DRIVER PWMD1 diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c new file mode 100644 index 000000000000..54a0508cd057 --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -0,0 +1,45 @@ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _LOWER, + _RAISE, + _ADJUST, +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT_unicorne( + 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, RSFT_T(KC_ENT), + KC_LCTL, KC_LALT, LOWER, KC_ENT, KC_BSPC, KC_SPC, RAISE, KC_RGUI + ), + + [_LOWER] = LAYOUT_unicorne( + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, + _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD, + _______, KC_ESC, KC_LGUI, KC_LALT, KC_CAPS, KC_DQUO, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_PSCR, RSFT_T(KC_SPC), + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_unicorne( + _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + _______, KC_ESC, KC_RGUI, KC_RALT, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_unicorne( + RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; +// clang-format on diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index 6a5180153403..a3edc2be7d74 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -13,6 +13,3 @@ WS2812_DRIVER = pwm AUDIO_DRIVER = pwm_hardware DEFAULT_FOLDER = yanghu/unicorne/f411 - -LAYOUTS = ortho_4x12 - From d781aeb48b03a29d77a33a0cc8d5021735c9df44 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Sun, 9 May 2021 18:41:53 -0700 Subject: [PATCH 03/34] use slow i2c and enable internal pullup resistor --- keyboards/yanghu/unicorne/config.h | 4 ---- keyboards/yanghu/unicorne/f411/rules.mk | 2 ++ keyboards/yanghu/unicorne/unicorne.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index 940a27800ee8..ba36f4268447 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -69,10 +69,6 @@ #define I2C1_SDA_BANK GPIOB #define I2C1_SDA 7 #define I2C1_SDA_PAL_MODE 4 -/* Use fast mode. For more details, see: -https://www.playembedded.org/blog/stm32-i2c-chibios/#7_I2Cv1_configuration_structure */ -#define I2C1_CLOCK_SPEED 400000 -#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/yanghu/unicorne/f411/rules.mk b/keyboards/yanghu/unicorne/f411/rules.mk index 4f7f52e62bf9..95f7cdde4e31 100644 --- a/keyboards/yanghu/unicorne/f411/rules.mk +++ b/keyboards/yanghu/unicorne/f411/rules.mk @@ -2,4 +2,6 @@ MCU = STM32F411 # Address of the bootloader in system memory +# * It is chip dependent, the correct number can be looked up here: (page 359) +# * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf STM32_BOOTLOADER_ADDRESS = 0x1FFF0000 diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index f8ee2d0db7a1..aeeb13003125 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -18,3 +18,24 @@ void matrix_init_kb(void) { matrix_init_user(); } void matrix_scan_kb(void) { matrix_scan_user(); } + +// Custom i2c init to enable internal pull up resistor for i2c. +void i2c_init(void) { + static bool is_initialised = false; + if (!is_initialised) { + is_initialised = true; + + // Try releasing special pins for a short time + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT); + + chThdSleepMilliseconds(10); +#if defined(USE_GPIOV1) + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, I2C1_SCL_PAL_MODE); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, I2C1_SDA_PAL_MODE); +#else + palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); + palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); +#endif + } +} From c902aa433f300de8fbc1c96b07347140d958b6bd Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 14 May 2021 16:16:16 -0700 Subject: [PATCH 04/34] add oled to default keymaps --- keyboards/yanghu/unicorne/glcdfont.c | 239 ++++++++++++++++++ .../yanghu/unicorne/keymaps/default/config.h | 3 + .../yanghu/unicorne/keymaps/default/keymap.c | 17 +- .../yanghu/unicorne/keymaps/default/keymap.h | 8 + .../yanghu/unicorne/keymaps/default/oled.c | 123 +++++++++ .../yanghu/unicorne/keymaps/default/oled.h | 2 + .../yanghu/unicorne/keymaps/default/rules.mk | 3 + 7 files changed, 387 insertions(+), 8 deletions(-) create mode 100644 keyboards/yanghu/unicorne/glcdfont.c create mode 100644 keyboards/yanghu/unicorne/keymaps/default/config.h create mode 100644 keyboards/yanghu/unicorne/keymaps/default/keymap.h create mode 100644 keyboards/yanghu/unicorne/keymaps/default/oled.c create mode 100644 keyboards/yanghu/unicorne/keymaps/default/oled.h create mode 100644 keyboards/yanghu/unicorne/keymaps/default/rules.mk diff --git a/keyboards/yanghu/unicorne/glcdfont.c b/keyboards/yanghu/unicorne/glcdfont.c new file mode 100644 index 000000000000..687a95b3cfa7 --- /dev/null +++ b/keyboards/yanghu/unicorne/glcdfont.c @@ -0,0 +1,239 @@ +#pragma once + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x58, 0xA4, 0xA4, 0x9C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x10, 0x10, 0x10, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x00, 0x00, 0xF0, 0xF8, 0x9C, 0x0C, + 0x0C, 0x1C, 0xF8, 0xE0, 0x00, 0x00, + 0x00, 0xE0, 0xF8, 0x1C, 0x0C, 0x0C, + 0x9C, 0xF8, 0x60, 0x00, 0x00, 0x00, + 0x00, 0x0C, 0x0C, 0x0C, 0x3C, 0xF8, + 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, + 0xF0, 0xF8, 0xFC, 0xFC, 0xF8, 0xF0, + 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xC0, 0xE0, 0x70, 0x38, + 0x1C, 0x0C, 0x06, 0x86, 0x86, 0x86, + 0x86, 0x86, 0xC6, 0xC6, 0x0C, 0x1C, + 0x38, 0xF0, 0xE0, 0xC0, 0x00, 0x00, + 0x00, 0x60, 0xF8, 0x0C, 0x24, 0xE6, + 0xE6, 0x24, 0x06, 0x06, 0x24, 0xE6, + 0xE6, 0x24, 0x06, 0x06, 0x24, 0xE6, + 0xE6, 0x24, 0x0C, 0xF8, 0x60, 0x00, + 0x00, 0xE0, 0xF0, 0x18, 0x0C, 0x04, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x86, 0x86, 0xC6, 0x46, 0xE6, 0x66, + 0x04, 0x0C, 0x18, 0xF0, 0xE0, 0x00, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFE, 0x8A, 0x92, 0xA2, 0xC2, + 0xFE, 0xC2, 0xA2, 0x92, 0x0A, 0x02, + 0x82, 0xE2, 0x7A, 0x5A, 0x42, 0x42, + 0x42, 0xC2, 0xC2, 0x42, 0xFE, 0x00, + 0xFE, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x82, 0xE2, 0xFA, 0x7A, + 0xFA, 0xE2, 0x82, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, + 0x00, 0x00, 0x00, 0x81, 0x81, 0xC3, + 0xC3, 0xC3, 0xFF, 0xFF, 0xC3, 0xC3, + 0xC3, 0xFF, 0xFF, 0xC3, 0xC3, 0xC3, + 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x0F, 0x3C, 0xF0, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x06, 0x07, 0x07, 0x07, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x07, 0x07, 0x07, 0x06, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x7F, 0xFF, 0xC1, 0xC1, + 0xC1, 0xC1, 0xFF, 0x7F, 0xE0, 0x80, + 0x80, 0xC0, 0xFF, 0x7F, 0x00, 0x00, + 0x00, 0xDB, 0xFF, 0x00, 0x00, 0x1F, + 0x3F, 0x70, 0xE0, 0xC0, 0xC0, 0xFF, + 0xFF, 0xC0, 0xC0, 0xE0, 0x70, 0x3F, + 0x1F, 0x00, 0x00, 0xFF, 0xDB, 0x00, + 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, + 0xC0, 0xF8, 0xFE, 0xFF, 0xF9, 0xF1, + 0x61, 0x60, 0x3C, 0x07, 0x01, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, + 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, + 0x0E, 0x3C, 0xF0, 0xC0, 0x00, 0x00, + 0x00, 0xFF, 0x48, 0x44, 0xC2, 0xE1, + 0x7F, 0x51, 0xC2, 0xC4, 0x4C, 0x06, + 0x03, 0x0F, 0x38, 0x60, 0xC0, 0xE0, + 0x38, 0x0F, 0x00, 0x00, 0xFF, 0x00, + 0xFF, 0x00, 0x00, 0x00, 0x80, 0xE0, + 0xF8, 0x7E, 0x67, 0x63, 0x60, 0x60, + 0x60, 0x63, 0x67, 0x7E, 0xF8, 0xE0, + 0x80, 0x00, 0x00, 0x00, 0xFF, 0x00, + 0x00, 0x00, 0x0F, 0x1F, 0x39, 0x30, + 0x30, 0x18, 0x1F, 0x07, 0x00, 0x00, + 0x00, 0x07, 0x1F, 0x38, 0x30, 0x30, + 0x39, 0x1F, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, + 0x3C, 0x30, 0x30, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x07, 0x0E, + 0x1C, 0x38, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x38, 0x18, 0x18, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x06, 0x1F, 0x30, 0x20, 0x60, + 0x60, 0x20, 0x64, 0x64, 0x26, 0x67, + 0x67, 0x26, 0x64, 0x64, 0x20, 0x60, + 0x60, 0x20, 0x30, 0x1F, 0x06, 0x00, + 0x00, 0x07, 0x0F, 0x18, 0x30, 0x23, + 0x63, 0x61, 0x61, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, + 0x20, 0x30, 0x18, 0x0F, 0x07, 0x00, + 0x0C, 0x0F, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x0F, 0x0C, + 0x00, 0x7F, 0x60, 0x71, 0x53, 0x5E, + 0x4C, 0x4E, 0x5B, 0x50, 0x60, 0x70, + 0x58, 0x4C, 0x46, 0x43, 0x41, 0x43, + 0x4E, 0x78, 0x70, 0x60, 0x7F, 0x00, + 0x7F, 0x40, 0x4C, 0x4E, 0x4F, 0x43, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, + 0x4F, 0x4E, 0x4C, 0x40, 0x7F, 0x00, +}; + + diff --git a/keyboards/yanghu/unicorne/keymaps/default/config.h b/keyboards/yanghu/unicorne/keymaps/default/config.h new file mode 100644 index 000000000000..e45136003d73 --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/config.h @@ -0,0 +1,3 @@ +#ifndef OLED_FONT_H +#define OLED_FONT_H "keyboards/yanghu/unicorne/glcdfont.c" +#endif diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 54a0508cd057..c0cbefc39a87 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -1,12 +1,6 @@ #include QMK_KEYBOARD_H - -// Defines names for use in layer keycodes and the keymap -enum layer_names { - _BASE, - _LOWER, - _RAISE, - _ADJUST, -}; +#include "keymap.h" +#include "oled.h" #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) @@ -43,3 +37,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; // clang-format on + +bool led_update_user(led_t led_state) { +#ifdef OLED_DRIVER_ENABLE + oled_render_capslock(led_state.caps_lock); +#endif + return true; +} diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.h b/keyboards/yanghu/unicorne/keymaps/default/keymap.h new file mode 100644 index 000000000000..985736ef871f --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.h @@ -0,0 +1,8 @@ +#pragma once +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _LOWER, + _RAISE, + _ADJUST, +}; diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c new file mode 100644 index 000000000000..8155fafc97e5 --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -0,0 +1,123 @@ +#include QMK_KEYBOARD_H +#include "keymap.h" +#include "oled.h" + +// The oled is vertical. Need to rotate 270 degrees. +oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } + +char keylog_str[24] = {}; + +const char code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + +void set_keylog(uint16_t keycode, keyrecord_t *record) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + keycode = keycode & 0xFF; + } +} + +void oled_render_keylog(void) { oled_write(keylog_str, false); } + +// Some characters position: +// alt: 84 85 86/a..../c... +// shift:87 88 89/a.../c... +// ctrl: b6 b6/d.../ +// capslock: 9c-9f/b.../d... +// numlock: 98-9b/b.../d... +// navigation logo: 92-95/b2.../d2... +// symbol logo: 8a-8d/aa..../ca.... +// qmk logos; 8e-91/ae..../ce.... +void oled_render_layer(void) { + /* static const char PROGMEM cmd_logo[] = { */ + /* 0x80, 0x81, 0x82, 0x83, 10, */ + /* 0xa0, 0xa1, 0xa2, 0xa3, 10, */ + /* 0xc0, 0xc1, 0xc2, 0xc3, 10, */ + /* 0}; */ + // clang-format off + static const char PROGMEM numlock_logo[] = { + 0x98, 0x99, 0x9a, 0x9b, 10, + 0xb8, 0xb9, 0xba, 0xbb, 10, + 0xd8, 0xd9, 0xda, 0xdb, 10, 0}; + static const char PROGMEM symbol_logo[] = { + 0x8a, 0x8b, 0x8c, 0x8d, 10, + 0xaa, 0xab, 0xac, 0xad, 10, + 0xca, 0xcb, 0xcc, 0xcd, 10, 0}; + static const char PROGMEM qmk_logo[] = { + 0x8e, 0x8f, 0x90, 0x91, 10, + 0xae, 0xaf, 0xb0, 0xb1, 10, + 0xce, 0xcf, 0xd0, 0xd1, 10, 0}; + // clang-format on + if (IS_LAYER_ON(_LOWER)) { + oled_write_P(symbol_logo, false); + } else if (IS_LAYER_ON(_RAISE)) { + oled_write_P(numlock_logo, false); + } else if (IS_LAYER_ON(_BASE)) { + oled_write_P(qmk_logo, false); + } else { + if (IS_LAYER_ON(_ADJUST)) { + oled_write_ln("ADJ", false); + } else { + oled_write_ln("?????", false); + } + oled_write_ln(" ", false); + oled_write_ln(" ", false); + oled_write_ln(" ", false); + } +} + +// Oneshot mods status +uint8_t osmods; + +void oled_render_mods(void) { + static const char PROGMEM ctrl[] = {0xb6, 0xb7, 10, 0xd6, 0xd7, 10, 0x20, 0x20, 10, 0}; + static const char PROGMEM shift[] = {0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; + static const char PROGMEM alt[] = {0x84, 0x85, 0x86, 10, 0xa4, 0xa5, 0xa6, 10, 0xc4, 0xc5, 0xc6, 10, 0}; + static const char PROGMEM ctrl_alt[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0}; + + static const char PROGMEM ctrl_shift[] = {0xb6, 0xb7, 0x87, 0x88, 0x89, 0xd6, 0xd7, 0xa7, 0xa8, 0xa9, 0x20, 0x20, 0xc7, 0xc8, 0xc9, 0}; + static const char PROGMEM c_a_shift[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; + // Now check mod status and render. + static uint8_t mods; + mods = get_mods() | osmods; + if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT) && (mods & MOD_MASK_SHIFT)) { + oled_write_P(c_a_shift, false); + } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT)) { + oled_write_P(ctrl_alt, false); + } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_SHIFT)) { + oled_write_P(ctrl_shift, false); + } else if ((mods & MOD_MASK_SHIFT) && (mods & MOD_MASK_ALT)) { + oled_write_P(alt, false); + oled_write_P(shift, false); + } else if (mods & MOD_MASK_CTRL) { + oled_write_P(ctrl, false); + } else if (mods & MOD_MASK_ALT) { + oled_write_P(alt, false); + } else if (mods & MOD_MASK_SHIFT) { + oled_write_P(shift, false); + } else { + for (int i = 0; i < 6; ++i) { + oled_write_ln(" ", false); + } + } + return; +} + +void oneshot_mods_changed_user(uint8_t mods) { osmods = mods; } + +void oled_task_user(void) { + /* oled_render_keylog(); */ + oled_render_layer(); + oled_render_mods(); +} + +// Call this from "led_update_user" and use `led_state.caps_lock` to check +// the status of capslock. +void oled_render_capslock(bool caps_on) { + static const char PROGMEM capslock_logo[] = {0x9c, 0x9d, 0x9e, 0x9f, 10, 0xbc, 0xbd, 0xbe, 0xbf, 10, 0xdc, 0xdd, 0xde, 0xdf, 10, 0}; + if (caps_on) { + oled_write_P(capslock_logo, false); + } else { + for (int i = 0; i < 3; ++i) { + oled_write_ln(" ", false); + } + } +} diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.h b/keyboards/yanghu/unicorne/keymaps/default/oled.h new file mode 100644 index 000000000000..455311bc9c4b --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.h @@ -0,0 +1,2 @@ +#pragma once +void oled_render_capslock(bool caps_on); diff --git a/keyboards/yanghu/unicorne/keymaps/default/rules.mk b/keyboards/yanghu/unicorne/keymaps/default/rules.mk new file mode 100644 index 000000000000..11a39e2d3cf9 --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/rules.mk @@ -0,0 +1,3 @@ +ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) + SRC += oled.c +endif From 7cdf2d5ef3b2fb1f902e5c9ec3fbc0ef7ef93b50 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 14 May 2021 16:51:45 -0700 Subject: [PATCH 05/34] fix unicorne default keymap --- keyboards/yanghu/unicorne/keymaps/default/config.h | 3 +-- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 3 ++- .../yanghu/unicorne/keymaps/default/{keymap.h => layers.h} | 0 keyboards/yanghu/unicorne/keymaps/default/oled.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename keyboards/yanghu/unicorne/keymaps/default/{keymap.h => layers.h} (100%) diff --git a/keyboards/yanghu/unicorne/keymaps/default/config.h b/keyboards/yanghu/unicorne/keymaps/default/config.h index e45136003d73..7da6e95da2fd 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/config.h +++ b/keyboards/yanghu/unicorne/keymaps/default/config.h @@ -1,3 +1,2 @@ -#ifndef OLED_FONT_H +#pragma once #define OLED_FONT_H "keyboards/yanghu/unicorne/glcdfont.c" -#endif diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index c0cbefc39a87..6aba9ffd4632 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -1,5 +1,5 @@ #include QMK_KEYBOARD_H -#include "keymap.h" +#include "layers.h" #include "oled.h" #define LOWER MO(_LOWER) @@ -37,6 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; // clang-format on +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } bool led_update_user(led_t led_state) { #ifdef OLED_DRIVER_ENABLE diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.h b/keyboards/yanghu/unicorne/keymaps/default/layers.h similarity index 100% rename from keyboards/yanghu/unicorne/keymaps/default/keymap.h rename to keyboards/yanghu/unicorne/keymaps/default/layers.h diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 8155fafc97e5..2e741daab30c 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -1,5 +1,5 @@ #include QMK_KEYBOARD_H -#include "keymap.h" +#include "layers.h" #include "oled.h" // The oled is vertical. Need to rotate 270 degrees. From bcb1bcbd535700f599bf06c5466b9cd7f8b77c71 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 21 May 2021 12:42:29 -0700 Subject: [PATCH 06/34] fix encoder pad direction --- keyboards/yanghu/unicorne/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index ba36f4268447..b2b0edeefe3a 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -38,9 +38,9 @@ #define DIODE_DIRECTION COL2ROW #define ENCODERS_PAD_A \ - { B12, B0 } -#define ENCODERS_PAD_B \ { B10, B2 } +#define ENCODERS_PAD_B \ + { B12, B0 } /* Audio */ #define AUDIO_PIN A8 From 51aeddab7fcf3286e71b54de9d79f7e39de1afb6 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 21 May 2021 17:05:12 -0700 Subject: [PATCH 07/34] fix marauder --- keyboards/handwired/marauder/config.h | 140 ++++++------ keyboards/handwired/marauder/info.json | 216 +++++++++--------- .../marauder/keymaps/default/keymap.c | 58 ++--- keyboards/handwired/marauder/marauder.c | 40 ++-- keyboards/handwired/marauder/marauder.h | 88 +++---- keyboards/handwired/marauder/readme.md | 18 ++ keyboards/handwired/marauder/rules.mk | 52 ++--- 7 files changed, 315 insertions(+), 297 deletions(-) create mode 100644 keyboards/handwired/marauder/readme.md diff --git a/keyboards/handwired/marauder/config.h b/keyboards/handwired/marauder/config.h index 0935e1bee17f..d96028793786 100644 --- a/keyboards/handwired/marauder/config.h +++ b/keyboards/handwired/marauder/config.h @@ -1,70 +1,70 @@ -/* Copyright 2021 BB-66 - * - * 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 . - */ - -#pragma once - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x4D52 -#define PRODUCT_ID 0x0001 -#define DEVICE_VER 0x0001 -#define MANUFACTURER BB-66 -#define PRODUCT Minshara Marauder - -/* key matrix size */ -#define MATRIX_ROWS 12 -#define MATRIX_COLS 9 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * - */ -#define MATRIX_ROW_PINS { D0, D4, C6, D7, E6, B4, B5, B7, D5, C7, F1, F0 } -#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, B0 } - -#define DIODE_DIRECTION COL2ROW - -#define RGB_DI_PIN D1 -#ifdef RGB_DI_PIN - #define RGBLED_NUM 20 - #define RGBLIGHT_HUE_STEP 8 - #define RGBLIGHT_SAT_STEP 8 - #define RGBLIGHT_VAL_STEP 8 - #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ - #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ -/*== all animations enable ==*/ - #define RGBLIGHT_ANIMATIONS -// /*== or choose animations ==*/ -// #define RGBLIGHT_EFFECT_BREATHING -// #define RGBLIGHT_EFFECT_RAINBOW_MOOD -// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL -// #define RGBLIGHT_EFFECT_SNAKE -// #define RGBLIGHT_EFFECT_KNIGHT -// #define RGBLIGHT_EFFECT_CHRISTMAS -// #define RGBLIGHT_EFFECT_STATIC_GRADIENT -// #define RGBLIGHT_EFFECT_RGB_TEST -// #define RGBLIGHT_EFFECT_ALTERNATING -#endif - -// generated by KBFirmware JSON to QMK Parser -// https://noroadsleft.github.io/kbf_qmk_converter/ +/* Copyright 2021 BB-66 + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4D52 +#define PRODUCT_ID 0x0001 +#define DEVICE_VER 0x0001 +#define MANUFACTURER BB-66 +#define PRODUCT Minshara Marauder + +/* key matrix size */ +#define MATRIX_ROWS 12 +#define MATRIX_COLS 9 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { D0, D4, C6, D7, E6, B4, B5, B7, D5, C7, F1, F0 } +#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, B0 } + +#define DIODE_DIRECTION COL2ROW + +#define RGB_DI_PIN D1 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 20 + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ + #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ + #define RGBLIGHT_ANIMATIONS +// /*== or choose animations ==*/ +// #define RGBLIGHT_EFFECT_BREATHING +// #define RGBLIGHT_EFFECT_RAINBOW_MOOD +// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL +// #define RGBLIGHT_EFFECT_SNAKE +// #define RGBLIGHT_EFFECT_KNIGHT +// #define RGBLIGHT_EFFECT_CHRISTMAS +// #define RGBLIGHT_EFFECT_STATIC_GRADIENT +// #define RGBLIGHT_EFFECT_RGB_TEST +// #define RGBLIGHT_EFFECT_ALTERNATING +#endif + +// generated by KBFirmware JSON to QMK Parser +// https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/handwired/marauder/info.json b/keyboards/handwired/marauder/info.json index cfdad5c8dcbc..f8a0429b2fae 100644 --- a/keyboards/handwired/marauder/info.json +++ b/keyboards/handwired/marauder/info.json @@ -1,108 +1,108 @@ -{ - "keyboard_name": "Minshara Marauder", - "url": "https://imgur.com/a/TvsXpq5", - "maintainer": "BB-66", - "width": 19.25, - "height": 6.5, - "layouts": { - "LAYOUT": { - "layout": [ - {"label":"K00 (D0,B6)", "x":0, "y":0}, - {"label":"K01 (D0,B2)", "x":2, "y":0}, - {"label":"K02 (D0,B3)", "x":3, "y":0}, - {"label":"K03 (D0,B1)", "x":4, "y":0}, - {"label":"K04 (D0,F7)", "x":5, "y":0}, - {"label":"K05 (D0,F6)", "x":6.5, "y":0}, - {"label":"K06 (D0,F5)", "x":7.5, "y":0}, - {"label":"K07 (D0,F4)", "x":8.5, "y":0}, - {"label":"K08 (D0,B0)", "x":9.5, "y":0}, - {"label":"K68 (B5,B0)", "x":11, "y":0}, - {"label":"K67 (B5,F4)", "x":12, "y":0}, - {"label":"K66 (B5,F5)", "x":13, "y":0}, - {"label":"K65 (B5,F6)", "x":14, "y":0}, - {"label":"K63 (B5,B1)", "x":15.25, "y":0}, - {"label":"K62 (B5,B3)", "x":16.25, "y":0}, - {"label":"K61 (B5,B2)", "x":17.25, "y":0}, - {"label":"K60 (B5,B6)", "x":18.25, "y":0}, - {"label":"K10 (D4,B6)", "x":0, "y":1.5}, - {"label":"K11 (D4,B2)", "x":1, "y":1.5}, - {"label":"K12 (D4,B3)", "x":2, "y":1.5}, - {"label":"K13 (D4,B1)", "x":3, "y":1.5}, - {"label":"K14 (D4,F7)", "x":4, "y":1.5}, - {"label":"K15 (D4,F6)", "x":5, "y":1.5}, - {"label":"K16 (D4,F5)", "x":6, "y":1.5}, - {"label":"K17 (D4,F4)", "x":7, "y":1.5}, - {"label":"K18 (D4,B0)", "x":8, "y":1.5}, - {"label":"K78 (B7,B0)", "x":9, "y":1.5}, - {"label":"K77 (B7,F4)", "x":10, "y":1.5}, - {"label":"K76 (B7,F5)", "x":11, "y":1.5}, - {"label":"K75 (B7,F6)", "x":12, "y":1.5}, - {"label":"K74 (B7,F7)", "x":13, "y":1.5, "w":2}, - {"label":"K73 (B7,B1)", "x":15.25, "y":1.5}, - {"label":"K72 (B7,B3)", "x":16.25, "y":1.5}, - {"label":"K71 (B7,B2)", "x":17.25, "y":1.5}, - {"label":"K70 (B7,B6)", "x":18.25, "y":1.5}, - {"label":"K20 (C6,B6)", "x":0, "y":2.5, "w":1.5}, - {"label":"K21 (C6,B2)", "x":1.5, "y":2.5}, - {"label":"K22 (C6,B3)", "x":2.5, "y":2.5}, - {"label":"K23 (C6,B1)", "x":3.5, "y":2.5}, - {"label":"K24 (C6,F7)", "x":4.5, "y":2.5}, - {"label":"K25 (C6,F6)", "x":5.5, "y":2.5}, - {"label":"K26 (C6,F5)", "x":6.5, "y":2.5}, - {"label":"K27 (C6,F4)", "x":7.5, "y":2.5}, - {"label":"K28 (C6,B0)", "x":8.5, "y":2.5}, - {"label":"K88 (D5,B0)", "x":9.5, "y":2.5}, - {"label":"K87 (D5,F4)", "x":10.5, "y":2.5}, - {"label":"K86 (D5,F5)", "x":11.5, "y":2.5}, - {"label":"K85 (D5,F6)", "x":12.5, "y":2.5}, - {"label":"K84 (D5,F7)", "x":13.5, "y":2.5, "w":1.5}, - {"label":"K83 (D5,B1)", "x":15.25, "y":2.5}, - {"label":"K82 (D5,B3)", "x":16.25, "y":2.5}, - {"label":"K81 (D5,B2)", "x":17.25, "y":2.5}, - {"label":"K80 (D5,B6)", "x":18.25, "y":2.5, "h":2}, - {"label":"K30 (D7,B6)", "x":0, "y":3.5, "w":1.75}, - {"label":"K31 (D7,B2)", "x":1.75, "y":3.5}, - {"label":"K32 (D7,B3)", "x":2.75, "y":3.5}, - {"label":"K33 (D7,B1)", "x":3.75, "y":3.5}, - {"label":"K34 (D7,F7)", "x":4.75, "y":3.5}, - {"label":"K35 (D7,F6)", "x":5.75, "y":3.5}, - {"label":"K36 (D7,F5)", "x":6.75, "y":3.5}, - {"label":"K37 (D7,F4)", "x":7.75, "y":3.5}, - {"label":"K38 (D7,B0)", "x":8.75, "y":3.5}, - {"label":"K98 (C7,B0)", "x":9.75, "y":3.5}, - {"label":"K97 (C7,F4)", "x":10.75, "y":3.5}, - {"label":"K96 (C7,F5)", "x":11.75, "y":3.5}, - {"label":"K95 (C7,F6)", "x":12.75, "y":3.5, "w":2.25}, - {"label":"K93 (C7,B1)", "x":15.25, "y":3.5}, - {"label":"K92 (C7,B3)", "x":16.25, "y":3.5}, - {"label":"K91 (C7,B2)", "x":17.25, "y":3.5}, - {"label":"K40 (E6,B6)", "x":0, "y":4.5, "w":2.25}, - {"label":"K41 (E6,B2)", "x":2.25, "y":4.5}, - {"label":"K42 (E6,B3)", "x":3.25, "y":4.5}, - {"label":"K43 (E6,B1)", "x":4.25, "y":4.5}, - {"label":"K44 (E6,F7)", "x":5.25, "y":4.5}, - {"label":"K45 (E6,F6)", "x":6.25, "y":4.5}, - {"label":"K46 (E6,F5)", "x":7.25, "y":4.5}, - {"label":"K47 (E6,F4)", "x":8.25, "y":4.5}, - {"label":"K48 (E6,B0)", "x":9.25, "y":4.5}, - {"label":"KA8 (F1,B0)", "x":10.25, "y":4.5}, - {"label":"KA7 (F1,F4)", "x":11.25, "y":4.5}, - {"label":"KA6 (F1,F5)", "x":12.25, "y":4.5, "w":2.75}, - {"label":"KA3 (F1,B1)", "x":15.25, "y":4.5}, - {"label":"KA2 (F1,B3)", "x":16.25, "y":4.5}, - {"label":"KA1 (F1,B2)", "x":17.25, "y":4.5}, - {"label":"KA0 (F1,B6)", "x":18.25, "y":4.5, "h":2}, - {"label":"K50 (B4,B6)", "x":0, "y":5.5, "w":1.5}, - {"label":"K51 (B4,B2)", "x":1.5, "y":5.5}, - {"label":"K52 (B4,B3)", "x":2.5, "y":5.5, "w":1.5}, - {"label":"K56 (B4,F5)", "x":4, "y":5.5, "w":7}, - {"label":"KB7 (F0,F4)", "x":11, "y":5.5, "w":1.5}, - {"label":"KB6 (F0,F5)", "x":12.5, "y":5.5}, - {"label":"KB4 (F0,F7)", "x":13.5, "y":5.5, "w":1.5}, - {"label":"KB3 (F0,B1)", "x":15.25, "y":5.5, "w":2}, - {"label":"KB1 (F0,B2)", "x":17.25, "y":5.5} - ] - } - } - ,"meta": "https://noroadsleft.github.io/kbf_qmk_converter/" -} +{ + "keyboard_name": "Minshara Marauder", + "url": "https://imgur.com/a/TvsXpq5", + "maintainer": "BB-66", + "width": 19.25, + "height": 6.5, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"K00 (D0,B6)", "x":0, "y":0}, + {"label":"K01 (D0,B2)", "x":2, "y":0}, + {"label":"K02 (D0,B3)", "x":3, "y":0}, + {"label":"K03 (D0,B1)", "x":4, "y":0}, + {"label":"K04 (D0,F7)", "x":5, "y":0}, + {"label":"K05 (D0,F6)", "x":6.5, "y":0}, + {"label":"K06 (D0,F5)", "x":7.5, "y":0}, + {"label":"K07 (D0,F4)", "x":8.5, "y":0}, + {"label":"K08 (D0,B0)", "x":9.5, "y":0}, + {"label":"K68 (B5,B0)", "x":11, "y":0}, + {"label":"K67 (B5,F4)", "x":12, "y":0}, + {"label":"K66 (B5,F5)", "x":13, "y":0}, + {"label":"K65 (B5,F6)", "x":14, "y":0}, + {"label":"K63 (B5,B1)", "x":15.25, "y":0}, + {"label":"K62 (B5,B3)", "x":16.25, "y":0}, + {"label":"K61 (B5,B2)", "x":17.25, "y":0}, + {"label":"K60 (B5,B6)", "x":18.25, "y":0}, + {"label":"K10 (D4,B6)", "x":0, "y":1.5}, + {"label":"K11 (D4,B2)", "x":1, "y":1.5}, + {"label":"K12 (D4,B3)", "x":2, "y":1.5}, + {"label":"K13 (D4,B1)", "x":3, "y":1.5}, + {"label":"K14 (D4,F7)", "x":4, "y":1.5}, + {"label":"K15 (D4,F6)", "x":5, "y":1.5}, + {"label":"K16 (D4,F5)", "x":6, "y":1.5}, + {"label":"K17 (D4,F4)", "x":7, "y":1.5}, + {"label":"K18 (D4,B0)", "x":8, "y":1.5}, + {"label":"K78 (B7,B0)", "x":9, "y":1.5}, + {"label":"K77 (B7,F4)", "x":10, "y":1.5}, + {"label":"K76 (B7,F5)", "x":11, "y":1.5}, + {"label":"K75 (B7,F6)", "x":12, "y":1.5}, + {"label":"K74 (B7,F7)", "x":13, "y":1.5, "w":2}, + {"label":"K73 (B7,B1)", "x":15.25, "y":1.5}, + {"label":"K72 (B7,B3)", "x":16.25, "y":1.5}, + {"label":"K71 (B7,B2)", "x":17.25, "y":1.5}, + {"label":"K70 (B7,B6)", "x":18.25, "y":1.5}, + {"label":"K20 (C6,B6)", "x":0, "y":2.5, "w":1.5}, + {"label":"K21 (C6,B2)", "x":1.5, "y":2.5}, + {"label":"K22 (C6,B3)", "x":2.5, "y":2.5}, + {"label":"K23 (C6,B1)", "x":3.5, "y":2.5}, + {"label":"K24 (C6,F7)", "x":4.5, "y":2.5}, + {"label":"K25 (C6,F6)", "x":5.5, "y":2.5}, + {"label":"K26 (C6,F5)", "x":6.5, "y":2.5}, + {"label":"K27 (C6,F4)", "x":7.5, "y":2.5}, + {"label":"K28 (C6,B0)", "x":8.5, "y":2.5}, + {"label":"K88 (D5,B0)", "x":9.5, "y":2.5}, + {"label":"K87 (D5,F4)", "x":10.5, "y":2.5}, + {"label":"K86 (D5,F5)", "x":11.5, "y":2.5}, + {"label":"K85 (D5,F6)", "x":12.5, "y":2.5}, + {"label":"K84 (D5,F7)", "x":13.5, "y":2.5, "w":1.5}, + {"label":"K83 (D5,B1)", "x":15.25, "y":2.5}, + {"label":"K82 (D5,B3)", "x":16.25, "y":2.5}, + {"label":"K81 (D5,B2)", "x":17.25, "y":2.5}, + {"label":"K80 (D5,B6)", "x":18.25, "y":2.5, "h":2}, + {"label":"K30 (D7,B6)", "x":0, "y":3.5, "w":1.75}, + {"label":"K31 (D7,B2)", "x":1.75, "y":3.5}, + {"label":"K32 (D7,B3)", "x":2.75, "y":3.5}, + {"label":"K33 (D7,B1)", "x":3.75, "y":3.5}, + {"label":"K34 (D7,F7)", "x":4.75, "y":3.5}, + {"label":"K35 (D7,F6)", "x":5.75, "y":3.5}, + {"label":"K36 (D7,F5)", "x":6.75, "y":3.5}, + {"label":"K37 (D7,F4)", "x":7.75, "y":3.5}, + {"label":"K38 (D7,B0)", "x":8.75, "y":3.5}, + {"label":"K98 (C7,B0)", "x":9.75, "y":3.5}, + {"label":"K97 (C7,F4)", "x":10.75, "y":3.5}, + {"label":"K96 (C7,F5)", "x":11.75, "y":3.5}, + {"label":"K95 (C7,F6)", "x":12.75, "y":3.5, "w":2.25}, + {"label":"K93 (C7,B1)", "x":15.25, "y":3.5}, + {"label":"K92 (C7,B3)", "x":16.25, "y":3.5}, + {"label":"K91 (C7,B2)", "x":17.25, "y":3.5}, + {"label":"K40 (E6,B6)", "x":0, "y":4.5, "w":2.25}, + {"label":"K41 (E6,B2)", "x":2.25, "y":4.5}, + {"label":"K42 (E6,B3)", "x":3.25, "y":4.5}, + {"label":"K43 (E6,B1)", "x":4.25, "y":4.5}, + {"label":"K44 (E6,F7)", "x":5.25, "y":4.5}, + {"label":"K45 (E6,F6)", "x":6.25, "y":4.5}, + {"label":"K46 (E6,F5)", "x":7.25, "y":4.5}, + {"label":"K47 (E6,F4)", "x":8.25, "y":4.5}, + {"label":"K48 (E6,B0)", "x":9.25, "y":4.5}, + {"label":"KA8 (F1,B0)", "x":10.25, "y":4.5}, + {"label":"KA7 (F1,F4)", "x":11.25, "y":4.5}, + {"label":"KA6 (F1,F5)", "x":12.25, "y":4.5, "w":2.75}, + {"label":"KA3 (F1,B1)", "x":15.25, "y":4.5}, + {"label":"KA2 (F1,B3)", "x":16.25, "y":4.5}, + {"label":"KA1 (F1,B2)", "x":17.25, "y":4.5}, + {"label":"KA0 (F1,B6)", "x":18.25, "y":4.5, "h":2}, + {"label":"K50 (B4,B6)", "x":0, "y":5.5, "w":1.5}, + {"label":"K51 (B4,B2)", "x":1.5, "y":5.5}, + {"label":"K52 (B4,B3)", "x":2.5, "y":5.5, "w":1.5}, + {"label":"K56 (B4,F5)", "x":4, "y":5.5, "w":7}, + {"label":"KB7 (F0,F4)", "x":11, "y":5.5, "w":1.5}, + {"label":"KB6 (F0,F5)", "x":12.5, "y":5.5}, + {"label":"KB4 (F0,F7)", "x":13.5, "y":5.5, "w":1.5}, + {"label":"KB3 (F0,B1)", "x":15.25, "y":5.5, "w":2}, + {"label":"KB1 (F0,B2)", "x":17.25, "y":5.5} + ] + } + } + ,"meta": "https://noroadsleft.github.io/kbf_qmk_converter/" +} diff --git a/keyboards/handwired/marauder/keymaps/default/keymap.c b/keyboards/handwired/marauder/keymaps/default/keymap.c index f4a3cbfc2292..932138e27c27 100644 --- a/keyboards/handwired/marauder/keymaps/default/keymap.c +++ b/keyboards/handwired/marauder/keymaps/default/keymap.c @@ -1,29 +1,29 @@ -/* Copyright 2021 BB-66 - * - * 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 QMK_KEYBOARD_H - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( - 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_PAUS, KC_PSCR, KC_SLCK, KC_ESC, - 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_KP_SLSH, KC__KP_ASTR, KC_KP_MINS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_KP_4, KC_KP_5, KC_CP_6, - 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_KP_1, KC_KP_2, KC_KP_3, KC__PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_KP_0, KC_KP_DOT - ), - -}; +/* Copyright 2021 BB-66 + * + * 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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + 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_PAUS, KC_PSCR, KC_SLCK, KC_ESC, + 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, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + 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_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_P0, KC_PDOT + ), + +}; diff --git a/keyboards/handwired/marauder/marauder.c b/keyboards/handwired/marauder/marauder.c index dcfe75fd3ce0..2b2039f1055f 100644 --- a/keyboards/handwired/marauder/marauder.c +++ b/keyboards/handwired/marauder/marauder.c @@ -1,20 +1,20 @@ -/* Copyright 2021 BB-66 - * - * 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 "marauder.h" - -// generated by KBFirmware JSON to QMK Parser -// https://noroadsleft.github.io/kbf_qmk_converter/ +/* Copyright 2021 BB-66 + * + * 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 "marauder.h" + +// generated by KBFirmware JSON to QMK Parser +// https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/handwired/marauder/marauder.h b/keyboards/handwired/marauder/marauder.h index ee098dd5cbaa..fc97b1d64213 100644 --- a/keyboards/handwired/marauder/marauder.h +++ b/keyboards/handwired/marauder/marauder.h @@ -1,44 +1,44 @@ -/* Copyright 2021 BB-66 - * - * 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 . - */ - -#pragma once - -#include "quantum.h" - -#define LAYOUT( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K68, K67, K66, K65, K63, K62, K61, K60, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K78, K77, K76, K75, K74, K73, K72, K71, K70, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K88, K87, K86, K85, K84, K83, K82, K81, K80, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K98, K97, K96, K95, K93, K92, K91, \ - K40, K41, K42, K43, K44, K45, K46, K47, K48, KA8, KA7, KA6, KA3, KA2, KA1, KA0, \ - K50, K51, K52, K56, KB7, KB6, KB4, KB3, KB1 \ -) { \ - { K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \ - { K10, K11, K12, K13, K14, K15, K16, K17, K18 }, \ - { K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \ - { K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \ - { K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \ - { K50, K51, K52, KC_NO, KC_NO, KC_NO, K56, KC_NO, KC_NO }, \ - { K60, K61, K62, K63, KC_NO, K65, K66, K67, K68 }, \ - { K70, K71, K72, K73, K74, K75, K76, K77, K78 }, \ - { K80, K81, K82, K83, K84, K85, K86, K87, K88 }, \ - { KC_NO, K91, K92, K93, KC_NO, K95, K96, K97, K98 }, \ - { KA0, KA1, KA2, KA3, KC_NO, KC_NO, KA6, KA7, KA8 }, \ - { KC_NO, KB1, KC_NO, KB3, KB4, KC_NO, KB6, KB7, KC_NO }, \ -} - -// generated by KBFirmware JSON to QMK Parser -// https://noroadsleft.github.io/kbf_qmk_converter/ +/* Copyright 2021 BB-66 + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K68, K67, K66, K65, K63, K62, K61, K60, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K78, K77, K76, K75, K74, K73, K72, K71, K70, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K88, K87, K86, K85, K84, K83, K82, K81, K80, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K98, K97, K96, K95, K93, K92, K91, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, KA8, KA7, KA6, KA3, KA2, KA1, KA0, \ + K50, K51, K52, K56, KB7, KB6, KB4, KB3, KB1 \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18 }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \ + { K50, K51, K52, KC_NO, KC_NO, KC_NO, K56, KC_NO, KC_NO }, \ + { K60, K61, K62, K63, KC_NO, K65, K66, K67, K68 }, \ + { K70, K71, K72, K73, K74, K75, K76, K77, K78 }, \ + { K80, K81, K82, K83, K84, K85, K86, K87, K88 }, \ + { KC_NO, K91, K92, K93, KC_NO, K95, K96, K97, K98 }, \ + { KA0, KA1, KA2, KA3, KC_NO, KC_NO, KA6, KA7, KA8 }, \ + { KC_NO, KB1, KC_NO, KB3, KB4, KC_NO, KB6, KB7, KC_NO }, \ +} + +// generated by KBFirmware JSON to QMK Parser +// https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/handwired/marauder/readme.md b/keyboards/handwired/marauder/readme.md new file mode 100644 index 000000000000..1a0150159fd5 --- /dev/null +++ b/keyboards/handwired/marauder/readme.md @@ -0,0 +1,18 @@ +# Marauder + +90% hand-wired mechanical keyboard in an old Razer case; built around an Elite-C v3.1 controller. + +[Build Log](https://imgur.com/a/TvsXpq5) + +* Keyboard Maintainer: [%YOUR_NAME%](https://github.com/BB-66) +* Hardware Supported: Elite-C, Razer Marauder + +Make example for this keyboard (after setting up your build environment): + + make handwired/marauder:default + +Flashing example for this keyboard: + + make handwired/marauder:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/handwired/marauder/rules.mk b/keyboards/handwired/marauder/rules.mk index 44b29351923c..1619f9537478 100644 --- a/keyboards/handwired/marauder/rules.mk +++ b/keyboards/handwired/marauder/rules.mk @@ -1,26 +1,26 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -BOOTLOADER = atmel-dfu - -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -NKRO_ENABLE = yes # USB Nkey Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth -AUDIO_ENABLE = no # Audio output -LTO_ENABLE = yes # Link Time Optimization, shrinks the output slightly - -# generated by KBFirmware JSON to QMK Parser -# https://noroadsleft.github.io/kbf_qmk_converter/ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link Time Optimization, shrinks the output slightly + +# generated by KBFirmware JSON to QMK Parser +# https://noroadsleft.github.io/kbf_qmk_converter/ From 7a0d203b6e4dceff95598f995df97f4fa4e3b576 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 21 May 2021 17:07:10 -0700 Subject: [PATCH 08/34] add led matrix configs. --- keyboards/yanghu/unicorne/config.h | 5 +++-- keyboards/yanghu/unicorne/rules.mk | 9 +++++++- keyboards/yanghu/unicorne/unicorne.c | 31 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index b2b0edeefe3a..4db476a20c20 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -38,9 +38,9 @@ #define DIODE_DIRECTION COL2ROW #define ENCODERS_PAD_A \ - { B10, B2 } -#define ENCODERS_PAD_B \ { B12, B0 } +#define ENCODERS_PAD_B \ + { B10, B2 } /* Audio */ #define AUDIO_PIN A8 @@ -52,6 +52,7 @@ /* RGB LED */ #define RGB_DI_PIN B1 #define RGBLED_NUM 8 +#define DRIVER_LED_TOTAL RGBLED_NUM #define RGBLIGHT_ANIMATIONS #define WS2812_PWM_DRIVER PWMD3 diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index a3edc2be7d74..6ba625642d9d 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -4,7 +4,6 @@ MOUSEKEY_ENABLE = yes # Mouse keys NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work COMMAND_ENABLE = no # Commands for debug and configuration BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow ENCODER_ENABLE = yes # Enable rotary encoder support AUDIO_ENABLE = yes # Audio output @@ -12,4 +11,12 @@ OLED_DRIVER_ENABLE = yes WS2812_DRIVER = pwm AUDIO_DRIVER = pwm_hardware +RGB_MATRIX_DRIVER = WS2812 +# Underglow and rgb matrix features shouldn't be on at the same time. +# Choose one. Otherwise both driver will try to change color and you'll see +# colors flickering. +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = no + + DEFAULT_FOLDER = yanghu/unicorne/f411 diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index aeeb13003125..d727bc8cdfd0 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -39,3 +39,34 @@ void i2c_init(void) { #endif } } + +// LED matrix +// physical location +// 2 3 4 5 +// +// 1 6 +// 0 7 +#ifdef RGB_MATRIX_ENABLE +// clang-format off +led_config_t g_led_config = {{ + // Key Matrix to LED Index + // Since we only have 8 LEDs, map the keys near them to the same LED. + {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5}, + {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5}, + {1, 1, 1, 0, 0, 0, 7, 7, 7, 6, 6, 6}, + {NO_LED, NO_LED, NO_LED, 0, 0, 0, 7, 7, 7, NO_LED, NO_LED, NO_LED}, +}, {// LED Index to Physical Position + {94, 60}, + {18, 44}, + {8, 10}, + {94, 10}, + {130,10}, + {216, 10}, + {208, 44}, + {130, 60} +}, {// LED Index to Flag + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, + LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL +}}; +// clang-format on +#endif From 9936fd636b47c3962095c9761a09cd2508fcd6dc Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 21 May 2021 17:16:35 -0700 Subject: [PATCH 09/34] add encoder code to default keymap. --- .../yanghu/unicorne/keymaps/default/config.h | 2 ++ .../yanghu/unicorne/keymaps/default/keymap.c | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/keyboards/yanghu/unicorne/keymaps/default/config.h b/keyboards/yanghu/unicorne/keymaps/default/config.h index 7da6e95da2fd..796201ee02eb 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/config.h +++ b/keyboards/yanghu/unicorne/keymaps/default/config.h @@ -1,2 +1,4 @@ #pragma once #define OLED_FONT_H "keyboards/yanghu/unicorne/glcdfont.c" +#define ENCODER_RESOLUTION 4 +#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_BREATHING diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 6aba9ffd4632..e6b2ff428a34 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -45,3 +45,39 @@ bool led_update_user(led_t led_state) { #endif return true; } + +// Left encoder scrolls the mousewheel. Right encoder adjusts underglow hue. +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { +#ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); +#else + tap_code(KC_PGDN); +#endif + } else { +#ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); +#else + tap_code(KC_PGUP); +#endif + } + } else { // index = 1: right encoder + if (clockwise) { +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_step(); +#else + rgblight_increase_hue_noeeprom(); +#endif + } else { +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_step_reverse(); +#else + rgblight_decrease_hue_noeeprom(); +#endif + } + } +} + +// Set underglow color to blue. +void keyboard_post_init_user(void) { rgblight_sethsv(HSV_BLUE); } From 4bb3195a50fbfc79fd6518be6d42c74966157dae Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Fri, 21 May 2021 17:23:04 -0700 Subject: [PATCH 10/34] fix encoder direction --- keyboards/yanghu/unicorne/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index 4db476a20c20..e9d89ec2b021 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -38,9 +38,9 @@ #define DIODE_DIRECTION COL2ROW #define ENCODERS_PAD_A \ - { B12, B0 } -#define ENCODERS_PAD_B \ { B10, B2 } +#define ENCODERS_PAD_B \ + { B12, B0 } /* Audio */ #define AUDIO_PIN A8 From 568706f450c37e1bd6b77a3d4e698c4d5d24f411 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Sun, 23 May 2021 16:43:34 -0700 Subject: [PATCH 11/34] add readme, info.json and update copyright for c files. --- keyboards/yanghu/unicorne/config.h | 2 +- keyboards/yanghu/unicorne/info.json | 64 +++++++++++++++++++ .../yanghu/unicorne/keymaps/default/config.h | 17 +++++ .../yanghu/unicorne/keymaps/default/keymap.c | 25 ++++++-- .../yanghu/unicorne/keymaps/default/layers.h | 16 +++++ .../yanghu/unicorne/keymaps/default/oled.c | 16 +++++ .../yanghu/unicorne/keymaps/default/oled.h | 16 +++++ .../yanghu/unicorne/keymaps/default/readme.md | 10 +++ keyboards/yanghu/unicorne/readme.md | 21 ++++++ keyboards/yanghu/unicorne/unicorne.c | 7 +- keyboards/yanghu/unicorne/unicorne.h | 2 +- 11 files changed, 185 insertions(+), 11 deletions(-) create mode 100644 keyboards/yanghu/unicorne/info.json create mode 100644 keyboards/yanghu/unicorne/keymaps/default/readme.md create mode 100644 keyboards/yanghu/unicorne/readme.md diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index e9d89ec2b021..fc5a6a251da0 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -1,4 +1,4 @@ -/* Copyright 2020 Yang Hu +/* Copyright 2021 Yang Hu * * 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 diff --git a/keyboards/yanghu/unicorne/info.json b/keyboards/yanghu/unicorne/info.json new file mode 100644 index 000000000000..3ebdb177e79c --- /dev/null +++ b/keyboards/yanghu/unicorne/info.json @@ -0,0 +1,64 @@ +{ + "keyboard_name": "Unicorne", + "url": "https://github.com/yanghu/unicorne", + "maintainer": "yanghu", + "width": 15, + "height": 4.7, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Tab", "x":0, "y":0.8}, + {"label":"Q", "x":1, "y":0.8}, + {"label":"W", "x":2, "y":0.1}, + {"label":"E", "x":3, "y":0}, + {"label":"R", "x":4, "y":0.1}, + {"label":"T", "x":5, "y":0.2}, + + {"label":"Y", "x":9, "y":0.2}, + {"label":"U", "x":10, "y":0.1}, + {"label":"I", "x":11, "y":0}, + {"label":"O", "x":12, "y":0.1}, + {"label":"P", "x":13, "y":0.8}, + {"label":"Back Space", "x":14, "y":0.8}, + + {"label":"Ctrl / Esc", "x":0, "y":1.8}, + {"label":"A", "x":1, "y":1.8}, + {"label":"S", "x":2, "y":1.1}, + {"label":"D", "x":3, "y":1}, + {"label":"F", "x":4, "y":1.1}, + {"label":"G", "x":5, "y":1.2}, + + {"label":"H", "x":9, "y":1.2}, + {"label":"J", "x":10, "y":1.1}, + {"label":"K", "x":11, "y":1}, + {"label":"L", "x":12, "y":1.1}, + {"label":";", "x":13, "y":1.8}, + {"label":"'", "x":14, "y":1.8}, + + {"label":"Shift", "x":0, "y":2.8}, + {"label":"Z", "x":1, "y":2.8}, + {"label":"X", "x":2, "y":2.1}, + {"label":"C", "x":3, "y":2}, + {"label":"V", "x":4, "y":2.1}, + {"label":"B", "x":5, "y":2.2}, + + {"label":"N", "x":9, "y":2.2}, + {"label":"M", "x":10, "y":2.1}, + {"label":",", "x":11, "y":2}, + {"label":".", "x":12, "y":2.1}, + {"label":"/", "x":13, "y":2.8}, + {"label":"Shift / Enter", "x":14, "y":2.8}, + + {"label":"Ctrl", "x":3, "y":3.7}, + {"label":"Alt", "x":4, "y":3.7}, + {"label":"Lower", "x":5, "y":3.7}, + {"label":"Enter", "x":6, "y":3.2, "h":1.5}, + + {"label":"Backspace", "x":8, "y":3.2, "h":1.5}, + {"label":"Space", "x":9, "y":3.7}, + {"label":"Raise", "x":10, "y":3.7}, + {"label":"RGUI", "x":11, "y":3.7} + ] + } + } +} diff --git a/keyboards/yanghu/unicorne/keymaps/default/config.h b/keyboards/yanghu/unicorne/keymaps/default/config.h index 796201ee02eb..27d009d65e51 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/config.h +++ b/keyboards/yanghu/unicorne/keymaps/default/config.h @@ -1,4 +1,21 @@ +/* Copyright 2021 Yang Hu + * + * 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 . + */ + #pragma once + #define OLED_FONT_H "keyboards/yanghu/unicorne/glcdfont.c" #define ENCODER_RESOLUTION 4 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_BREATHING diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index e6b2ff428a34..318ddcecc348 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -1,3 +1,20 @@ +/* Copyright 2021 Yang Hu + * + * 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 "quantum_keycodes.h" #include QMK_KEYBOARD_H #include "layers.h" #include "oled.h" @@ -9,10 +26,10 @@ // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT_unicorne( - 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, RSFT_T(KC_ENT), - KC_LCTL, KC_LALT, LOWER, KC_ENT, KC_BSPC, KC_SPC, RAISE, KC_RGUI + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + KC_LCTL, KC_LALT, LOWER, KC_ENT, KC_BSPC, KC_SPC, RAISE, KC_RGUI ), [_LOWER] = LAYOUT_unicorne( diff --git a/keyboards/yanghu/unicorne/keymaps/default/layers.h b/keyboards/yanghu/unicorne/keymaps/default/layers.h index 985736ef871f..0505d4956bab 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/layers.h +++ b/keyboards/yanghu/unicorne/keymaps/default/layers.h @@ -1,3 +1,19 @@ +/* Copyright 2021 Yang Hu + * + * 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 . + */ + #pragma once // Defines names for use in layer keycodes and the keymap enum layer_names { diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 2e741daab30c..9935fd5c395b 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -1,3 +1,19 @@ +/* Copyright 2021 Yang Hu + * + * 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 QMK_KEYBOARD_H #include "layers.h" #include "oled.h" diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.h b/keyboards/yanghu/unicorne/keymaps/default/oled.h index 455311bc9c4b..ee5b4e1902c8 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.h +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.h @@ -1,2 +1,18 @@ +/* Copyright 2021 Yang Hu + * + * 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 . + */ + #pragma once void oled_render_capslock(bool caps_on); diff --git a/keyboards/yanghu/unicorne/keymaps/default/readme.md b/keyboards/yanghu/unicorne/keymaps/default/readme.md new file mode 100644 index 000000000000..461f7aadcbd4 --- /dev/null +++ b/keyboards/yanghu/unicorne/keymaps/default/readme.md @@ -0,0 +1,10 @@ +![keymap](https://imgur.com/48cFzA5) + +# Default Unicorne Layout + +This is the default layout for Unicorne. The "lower" layer consists of symbols +and navigation, while "raises' has numbers, some other symbols and function +keys. + +Press `lower` and `raise` together activates `adjust` layer, with RGB controls, +as well as access to reset/bootloader. diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md new file mode 100644 index 000000000000..fa1bd3f4d08e --- /dev/null +++ b/keyboards/yanghu/unicorne/readme.md @@ -0,0 +1,21 @@ +# Unicorne + +![Unicorne](https://imgur.com/g1nN3b4) + +A compact 40% (3x6\_4) single-piece angled ortholinear ergo keyboard kit +inspired by crkbd, Kyria, Ferris and Reviung41. Features OLED display, audio +buzzer, RGB LED underglow as well as encoders. + +* Keyboard Maintainer: [Yang Hu](https://github.com/yanghu) +* Hardware Supported: Unicorne PCB 1.0 +* Hardware Availability: Open source design at +https://github.com/yanghu/unicorne + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb yanghu/unicorne -km default + +See the [build environment +setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make +instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more +information. diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index d727bc8cdfd0..b1936dbc428f 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -1,4 +1,4 @@ -/* Copyright 2020 Yang Hu +/* Copyright 2021 Yang Hu * * 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 @@ -30,10 +30,7 @@ void i2c_init(void) { palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT); chThdSleepMilliseconds(10); -#if defined(USE_GPIOV1) - palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, I2C1_SCL_PAL_MODE); - palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, I2C1_SDA_PAL_MODE); -#else + // Use internal pull up since we do not have pull up on i2c pins in v1 design. palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); #endif diff --git a/keyboards/yanghu/unicorne/unicorne.h b/keyboards/yanghu/unicorne/unicorne.h index 9153bd975361..da8fe9a3ea56 100644 --- a/keyboards/yanghu/unicorne/unicorne.h +++ b/keyboards/yanghu/unicorne/unicorne.h @@ -1,4 +1,4 @@ -/* Copyright 2020 Yang Hu +/* Copyright 2021 Yang Hu * * 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 From 141eef5141975eb20b6d45a909245e73f04d61f3 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 24 May 2021 00:45:34 -0700 Subject: [PATCH 12/34] fix build error by clean up include in unicorne.c --- keyboards/yanghu/unicorne/info.json | 2 +- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 1 - keyboards/yanghu/unicorne/unicorne.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/keyboards/yanghu/unicorne/info.json b/keyboards/yanghu/unicorne/info.json index 3ebdb177e79c..e27f6159a242 100644 --- a/keyboards/yanghu/unicorne/info.json +++ b/keyboards/yanghu/unicorne/info.json @@ -5,7 +5,7 @@ "width": 15, "height": 4.7, "layouts": { - "LAYOUT": { + "LAYOUT_unicorne": { "layout": [ {"label":"Tab", "x":0, "y":0.8}, {"label":"Q", "x":1, "y":0.8}, diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 318ddcecc348..1ced3f7e9df3 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -14,7 +14,6 @@ * along with this program. If not, see . */ -#include "quantum_keycodes.h" #include QMK_KEYBOARD_H #include "layers.h" #include "oled.h" diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index b1936dbc428f..0bd00ea4bed5 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -33,7 +33,6 @@ void i2c_init(void) { // Use internal pull up since we do not have pull up on i2c pins in v1 design. palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); -#endif } } From 14e2138ec1e63449ed49e337da6cec7eae10a493 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 24 May 2021 11:55:12 -0700 Subject: [PATCH 13/34] fix images in readme files --- keyboards/yanghu/unicorne/keymaps/default/readme.md | 2 +- keyboards/yanghu/unicorne/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/readme.md b/keyboards/yanghu/unicorne/keymaps/default/readme.md index 461f7aadcbd4..b6ce9e423758 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/readme.md +++ b/keyboards/yanghu/unicorne/keymaps/default/readme.md @@ -1,4 +1,4 @@ -![keymap](https://imgur.com/48cFzA5) +![keymap](https://imgur.com/48cFzA5.jpg) # Default Unicorne Layout diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index fa1bd3f4d08e..51c955708b9d 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -1,6 +1,6 @@ # Unicorne -![Unicorne](https://imgur.com/g1nN3b4) +![Unicorne](https://imgur.com/g1nN3b4.jpg) A compact 40% (3x6\_4) single-piece angled ortholinear ergo keyboard kit inspired by crkbd, Kyria, Ferris and Reviung41. Features OLED display, audio From c4ea096c7f9b216604505a000071648e88b68081 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Wed, 16 Jun 2021 18:37:14 -0700 Subject: [PATCH 14/34] Fix various issues in PR #12993 feedback. * Added copyright in glcdfont, fix include in that file. * Removed `_kc` layout and renamed layout with generic style. * Moved capslock oled update to oled.c inside `oled_task_user()`. --- keyboards/yanghu/unicorne/glcdfont.c | 28 ++++++++++++------- .../yanghu/unicorne/keymaps/default/config.h | 1 + .../yanghu/unicorne/keymaps/default/keymap.c | 18 ++++-------- .../yanghu/unicorne/keymaps/default/oled.c | 14 ++++++---- .../yanghu/unicorne/keymaps/default/oled.h | 1 - keyboards/yanghu/unicorne/readme.md | 5 ++++ keyboards/yanghu/unicorne/unicorne.h | 17 ++--------- 7 files changed, 40 insertions(+), 44 deletions(-) diff --git a/keyboards/yanghu/unicorne/glcdfont.c b/keyboards/yanghu/unicorne/glcdfont.c index 687a95b3cfa7..24c06471ff37 100644 --- a/keyboards/yanghu/unicorne/glcdfont.c +++ b/keyboards/yanghu/unicorne/glcdfont.c @@ -1,14 +1,23 @@ +/* Copyright 2021 Yang Hu + * + * 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 . + */ #pragma once -#ifdef __AVR__ - #include - #include -#elif defined(ESP8266) - #include -#else - #define PROGMEM -#endif +#include "progmem.h" +// clang-format off const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, @@ -235,5 +244,4 @@ const unsigned char font[] PROGMEM = { 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x4F, 0x4E, 0x4C, 0x40, 0x7F, 0x00, }; - - +// clang-format on diff --git a/keyboards/yanghu/unicorne/keymaps/default/config.h b/keyboards/yanghu/unicorne/keymaps/default/config.h index 27d009d65e51..e7ee9814efe6 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/config.h +++ b/keyboards/yanghu/unicorne/keymaps/default/config.h @@ -19,3 +19,4 @@ #define OLED_FONT_H "keyboards/yanghu/unicorne/glcdfont.c" #define ENCODER_RESOLUTION 4 #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_BREATHING +#define RGBLIGHT_DEFAULT_COLOR HSV_BLUE diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 1ced3f7e9df3..a3355fe7e2ad 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -17,6 +17,7 @@ #include QMK_KEYBOARD_H #include "layers.h" #include "oled.h" +#include "config.h" #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) @@ -24,28 +25,28 @@ // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_BASE] = LAYOUT_unicorne( + [_BASE] = LAYOUT_split_3x6_4( KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), KC_LCTL, KC_LALT, LOWER, KC_ENT, KC_BSPC, KC_SPC, RAISE, KC_RGUI ), - [_LOWER] = LAYOUT_unicorne( + [_LOWER] = LAYOUT_split_3x6_4( _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD, _______, KC_ESC, KC_LGUI, KC_LALT, KC_CAPS, KC_DQUO, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_PSCR, RSFT_T(KC_SPC), _______, _______, _______, _______, _______, _______, _______, _______ ), - [_RAISE] = LAYOUT_unicorne( + [_RAISE] = LAYOUT_split_3x6_4( _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_ESC, KC_RGUI, KC_RALT, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, _______, _______ ), - [_ADJUST] = LAYOUT_unicorne( + [_ADJUST] = LAYOUT_split_3x6_4( RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, @@ -55,13 +56,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } -bool led_update_user(led_t led_state) { -#ifdef OLED_DRIVER_ENABLE - oled_render_capslock(led_state.caps_lock); -#endif - return true; -} - // Left encoder scrolls the mousewheel. Right encoder adjusts underglow hue. void encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { @@ -96,4 +90,4 @@ void encoder_update_user(uint8_t index, bool clockwise) { } // Set underglow color to blue. -void keyboard_post_init_user(void) { rgblight_sethsv(HSV_BLUE); } +void keyboard_post_init_user(void) { rgblight_sethsv_noeeprom(RGBLIGHT_DEFAULT_COLOR); } diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 9935fd5c395b..a5576c05b1a2 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -119,12 +119,6 @@ void oled_render_mods(void) { void oneshot_mods_changed_user(uint8_t mods) { osmods = mods; } -void oled_task_user(void) { - /* oled_render_keylog(); */ - oled_render_layer(); - oled_render_mods(); -} - // Call this from "led_update_user" and use `led_state.caps_lock` to check // the status of capslock. void oled_render_capslock(bool caps_on) { @@ -137,3 +131,11 @@ void oled_render_capslock(bool caps_on) { } } } + +void oled_task_user(void) { + /* oled_render_keylog(); */ + oled_render_layer(); + oled_render_mods(); + led_t led_state = host_keyboard_led_state(); + oled_render_capslock(led_state.caps_lock); +} diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.h b/keyboards/yanghu/unicorne/keymaps/default/oled.h index ee5b4e1902c8..04f3578d6b77 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.h +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.h @@ -15,4 +15,3 @@ */ #pragma once -void oled_render_capslock(bool caps_on); diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index 51c955708b9d..921922fc4b5f 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -11,10 +11,15 @@ buzzer, RGB LED underglow as well as encoders. * Hardware Availability: Open source design at https://github.com/yanghu/unicorne +To enter bootloader, long press the reset button for 3-5 seconds then release. +More details can be found at [keyboard +wiki](https://github.com/yanghu/unicorne/wiki/Build-guide#testing-the-board). + Make example for this keyboard (after setting up your build environment): qmk compile -kb yanghu/unicorne -km default + See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more diff --git a/keyboards/yanghu/unicorne/unicorne.h b/keyboards/yanghu/unicorne/unicorne.h index da8fe9a3ea56..14c5f4744139 100644 --- a/keyboards/yanghu/unicorne/unicorne.h +++ b/keyboards/yanghu/unicorne/unicorne.h @@ -28,7 +28,7 @@ */ // clang-format off -#define LAYOUT_unicorne( \ +#define LAYOUT_split_3x6_4( \ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ @@ -40,19 +40,6 @@ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ { KC_NO, KC_NO, K30, K31, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO} \ } - -#define LAYOUT_kc( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K36, K37 \ -) \ -LAYOUT_unicorne( \ - KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, \ - KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, \ - KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, \ - KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 \ -) // clang-format on -#define LAYOUT LAYOUT_unicorne +#define LAYOUT LAYOUT_split_3x6_4 From 48ba881afe94c187c9ece8fddca6f5fcbddc45c1 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 21 Jun 2021 21:58:14 -0700 Subject: [PATCH 15/34] Update keyboards/yanghu/unicorne/keymaps/default/rules.mk Always include oled.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/rules.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/rules.mk b/keyboards/yanghu/unicorne/keymaps/default/rules.mk index 11a39e2d3cf9..dbfa81b6ce06 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/rules.mk +++ b/keyboards/yanghu/unicorne/keymaps/default/rules.mk @@ -1,3 +1 @@ -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) - SRC += oled.c -endif +SRC += oled.c From fb741ffa030dc83afec69e24ead945601e10d443 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 21 Jun 2021 21:58:49 -0700 Subject: [PATCH 16/34] Update keyboards/yanghu/unicorne/keymaps/default/oled.c Wrap `oled.c` with ifdef. Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/oled.c | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index a5576c05b1a2..1ac7b849cc9d 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -139,3 +139,4 @@ void oled_task_user(void) { led_t led_state = host_keyboard_led_state(); oled_render_capslock(led_state.caps_lock); } +#endif From 5b871fd15b444397e72529fdd9b1da71b56de2f7 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 21 Jun 2021 21:59:00 -0700 Subject: [PATCH 17/34] Update keyboards/yanghu/unicorne/keymaps/default/oled.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/oled.c | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 1ac7b849cc9d..03b45b35142c 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -14,6 +14,7 @@ * along with this program. If not, see . */ +#ifdef OLED_DRIVER_ENABLE #include QMK_KEYBOARD_H #include "layers.h" #include "oled.h" From a8f1b4a1d8fba67052a1df762ca43646923f6519 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 21 Jun 2021 22:32:40 -0700 Subject: [PATCH 18/34] move oled code to unicorne.c, and set weakly. --- .../yanghu/unicorne/keymaps/default/oled.c | 81 +----------------- keyboards/yanghu/unicorne/unicorne.c | 83 +++++++++++++++++++ keyboards/yanghu/unicorne/unicorne.h | 5 ++ 3 files changed, 91 insertions(+), 78 deletions(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 03b45b35142c..b3318f5f5d88 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -13,26 +13,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #ifdef OLED_DRIVER_ENABLE -#include QMK_KEYBOARD_H -#include "layers.h" -#include "oled.h" - -// The oled is vertical. Need to rotate 270 degrees. -oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } - -char keylog_str[24] = {}; - -const char code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; - -void set_keylog(uint16_t keycode, keyrecord_t *record) { - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { - keycode = keycode & 0xFF; - } -} - -void oled_render_keylog(void) { oled_write(keylog_str, false); } +# include QMK_KEYBOARD_H +# include "layers.h" +# include "oled.h" // Some characters position: // alt: 84 85 86/a..../c... @@ -81,63 +65,4 @@ void oled_render_layer(void) { } } -// Oneshot mods status -uint8_t osmods; - -void oled_render_mods(void) { - static const char PROGMEM ctrl[] = {0xb6, 0xb7, 10, 0xd6, 0xd7, 10, 0x20, 0x20, 10, 0}; - static const char PROGMEM shift[] = {0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; - static const char PROGMEM alt[] = {0x84, 0x85, 0x86, 10, 0xa4, 0xa5, 0xa6, 10, 0xc4, 0xc5, 0xc6, 10, 0}; - static const char PROGMEM ctrl_alt[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0}; - - static const char PROGMEM ctrl_shift[] = {0xb6, 0xb7, 0x87, 0x88, 0x89, 0xd6, 0xd7, 0xa7, 0xa8, 0xa9, 0x20, 0x20, 0xc7, 0xc8, 0xc9, 0}; - static const char PROGMEM c_a_shift[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; - // Now check mod status and render. - static uint8_t mods; - mods = get_mods() | osmods; - if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT) && (mods & MOD_MASK_SHIFT)) { - oled_write_P(c_a_shift, false); - } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT)) { - oled_write_P(ctrl_alt, false); - } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_SHIFT)) { - oled_write_P(ctrl_shift, false); - } else if ((mods & MOD_MASK_SHIFT) && (mods & MOD_MASK_ALT)) { - oled_write_P(alt, false); - oled_write_P(shift, false); - } else if (mods & MOD_MASK_CTRL) { - oled_write_P(ctrl, false); - } else if (mods & MOD_MASK_ALT) { - oled_write_P(alt, false); - } else if (mods & MOD_MASK_SHIFT) { - oled_write_P(shift, false); - } else { - for (int i = 0; i < 6; ++i) { - oled_write_ln(" ", false); - } - } - return; -} - -void oneshot_mods_changed_user(uint8_t mods) { osmods = mods; } - -// Call this from "led_update_user" and use `led_state.caps_lock` to check -// the status of capslock. -void oled_render_capslock(bool caps_on) { - static const char PROGMEM capslock_logo[] = {0x9c, 0x9d, 0x9e, 0x9f, 10, 0xbc, 0xbd, 0xbe, 0xbf, 10, 0xdc, 0xdd, 0xde, 0xdf, 10, 0}; - if (caps_on) { - oled_write_P(capslock_logo, false); - } else { - for (int i = 0; i < 3; ++i) { - oled_write_ln(" ", false); - } - } -} - -void oled_task_user(void) { - /* oled_render_keylog(); */ - oled_render_layer(); - oled_render_mods(); - led_t led_state = host_keyboard_led_state(); - oled_render_capslock(led_state.caps_lock); -} #endif diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index 0bd00ea4bed5..0747e8bc1ffe 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -66,3 +66,86 @@ led_config_t g_led_config = {{ }}; // clang-format on #endif + +#ifdef OLED_DRIVER_ENABLE +// OLED shared code +// The oled is vertical. Need to rotate 270 degrees. +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } + +// Render layer status on OLED. To be re-implemented by keymaps since layers are +// defined there. +__attribute__((weak)) void oled_render_layer(void) { return; } + +// Oneshot mods status +uint8_t osmods; + +__attribute__((weak)) void oled_render_mods(void) { + static const char PROGMEM ctrl[] = {0xb6, 0xb7, 10, 0xd6, 0xd7, 10, 0x20, 0x20, 10, 0}; + static const char PROGMEM shift[] = {0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; + static const char PROGMEM alt[] = {0x84, 0x85, 0x86, 10, 0xa4, 0xa5, 0xa6, 10, 0xc4, 0xc5, 0xc6, 10, 0}; + static const char PROGMEM ctrl_alt[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0}; + + static const char PROGMEM ctrl_shift[] = {0xb6, 0xb7, 0x87, 0x88, 0x89, 0xd6, 0xd7, 0xa7, 0xa8, 0xa9, 0x20, 0x20, 0xc7, 0xc8, 0xc9, 0}; + static const char PROGMEM c_a_shift[] = {0xb6, 0xb7, 0x84, 0x85, 0x86, 0xd6, 0xd7, 0xa4, 0xa5, 0xa6, 0x20, 0x20, 0xc4, 0xc5, 0xc6, 0x87, 0x88, 0x89, 10, 0xa7, 0xa8, 0xa9, 10, 0xc7, 0xc8, 0xc9, 10, 0}; + // Now check mod status and render. + static uint8_t mods; + mods = get_mods() | osmods; + if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT) && (mods & MOD_MASK_SHIFT)) { + oled_write_P(c_a_shift, false); + } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_ALT)) { + oled_write_P(ctrl_alt, false); + } else if ((mods & MOD_MASK_CTRL) && (mods & MOD_MASK_SHIFT)) { + oled_write_P(ctrl_shift, false); + } else if ((mods & MOD_MASK_SHIFT) && (mods & MOD_MASK_ALT)) { + oled_write_P(alt, false); + oled_write_P(shift, false); + } else if (mods & MOD_MASK_CTRL) { + oled_write_P(ctrl, false); + } else if (mods & MOD_MASK_ALT) { + oled_write_P(alt, false); + } else if (mods & MOD_MASK_SHIFT) { + oled_write_P(shift, false); + } else { + for (int i = 0; i < 6; ++i) { + oled_write_ln(" ", false); + } + } + return; +} + +void oneshot_mods_changed_user(uint8_t mods) { osmods = mods; } + +// Call this from "led_update_user" and use `led_state.caps_lock` to check +// the status of capslock. +__attribute__((weak)) void oled_render_capslock(bool caps_on) { + static const char PROGMEM capslock_logo[] = {0x9c, 0x9d, 0x9e, 0x9f, 10, 0xbc, 0xbd, 0xbe, 0xbf, 10, 0xdc, 0xdd, 0xde, 0xdf, 10, 0}; + if (caps_on) { + oled_write_P(capslock_logo, false); + } else { + for (int i = 0; i < 3; ++i) { + oled_write_ln(" ", false); + } + } +} + +char keylog_str[24] = {}; + +const char code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + +void set_keylog(uint16_t keycode, keyrecord_t *record) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + keycode = keycode & 0xFF; + } +} + +__attribute__((weak)) void oled_render_keylog(void) { oled_write(keylog_str, false); } + +// Keymaps can override this function +__attribute__((weak)) void oled_task_user(void) { + /* oled_render_keylog(); */ + oled_render_layer(); + oled_render_mods(); + led_t led_state = host_keyboard_led_state(); + oled_render_capslock(led_state.caps_lock); +} +#endif diff --git a/keyboards/yanghu/unicorne/unicorne.h b/keyboards/yanghu/unicorne/unicorne.h index 14c5f4744139..f3239924ccc6 100644 --- a/keyboards/yanghu/unicorne/unicorne.h +++ b/keyboards/yanghu/unicorne/unicorne.h @@ -18,6 +18,11 @@ #include "quantum.h" +#ifdef OLED_DRIVER_ENABLE +void oled_render_capslock(bool caps_on); +void oled_render_mods(void); +void oled_render_keylog(void); +#endif /* This a shortcut to help you visually see your layout. * * The first section contains all of the arguments representing the physical From b4c1100dce1b49c667a513dcc57d6983993fc16d Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:47:29 -0700 Subject: [PATCH 19/34] Update keyboards/yanghu/unicorne/config.h Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/config.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index fc5a6a251da0..12c2e63480f2 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -53,7 +53,16 @@ #define RGB_DI_PIN B1 #define RGBLED_NUM 8 #define DRIVER_LED_TOTAL RGBLED_NUM -#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE #define WS2812_PWM_DRIVER PWMD3 #define WS2812_PWM_CHANNEL 4 From 68de2b22340066ed1362c0d8eb15cc4046cbc8d9 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:47:40 -0700 Subject: [PATCH 20/34] Update keyboards/yanghu/unicorne/keymaps/default/keymap.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index a3355fe7e2ad..dbc2344c7078 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -17,7 +17,6 @@ #include QMK_KEYBOARD_H #include "layers.h" #include "oled.h" -#include "config.h" #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) From 33a0ffc229bf917285eda3a51ef1a2fd43457645 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:47:53 -0700 Subject: [PATCH 21/34] Update keyboards/yanghu/unicorne/keymaps/default/keymap.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index dbc2344c7078..773e0b31b53e 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } // Left encoder scrolls the mousewheel. Right encoder adjusts underglow hue. -void encoder_update_user(uint8_t index, bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { #ifdef MOUSEKEY_ENABLE From ec2bc6041bebf9dab0997b499a0df7faa4bdaabc Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:48:02 -0700 Subject: [PATCH 22/34] Update keyboards/yanghu/unicorne/keymaps/default/keymap.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 773e0b31b53e..132ad254b949 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -86,6 +86,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { #endif } } + return false; } // Set underglow color to blue. From 0ab64aa093e1a5b25234643349c1c67be7f404c4 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:48:10 -0700 Subject: [PATCH 23/34] Update keyboards/yanghu/unicorne/unicorne.c Co-authored-by: Drashna Jaelre --- keyboards/yanghu/unicorne/unicorne.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index 0747e8bc1ffe..a6195bbe4c48 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -15,9 +15,6 @@ */ #include "unicorne.h" -void matrix_init_kb(void) { matrix_init_user(); } - -void matrix_scan_kb(void) { matrix_scan_user(); } // Custom i2c init to enable internal pull up resistor for i2c. void i2c_init(void) { From 3a3b2a8e4cc28ccffbf49845ca1aa0f2987109fe Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:48:18 -0700 Subject: [PATCH 24/34] Update keyboards/yanghu/unicorne/readme.md Co-authored-by: Ryan --- keyboards/yanghu/unicorne/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index 921922fc4b5f..67d23cfe55f3 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -17,7 +17,7 @@ wiki](https://github.com/yanghu/unicorne/wiki/Build-guide#testing-the-board). Make example for this keyboard (after setting up your build environment): - qmk compile -kb yanghu/unicorne -km default + make yanghu/unicorne:default See the [build environment From ea6944c923ba56c3ed15ae3868fc31f27fc82e7c Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:48:30 -0700 Subject: [PATCH 25/34] Update keyboards/yanghu/unicorne/readme.md Co-authored-by: Ryan --- keyboards/yanghu/unicorne/readme.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index 67d23cfe55f3..6b00ef15af94 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -19,8 +19,4 @@ Make example for this keyboard (after setting up your build environment): make yanghu/unicorne:default - -See the [build environment -setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make -instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more -information. +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). From 613af584cd4d7e3d282af88d4e56430d08a4c481 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:48:45 -0700 Subject: [PATCH 26/34] Update keyboards/yanghu/unicorne/readme.md Co-authored-by: Ryan --- keyboards/yanghu/unicorne/readme.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index 6b00ef15af94..242bfa0b21f8 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -2,18 +2,13 @@ ![Unicorne](https://imgur.com/g1nN3b4.jpg) -A compact 40% (3x6\_4) single-piece angled ortholinear ergo keyboard kit -inspired by crkbd, Kyria, Ferris and Reviung41. Features OLED display, audio -buzzer, RGB LED underglow as well as encoders. +A compact 40% (3x6\_4) single-piece angled ortholinear ergo keyboard kit inspired by crkbd, Kyria, Ferris and Reviung41. Features OLED display, audio buzzer, RGB LED underglow as well as encoders. -* Keyboard Maintainer: [Yang Hu](https://github.com/yanghu) -* Hardware Supported: Unicorne PCB 1.0 -* Hardware Availability: Open source design at -https://github.com/yanghu/unicorne +* Keyboard Maintainer: [Yang Hu](https://github.com/yanghu) +* Hardware Supported: Unicorne PCB 1.0 +* Hardware Availability: Open source design at https://github.com/yanghu/unicorne -To enter bootloader, long press the reset button for 3-5 seconds then release. -More details can be found at [keyboard -wiki](https://github.com/yanghu/unicorne/wiki/Build-guide#testing-the-board). +To enter bootloader, long press the reset button for 3-5 seconds then release. More details can be found at [keyboard wiki](https://github.com/yanghu/unicorne/wiki/Build-guide#testing-the-board). Make example for this keyboard (after setting up your build environment): From 94d6d5738d53e50c3b05ba82ba5173ba63ade280 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:49:11 -0700 Subject: [PATCH 27/34] Update keyboards/yanghu/unicorne/readme.md Co-authored-by: Ryan --- keyboards/yanghu/unicorne/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/readme.md b/keyboards/yanghu/unicorne/readme.md index 242bfa0b21f8..3da5e97bf4f9 100644 --- a/keyboards/yanghu/unicorne/readme.md +++ b/keyboards/yanghu/unicorne/readme.md @@ -1,6 +1,6 @@ # Unicorne -![Unicorne](https://imgur.com/g1nN3b4.jpg) +![Unicorne](https://imgur.com/g1nN3b4h.jpg) A compact 40% (3x6\_4) single-piece angled ortholinear ergo keyboard kit inspired by crkbd, Kyria, Ferris and Reviung41. Features OLED display, audio buzzer, RGB LED underglow as well as encoders. From 2fd61ec2812190388b635fdf424a5ef404b00115 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:49:27 -0700 Subject: [PATCH 28/34] Update keyboards/yanghu/unicorne/keymaps/default/oled.c Co-authored-by: Ryan --- keyboards/yanghu/unicorne/keymaps/default/oled.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index b3318f5f5d88..71d5c5d8e052 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -16,7 +16,6 @@ #ifdef OLED_DRIVER_ENABLE # include QMK_KEYBOARD_H # include "layers.h" -# include "oled.h" // Some characters position: // alt: 84 85 86/a..../c... From ecb23cd2c56436e029833f398858a062bc12c984 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:49:37 -0700 Subject: [PATCH 29/34] Update keyboards/yanghu/unicorne/f411/rules.mk Co-authored-by: Ryan --- keyboards/yanghu/unicorne/f411/rules.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/keyboards/yanghu/unicorne/f411/rules.mk b/keyboards/yanghu/unicorne/f411/rules.mk index 95f7cdde4e31..b32a8b7f5bda 100644 --- a/keyboards/yanghu/unicorne/f411/rules.mk +++ b/keyboards/yanghu/unicorne/f411/rules.mk @@ -1,7 +1,5 @@ # MCU name MCU = STM32F411 -# Address of the bootloader in system memory -# * It is chip dependent, the correct number can be looked up here: (page 359) -# * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -STM32_BOOTLOADER_ADDRESS = 0x1FFF0000 +# Bootloader selection +BOOTLOADER = stm32-dfu From 6782cfb4725f2c97b83fb44ce723135a1d32eea4 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 17:50:28 -0700 Subject: [PATCH 30/34] Update keyboards/yanghu/unicorne/rules.mk Co-authored-by: Ryan --- keyboards/yanghu/unicorne/rules.mk | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index 6ba625642d9d..996993ec3705 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -1,22 +1,25 @@ +# Build Options +# change yes to no to disable BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration -EXTRAKEY_ENABLE = yes # Audio control and System control MOUSEKEY_ENABLE = yes # Mouse keys -NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -ENCODER_ENABLE = yes # Enable rotary encoder support +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = yes # Audio output - +ENCODER_ENABLE = yes OLED_DRIVER_ENABLE = yes + WS2812_DRIVER = pwm AUDIO_DRIVER = pwm_hardware +RGB_MATRIX_ENABLE = no # Do not enable with RGBLIGHT RGB_MATRIX_DRIVER = WS2812 -# Underglow and rgb matrix features shouldn't be on at the same time. -# Choose one. Otherwise both driver will try to change color and you'll see -# colors flickering. -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -RGB_MATRIX_ENABLE = no - DEFAULT_FOLDER = yanghu/unicorne/f411 From 9892a23c0dec12cdb31543cd918e517b7ef30fa6 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Thu, 19 Aug 2021 18:01:09 -0700 Subject: [PATCH 31/34] remove oled.h --- .../yanghu/unicorne/keymaps/default/oled.h | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 keyboards/yanghu/unicorne/keymaps/default/oled.h diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.h b/keyboards/yanghu/unicorne/keymaps/default/oled.h deleted file mode 100644 index 04f3578d6b77..000000000000 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2021 Yang Hu - * - * 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 . - */ - -#pragma once From 4fb8dd5ae6c768cfe029facb39f307818f581784 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Sat, 21 Aug 2021 18:33:32 -0700 Subject: [PATCH 32/34] remove include of oled.h after the file is deleted. --- keyboards/yanghu/unicorne/keymaps/default/keymap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/keymap.c b/keyboards/yanghu/unicorne/keymaps/default/keymap.c index 132ad254b949..26fb01426097 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/keymap.c +++ b/keyboards/yanghu/unicorne/keymaps/default/keymap.c @@ -16,7 +16,6 @@ #include QMK_KEYBOARD_H #include "layers.h" -#include "oled.h" #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) From 350cba7a2e489f9edf98d0c19703ee2c030ca150 Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 11 Oct 2021 13:45:56 -0700 Subject: [PATCH 33/34] Apply suggestions from code review: remove redundant macros and reformat. Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/yanghu/unicorne/config.h | 8 -------- keyboards/yanghu/unicorne/info.json | 2 -- keyboards/yanghu/unicorne/rules.mk | 4 ++-- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index 12c2e63480f2..652afeb3b473 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -71,14 +71,6 @@ #define WS2812_DMA_CHANNEL 5 #define WS2812_EXTERNAL_PULLUP -/* OLED display */ -#define I2C_DRIVER I2CD1 -#define I2C1_SCL_BANK GPIOB -#define I2C1_SCL 6 -#define I2C1_SCL_PAL_MODE 4 -#define I2C1_SDA_BANK GPIOB -#define I2C1_SDA 7 -#define I2C1_SDA_PAL_MODE 4 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/yanghu/unicorne/info.json b/keyboards/yanghu/unicorne/info.json index e27f6159a242..995bed8a03b4 100644 --- a/keyboards/yanghu/unicorne/info.json +++ b/keyboards/yanghu/unicorne/info.json @@ -2,8 +2,6 @@ "keyboard_name": "Unicorne", "url": "https://github.com/yanghu/unicorne", "maintainer": "yanghu", - "width": 15, - "height": 4.7, "layouts": { "LAYOUT_unicorne": { "layout": [ diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index 996993ec3705..44f298a28d92 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -1,6 +1,7 @@ # Build Options # change yes to no to disable -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug @@ -11,7 +12,6 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = yes # Audio output ENCODER_ENABLE = yes OLED_DRIVER_ENABLE = yes From e029c958c1448414add813a99024d85c85c4de0a Mon Sep 17 00:00:00 2001 From: Yang Hu Date: Mon, 11 Oct 2021 13:47:33 -0700 Subject: [PATCH 34/34] Apply suggestions from code review: change OLED driver macro. Use `OLED_ENABLE` instead of `OLED_DRIVER_ENABLE`. Co-authored-by: Jonathan Rascher --- keyboards/yanghu/unicorne/keymaps/default/oled.c | 2 +- keyboards/yanghu/unicorne/rules.mk | 3 ++- keyboards/yanghu/unicorne/unicorne.c | 2 +- keyboards/yanghu/unicorne/unicorne.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/keyboards/yanghu/unicorne/keymaps/default/oled.c b/keyboards/yanghu/unicorne/keymaps/default/oled.c index 71d5c5d8e052..417f573ff03c 100644 --- a/keyboards/yanghu/unicorne/keymaps/default/oled.c +++ b/keyboards/yanghu/unicorne/keymaps/default/oled.c @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include QMK_KEYBOARD_H # include "layers.h" diff --git a/keyboards/yanghu/unicorne/rules.mk b/keyboards/yanghu/unicorne/rules.mk index 44f298a28d92..17296a9bc2d4 100644 --- a/keyboards/yanghu/unicorne/rules.mk +++ b/keyboards/yanghu/unicorne/rules.mk @@ -14,7 +14,8 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = yes # Audio output ENCODER_ENABLE = yes -OLED_DRIVER_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 WS2812_DRIVER = pwm AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/yanghu/unicorne/unicorne.c b/keyboards/yanghu/unicorne/unicorne.c index a6195bbe4c48..27b87253df25 100644 --- a/keyboards/yanghu/unicorne/unicorne.c +++ b/keyboards/yanghu/unicorne/unicorne.c @@ -64,7 +64,7 @@ led_config_t g_led_config = {{ // clang-format on #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE // OLED shared code // The oled is vertical. Need to rotate 270 degrees. __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } diff --git a/keyboards/yanghu/unicorne/unicorne.h b/keyboards/yanghu/unicorne/unicorne.h index f3239924ccc6..f0b5685f1d8f 100644 --- a/keyboards/yanghu/unicorne/unicorne.h +++ b/keyboards/yanghu/unicorne/unicorne.h @@ -18,7 +18,7 @@ #include "quantum.h" -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE void oled_render_capslock(bool caps_on); void oled_render_mods(void); void oled_render_keylog(void);