diff --git a/keyboards/zompi/config.h b/keyboards/zompi/config.h index d730a471d3..a7ce018838 100644 --- a/keyboards/zompi/config.h +++ b/keyboards/zompi/config.h @@ -29,11 +29,15 @@ #define MATRIX_ROWS 8 #define MATRIX_COLS 5 -#define RGBLIGHT_LIMIT_VAL 180 -#define MATRIX_ROW_PINS { GP2, GP3, GP4, GP5 } -#define MATRIX_COL_PINS { GP6, GP7, GP8, GP14, GP15 } +#define MATRIX_ROW_PINS { GP9, GP10, GP4, GP5 } +#define MATRIX_COL_PINS { GP6, GP7, GP8, GP11, GP12 } -#define DIODE_DIRECTION ROW2COL - -#define DEBOUNCE 5 +#ifdef OLED_ENABLE +# define OLED_DISPLAY_128X32 +#define I2C1_SCL_PIN GP3 +#define I2C1_SDA_PIN GP2 +#define I2C_DRIVER I2CD2 +#define OLED_BRIGHTNESS 128 +//#define OLED_FONT_H "keyboards/mlego/m65/lib/glcdfont.c" +#endif diff --git a/keyboards/zompi/halconf.h b/keyboards/zompi/halconf.h new file mode 100644 index 0000000000..a82f19a812 --- /dev/null +++ b/keyboards/zompi/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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f401/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next + diff --git a/keyboards/zompi/info.json b/keyboards/zompi/info.json index 8bb0895c03..8174dfe671 100644 --- a/keyboards/zompi/info.json +++ b/keyboards/zompi/info.json @@ -2,6 +2,33 @@ "keyboard_name": "Zompi", "url": "https://github.com/tompi/qmk_firmware/tree/develop", "maintainer": "Thomas Haukland", + "bootloader": "rp2040", + "debounce": 5, + "diode_direction": "COL2ROW", + "encoder": { + "enabled": true, + "rotary": [ + { + "pin_a": "GP14", + "pin_b": "GP15", + "resolution": 4 + } + ] + }, + "features": { + "audio": false, + "backlight": false, + "bootmagic": true, + "command": false, + "console": false, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "oled": true, + "rgblight": false, + "wpm": true + }, "layouts": { "LAYOUT_split_3x5_3": { "layout": [ diff --git a/keyboards/zompi/keymaps/default/keymap.c b/keyboards/zompi/keymaps/default/keymap.c index e488b56b46..0e9da0b5cd 100644 --- a/keyboards/zompi/keymaps/default/keymap.c +++ b/keyboards/zompi/keymaps/default/keymap.c @@ -67,3 +67,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //`--------------------------' `--------------------------' ) }; + + +#ifdef OLED_ENABLE +bool oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Zompi..."), false); + + return false; +} +#endif diff --git a/keyboards/zompi/mcuconf.h b/keyboards/zompi/mcuconf.h new file mode 100644 index 0000000000..fa6a10bc64 --- /dev/null +++ b/keyboards/zompi/mcuconf.h @@ -0,0 +1,6 @@ +#pragma once + +#include_next "mcuconf.h" + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/zompi/rules.mk b/keyboards/zompi/rules.mk index 35d9df9761..b8798ce6a4 100644 --- a/keyboards/zompi/rules.mk +++ b/keyboards/zompi/rules.mk @@ -7,17 +7,8 @@ BOOTLOADER = rp2040 # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -#NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGB_MATRIX_ENABLE = no # Enable keyboard RGB matrix (do not use together with RGBLIGHT_ENABLE) #RGB_MATRIX_DRIVER = WS2812 # RGB matrix driver support -AUDIO_ENABLE = no # Audio output #SPLIT_KEYBOARD = yes LTO_ENABLE = yes @@ -26,3 +17,5 @@ RGB_MATRIX_SUPPORTED = no RGBLIGHT_SUPPORTED = no LAYOUTS = split_3x5_3 +OLED_DRIVER = SSD1306 + diff --git a/keyboards/zompi/zompi.c b/keyboards/zompi/zompi.c index dc92bfb26e..7b48908cb2 100644 --- a/keyboards/zompi/zompi.c +++ b/keyboards/zompi/zompi.c @@ -17,3 +17,69 @@ #include "zompi.h" +#ifdef OLED_ENABLE +static void render_logo(void) { + static const char PROGMEM raw_logo[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 0, 0, 0, 192, 224, 240, 240, 240, 240, 240, 240, 240, 224, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 112, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 192, 224, 240, 0, 0, 240, 252, 254, 255, 255, 255, 1, 240, 252, 255, + 255, 255, 255, 255, 255, 255, 255, 127, 31, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 254, 254, 0, 0, 240, + 248, 252, 30, 14, 14, 14, 14, 14, 14, 30, 252, 248, 240, 0, 0, 254, 254, 252, 28, 14, 14, 14, 14, 0, 0, 254, 254, 252, 28, 14, 14, + 14, 14, 30, 252, 248, 240, 0, 0, 240, 248, 252, 222, 206, 206, 206, 206, 206, 206, 222, 252, 248, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 255, 255, 255, 254, 240, 255, 255, 255, 255, 255, 255, 248, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 193, 128, 128, 128, 192, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 255, 255, 255, 0, 0, + 15, 31, 63, 120, 112, 112, 112, 112, 112, 112, 120, 63, 31, 15, 0, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 0, 0, + 0, 0, 0, 127, 127, 127, 0, 0, 15, 31, 63, 121, 113, 113, 113, 113, 113, 113, 121, 61, 29, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 1, 1, 3, 3, 7, 7, 7, 3, 3, 1, 3, 7, 7, 7, 7, 7, 7, 7, 3, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 + }; + oled_write_raw_P(raw_logo, sizeof(raw_logo)); +} + +enum layers { + _QWERTY = 0, + _LOWER, + _RAISE, + _ADJUST, +}; + +static void render_status(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (get_highest_layer(layer_state)) { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("Lower\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("Raise\n"), false); + break; + case _ADJUST: + oled_write_P(PSTR("Adjust\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false); +} + +bool oled_task_kb(void) { + if (!oled_task_user()) { return false; } + if (is_keyboard_left()) { + render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) + } else { + render_logo(); + } + return true; +} +#endif diff --git a/keyboards/zompi/zompi.h b/keyboards/zompi/zompi.h index cf233f50f1..26d1d54f08 100644 --- a/keyboards/zompi/zompi.h +++ b/keyboards/zompi/zompi.h @@ -36,3 +36,4 @@ { k70, KC_NO, k72, k73, KC_NO }, \ } // clang-format on +//