zompi: oled works

This commit is contained in:
Thomas Haukland 2022-07-05 20:00:42 +02:00
parent 2feae0ab52
commit d9bbbebad8
8 changed files with 149 additions and 15 deletions

View File

@ -29,11 +29,15 @@
#define MATRIX_ROWS 8 #define MATRIX_ROWS 8
#define MATRIX_COLS 5 #define MATRIX_COLS 5
#define RGBLIGHT_LIMIT_VAL 180 #define MATRIX_ROW_PINS { GP9, GP10, GP4, GP5 }
#define MATRIX_ROW_PINS { GP2, GP3, GP4, GP5 } #define MATRIX_COL_PINS { GP6, GP7, GP8, GP11, GP12 }
#define MATRIX_COL_PINS { GP6, GP7, GP8, GP14, GP15 }
#define DIODE_DIRECTION ROW2COL #ifdef OLED_ENABLE
# define OLED_DISPLAY_128X32
#define DEBOUNCE 5 #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

27
keyboards/zompi/halconf.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/*
* 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 <halconf.h>

View File

@ -2,6 +2,33 @@
"keyboard_name": "Zompi", "keyboard_name": "Zompi",
"url": "https://github.com/tompi/qmk_firmware/tree/develop", "url": "https://github.com/tompi/qmk_firmware/tree/develop",
"maintainer": "Thomas Haukland", "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": { "layouts": {
"LAYOUT_split_3x5_3": { "LAYOUT_split_3x5_3": {
"layout": [ "layout": [

View File

@ -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

View File

@ -0,0 +1,6 @@
#pragma once
#include_next "mcuconf.h"
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE

View File

@ -7,17 +7,8 @@ BOOTLOADER = rp2040
# Build Options # Build Options
# change yes to no to disable # 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_ENABLE = no # Enable keyboard RGB matrix (do not use together with RGBLIGHT_ENABLE)
#RGB_MATRIX_DRIVER = WS2812 # RGB matrix driver support #RGB_MATRIX_DRIVER = WS2812 # RGB matrix driver support
AUDIO_ENABLE = no # Audio output
#SPLIT_KEYBOARD = yes #SPLIT_KEYBOARD = yes
LTO_ENABLE = yes LTO_ENABLE = yes
@ -26,3 +17,5 @@ RGB_MATRIX_SUPPORTED = no
RGBLIGHT_SUPPORTED = no RGBLIGHT_SUPPORTED = no
LAYOUTS = split_3x5_3 LAYOUTS = split_3x5_3
OLED_DRIVER = SSD1306

View File

@ -17,3 +17,69 @@
#include "zompi.h" #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

View File

@ -36,3 +36,4 @@
{ k70, KC_NO, k72, k73, KC_NO }, \ { k70, KC_NO, k72, k73, KC_NO }, \
} }
// clang-format on // clang-format on
//