Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
37fb14f1b5 | |||
3925ff5342 | |||
0831a3181a | |||
ac8cddda22 | |||
e6217b6aa6 | |||
795e82074d | |||
70f40339c2 | |||
10e4487ba3 | |||
8ea7f4f45f | |||
4b03b6f7f4 | |||
1ebd243cdc | |||
b185816717 | |||
501f2fdef1 | |||
5b5d74a267 |
7
.github/workflows/format.yaml
vendored
7
.github/workflows/format.yaml
vendored
@ -6,7 +6,7 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
container: qmkfm/base_container
|
||||
|
||||
@ -22,13 +22,14 @@ jobs:
|
||||
|
||||
- name: Format files
|
||||
run: |
|
||||
bin/qmk cformat
|
||||
bin/qmk cformat -a
|
||||
bin/qmk pyformat
|
||||
bin/qmk fileformat
|
||||
|
||||
- name: Commit files
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "Format code according to conventions for ${GITHUB_SHA}"
|
||||
commit_message: Format code according to conventions for $GITHUB_SHA
|
||||
commit_user_name: QMK Bot
|
||||
commit_user_email: hello@qmk.fm
|
||||
commit_author: QMK Bot <hello@qmk.fm>
|
||||
|
@ -296,6 +296,16 @@ This command allows you to generate QMK documentation locally. It can be uses fo
|
||||
qmk generate-docs
|
||||
```
|
||||
|
||||
## `qmk generate-rgb-breathe-table`
|
||||
|
||||
This command generates a lookup table (LUT) header file for the [RGB Lighting](feature_rgblight.md) feature's breathing animation. Place this file in your keyboard or keymap directory as `rgblight_breathe_table.h` to override the default LUT in `quantum/`.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
qmk generate-rgb-breathe-table [-q] [-o OUTPUT] [-m MAX] [-c CENTER]
|
||||
```
|
||||
|
||||
## `qmk kle2json`
|
||||
|
||||
This command allows you to convert from raw KLE data to QMK Configurator JSON. It accepts either an absolute file path, or a file name in the current directory. By default it will not overwrite `info.json` if it is already present. Use the `-f` or `--force` flag to overwrite.
|
||||
|
@ -29,7 +29,9 @@ This level contains all of the options for that particular keymap. If you wish t
|
||||
|
||||
This is a C header file that is one of the first things included, and will persist over the whole project (if included). Lots of variables can be set here and accessed elsewhere. The `config.h` file shouldn't be including other `config.h` files, or anything besides this:
|
||||
|
||||
#include "config_common.h"
|
||||
```c
|
||||
#include "config_common.h"
|
||||
```
|
||||
|
||||
|
||||
## Hardware Options
|
||||
|
@ -41,7 +41,9 @@ Bevorzugst Du es lieber auf der Befehlszeile zu debuggen? Dafür eignet sich das
|
||||
|
||||
Manchmal ist es hilfreich Debug-Nachrichten innerhalb deines eigenen [Custom Codes](de/custom_quantum_functions.md) zu drucken. Das ist ziemlich einfach. Beginne damit `print.h` am Anfang deiner Datei zu inkludieren:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
Danach stehen dir verschiedene Druck-Funktionen zur Verfügung:
|
||||
|
||||
|
@ -40,6 +40,7 @@ Module | Equivalent `#define` | Source
|
||||
-----------------|---------------------------------|------------------------------------------
|
||||
CAT24C512 EEPROM | `#define EEPROM_I2C_CAT24C512` | <https://www.sparkfun.com/products/14764>
|
||||
RM24C512C EEPROM | `#define EEPROM_I2C_RM24C512C` | <https://www.sparkfun.com/products/14764>
|
||||
24LC64 EEPROM | `#define EEPROM_I2C_24LC64` | <https://www.microchip.com/wwwproducts/en/24LC64>
|
||||
24LC128 EEPROM | `#define EEPROM_I2C_24LC128` | <https://www.microchip.com/wwwproducts/en/24LC128>
|
||||
24LC256 EEPROM | `#define EEPROM_I2C_24LC256` | <https://www.sparkfun.com/products/525>
|
||||
MB85RC256V FRAM | `#define EEPROM_I2C_MB85RC256V` | <https://www.adafruit.com/product/1895>
|
||||
|
@ -41,7 +41,9 @@ Para plataformas compatibles, [QMK Toolbox](https://github.com/qmk/qmk_toolbox)
|
||||
|
||||
A veces, es útil imprimir mensajes de depuración desde tu [código personalizado](custom_quantum_functions.md). Hacerlo es bastante simple. Comienza incluyendo `print.h` al principio de tu fichero:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
Después de eso puedes utilzar algunas funciones print diferentes:
|
||||
|
||||
|
@ -182,7 +182,9 @@ Which would send Left Control+`a` (Left Control down, `a`, Left Control up) - no
|
||||
|
||||
By default, it assumes a US keymap with a QWERTY layout; if you want to change that (e.g. if your OS uses software Colemak), include this somewhere in your keymap:
|
||||
|
||||
#include <sendstring_colemak.h>
|
||||
```c
|
||||
#include "sendstring_colemak.h"
|
||||
```
|
||||
|
||||
### Strings in Memory
|
||||
|
||||
|
@ -184,7 +184,7 @@ If you wanted to consolidate macros and other functions into your userspace for
|
||||
|
||||
First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes
|
||||
|
||||
Then add `#include <name.h>` to all of your keymap.c files. This allows you to use these new keycodes without having to redefine them in each keymap.
|
||||
Then add `#include "<name>.h"` to all of your keymap.c files. This allows you to use these new keycodes without having to redefine them in each keymap.
|
||||
|
||||
Once you've done that, you'll want to set the keycode definitions that you need to the `<name>.h` file. For instance:
|
||||
```c
|
||||
|
@ -42,7 +42,9 @@ Vous préférez une solution basée sur le terminal? [hid_listen](https://www.pj
|
||||
|
||||
Parfois, il est utile d'afficher des messages de débugage depuis votre [code custom](custom_quantum_functions.md). Le faire est assez simple. Commencez par ajouter `print.h` au début de votre fichier:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
Une fois fait, vous pouvez utiliser les fonctions print suivantes:
|
||||
|
||||
|
@ -34,7 +34,9 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
|
||||
これは最初に include されるものの 1 つである C ヘッダファイルで、プロジェクト全体(もし含まれる場合)にわたって持続します。多くの変数をここで設定し、他の場所からアクセスすることができます。`config.h` ファイルでは、以下のもの以外の、他の `config.h` ファイルやその他のファイルの include をしないでください:
|
||||
|
||||
#include "config_common.h"
|
||||
```c
|
||||
#include "config_common.h"
|
||||
```
|
||||
|
||||
|
||||
## ハードウェアオプション
|
||||
|
@ -187,7 +187,9 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
デフォルトでは、QWERTY レイアウトの US キーマップを想定しています; それを変更したい場合(例えば OS がソフトウェア Colemak を使う場合)、キーマップのどこかに以下を含めます:
|
||||
|
||||
#include <sendstring_colemak.h>
|
||||
```c
|
||||
#include "sendstring_colemak.h"
|
||||
```
|
||||
|
||||
### メモリ内の文字列
|
||||
|
||||
|
@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
最初に、全ての `keymap.c` ファイルを調べ、代わりに `process_record_user` を `process_record_keymap` に置き換えます。この方法では、これらのキーボードでキーボード固有のコードを使用でき、カスタムの "global" キーコードも使うことができます。また、`SAFE_RANGE` を `NEW_SAFE_RANGE` に置き換えて、キーコードが重複しないようにすることもできます。
|
||||
|
||||
次に、全ての keymap.c ファイルに `#include <name.h>` を追加します。これにより、各キーマップでそれらを再定義することなく新しいキーコードを使うことができます。
|
||||
次に、全ての keymap.c ファイルに `#include "<name>.h"` を追加します。これにより、各キーマップでそれらを再定義することなく新しいキーコードを使うことができます。
|
||||
|
||||
それが完了したら、必要なキーコードの定義を `<name>.h` ファイルに設定します。例えば:
|
||||
```c
|
||||
|
@ -45,7 +45,9 @@ void keyboard_post_init_user(void) {
|
||||
|
||||
[custom code](ja/custom_quantum_functions.md)内からデバッグメッセージを出力すると便利な場合があります。それはとても簡単です。ファイルの先頭に`print.h`のインクルードを追加します:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
そのあとは、いくつかの異なった print 関数を使用することが出来ます。
|
||||
|
||||
|
@ -36,7 +36,9 @@ Prefer a terminal based solution? [hid_listen](https://www.pjrc.com/teensy/hid_l
|
||||
|
||||
Sometimes it's useful to print debug messages from within your [custom code](custom_quantum_functions.md). Doing so is pretty simple. Start by including `print.h` at the top of your file:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
After that you can use a few different print functions:
|
||||
|
||||
|
@ -34,7 +34,9 @@ void keyboard_post_init_user(void) {
|
||||
|
||||
有时用[custom code](custom_quantum_functions.md)发送自定义调试信息很有用. 这么做很简单. 首先在你文件头部包含`print.h`:
|
||||
|
||||
#include <print.h>
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
之后,您可以使用一些不同的打印功能:
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "quantum.h"
|
||||
#include "analog.h"
|
||||
#include "ch.h"
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
|
||||
#if !HAL_USE_ADC
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ch.h"
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
|
||||
#ifdef I2C1_BANK
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "serial.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include "hal.h"
|
||||
#include <hal.h>
|
||||
|
||||
// TODO: resolve/remove build warnings
|
||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) && defined(PROTOCOL_CHIBIOS) && defined(WS2812_DRIVER_BITBANG)
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include "serial.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
|
||||
#ifndef USART_CR1_M0
|
||||
# define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
#include <quantum.h>
|
||||
#include "quantum.h"
|
||||
|
||||
#ifndef SPI_DRIVER
|
||||
# define SPI_DRIVER SPID2
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "quantum.h"
|
||||
#include "ws2812.h"
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
|
||||
/* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "ws2812.h"
|
||||
#include "quantum.h"
|
||||
#include "hal.h"
|
||||
#include <hal.h>
|
||||
|
||||
/* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */
|
||||
|
||||
|
@ -49,6 +49,11 @@
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 64
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#elif defined(EEPROM_I2C_24LC64)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 32
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#elif defined(EEPROM_I2C_MB85RC256V)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 32768
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 128
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "hal.h"
|
||||
#include <hal.h>
|
||||
#include "eeprom_driver.h"
|
||||
#include "eeprom_stm32_L0_L1.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <timer.h>
|
||||
#include "timer.h"
|
||||
#include "solenoid.h"
|
||||
#include "haptic.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "micro_oled.h"
|
||||
#include <print.h>
|
||||
#include "print.h"
|
||||
#include <stdlib.h>
|
||||
#include "util/font5x7.h"
|
||||
#include "util/font8x16.h"
|
||||
|
@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define LED_NUM_LOCK_PIN B2
|
||||
#define LED_CAPS_LOCK_PIN B2
|
||||
#define LED_PIN_ON_STATE 0
|
||||
|
||||
#define BACKLIGHT_PIN B6
|
||||
|
@ -48,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define SSD1306OLED
|
||||
#endif
|
||||
|
||||
#define OLED_UPDATE_INTERVAL 50
|
||||
|
||||
/* Select rows configuration */
|
||||
// Rows are 4 or 5
|
||||
// #define HELIX_ROWS 5 see ./rules.mk
|
||||
|
@ -1,3 +1,19 @@
|
||||
/* Copyright 2020 yushakobo
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "bootloader.h"
|
||||
#ifdef PROTOCOL_LUFA
|
||||
@ -7,17 +23,6 @@
|
||||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#endif
|
||||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
//Following line allows macro to read current RGB settings
|
||||
extern rgblight_config_t rgblight_config;
|
||||
#endif
|
||||
|
||||
extern uint8_t is_master;
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
@ -420,16 +425,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
rgblight_step();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_current_mode = rgblight_get_mode();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
break;
|
||||
case EISU:
|
||||
if (record->event.pressed) {
|
||||
if(keymap_config.swap_lalt_lgui==false){
|
||||
if (is_mac_mode()) {
|
||||
register_code(KC_LANG2);
|
||||
}else{
|
||||
} else {
|
||||
SEND_STRING(SS_LALT("`"));
|
||||
}
|
||||
} else {
|
||||
@ -439,9 +444,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
break;
|
||||
case KANA:
|
||||
if (record->event.pressed) {
|
||||
if(keymap_config.swap_lalt_lgui==false){
|
||||
if (is_mac_mode()) {
|
||||
register_code(KC_LANG1);
|
||||
}else{
|
||||
} else {
|
||||
SEND_STRING(SS_LALT("`"));
|
||||
}
|
||||
} else {
|
||||
@ -454,7 +459,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
eeconfig_update_rgblight_default();
|
||||
rgblight_enable();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_current_mode = rgblight_get_mode();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -462,12 +467,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
|
||||
void matrix_init_user(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
startup_user();
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_current_mode = rgblight_get_mode();
|
||||
#endif
|
||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED
|
||||
@ -500,132 +509,3 @@ void music_scale_user(void)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
||||
#ifdef SSD1306OLED
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
}
|
||||
|
||||
void matrix_update(struct CharacterMatrix *dest,
|
||||
const struct CharacterMatrix *source) {
|
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||
dest->dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
//assign the right code to your layers for OLED display
|
||||
#define L_BASE 0
|
||||
#define L_LOWER (1<<_LOWER)
|
||||
#define L_RAISE (1<<_RAISE)
|
||||
#define L_ADJUST (1<<_ADJUST)
|
||||
#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
|
||||
|
||||
static void render_logo(struct CharacterMatrix *matrix) {
|
||||
|
||||
static const char helix_logo[] PROGMEM ={
|
||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
||||
0};
|
||||
matrix_write_P(matrix, helix_logo);
|
||||
//matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
|
||||
}
|
||||
|
||||
static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
char buf[30];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_config.enable) {
|
||||
if (full) {
|
||||
snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
|
||||
rgblight_config.mode,
|
||||
rgblight_config.hue/RGBLIGHT_HUE_STEP,
|
||||
rgblight_config.sat/RGBLIGHT_SAT_STEP,
|
||||
rgblight_config.val/RGBLIGHT_VAL_STEP);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "[%2d] ",rgblight_config.mode);
|
||||
}
|
||||
matrix_write(matrix, buf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void render_layer_status(struct CharacterMatrix *matrix) {
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
char buf[10];
|
||||
matrix_write_P(matrix, PSTR("Layer: "));
|
||||
switch (layer_state) {
|
||||
case L_BASE:
|
||||
matrix_write_P(matrix, PSTR("Default"));
|
||||
break;
|
||||
case L_RAISE:
|
||||
matrix_write_P(matrix, PSTR("Raise"));
|
||||
break;
|
||||
case L_LOWER:
|
||||
matrix_write_P(matrix, PSTR("Lower"));
|
||||
break;
|
||||
case L_ADJUST:
|
||||
case L_ADJUST_TRI:
|
||||
matrix_write_P(matrix, PSTR("Adjust"));
|
||||
break;
|
||||
default:
|
||||
matrix_write_P(matrix, PSTR("Undef-"));
|
||||
snprintf(buf,sizeof(buf), "%ld", layer_state);
|
||||
matrix_write(matrix, buf);
|
||||
}
|
||||
}
|
||||
|
||||
void render_status(struct CharacterMatrix *matrix) {
|
||||
|
||||
// Render to mode icon
|
||||
static const char os_logo[][2][3] PROGMEM ={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
||||
if(keymap_config.swap_lalt_lgui==false){
|
||||
matrix_write_P(matrix, os_logo[0][0]);
|
||||
matrix_write_P(matrix, PSTR("\n"));
|
||||
matrix_write_P(matrix, os_logo[0][1]);
|
||||
}else{
|
||||
matrix_write_P(matrix, os_logo[1][0]);
|
||||
matrix_write_P(matrix, PSTR("\n"));
|
||||
matrix_write_P(matrix, os_logo[1][1]);
|
||||
}
|
||||
|
||||
matrix_write_P(matrix, PSTR(" "));
|
||||
render_layer_status(matrix);
|
||||
matrix_write_P(matrix, PSTR("\n"));
|
||||
|
||||
// Host Keyboard LED Status
|
||||
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
|
||||
PSTR("NUMLOCK") : PSTR(" "));
|
||||
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
|
||||
PSTR("CAPS") : PSTR(" "));
|
||||
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
|
||||
PSTR("SCLK") : PSTR(" "));
|
||||
matrix_write_P(matrix, PSTR("\n"));
|
||||
render_rgbled_status(true, matrix);
|
||||
}
|
||||
|
||||
|
||||
void iota_gfx_task_user(void) {
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
#if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
matrix_clear(&matrix);
|
||||
if(is_master){
|
||||
render_status(&matrix);
|
||||
}else{
|
||||
render_logo(&matrix);
|
||||
render_rgbled_status(false, &matrix);
|
||||
render_layer_status(&matrix);
|
||||
}
|
||||
matrix_update(&display, &matrix);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
228
keyboards/helix/rev2/keymaps/default/oled_display.c
Normal file
228
keyboards/helix/rev2/keymaps/default/oled_display.c
Normal file
@ -0,0 +1,228 @@
|
||||
/* Copyright 2020 yushakobo
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
enum layer_number {
|
||||
_QWERTY = 0,
|
||||
_COLEMAK,
|
||||
_DVORAK,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST
|
||||
};
|
||||
|
||||
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
|
||||
#if defined(SSD1306OLED) || defined(OLED_DRIVER_ENABLE)
|
||||
|
||||
# if defined(OLED_DRIVER_ENABLE)
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
if (is_keyboard_master()) {
|
||||
return OLED_ROTATION_0;
|
||||
} else {
|
||||
return OLED_ROTATION_180;
|
||||
}
|
||||
}
|
||||
# else
|
||||
# define oled_write(data,flag) matrix_write(matrix, data)
|
||||
# define oled_write_P(data,flag) matrix_write_P(matrix, data)
|
||||
# endif
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
void matrix_scan_user(void) {
|
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
}
|
||||
|
||||
void matrix_update(struct CharacterMatrix *dest,
|
||||
const struct CharacterMatrix *source) {
|
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||
dest->dirty = true;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
//assign the right code to your layers for OLED display
|
||||
#define L_BASE 0
|
||||
#define L_LOWER (1<<_LOWER)
|
||||
#define L_RAISE (1<<_RAISE)
|
||||
#define L_ADJUST (1<<_ADJUST)
|
||||
#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
static void render_logo(struct CharacterMatrix *matrix) {
|
||||
# else
|
||||
static void render_logo(void) {
|
||||
# endif
|
||||
|
||||
static const char helix_logo[] PROGMEM ={
|
||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
||||
0};
|
||||
oled_write_P(helix_logo, false);
|
||||
}
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
|
||||
# else
|
||||
static void render_rgbled_status(bool full) {
|
||||
# endif
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
char buf[30];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
|
||||
if (full) {
|
||||
snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
|
||||
rgblight_get_mode(),
|
||||
rgblight_get_hue()/RGBLIGHT_HUE_STEP,
|
||||
rgblight_get_sat()/RGBLIGHT_SAT_STEP,
|
||||
rgblight_get_val()/RGBLIGHT_VAL_STEP);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
|
||||
}
|
||||
oled_write(buf, false);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
static void render_layer_status(struct CharacterMatrix *matrix) {
|
||||
# else
|
||||
static void render_layer_status(void) {
|
||||
# endif
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
char buf[10];
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (layer_state) {
|
||||
case L_BASE:
|
||||
oled_write_P(PSTR("Default"), false);
|
||||
break;
|
||||
case L_RAISE:
|
||||
oled_write_P(PSTR("Raise"), false);
|
||||
break;
|
||||
case L_LOWER:
|
||||
oled_write_P(PSTR("Lower"), false);
|
||||
break;
|
||||
case L_ADJUST:
|
||||
case L_ADJUST_TRI:
|
||||
oled_write_P(PSTR("Adjust"), false);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(PSTR("Undef-"), false);
|
||||
snprintf(buf,sizeof(buf), "%ld", layer_state);
|
||||
oled_write(buf, false);
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
void render_status(struct CharacterMatrix *matrix) {
|
||||
# else
|
||||
void render_status(void) {
|
||||
# endif
|
||||
// Render to mode icon
|
||||
static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
||||
if (is_mac_mode()) {
|
||||
oled_write_P(os_logo[0][0], false);
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
oled_write_P(os_logo[0][1], false);
|
||||
} else {
|
||||
oled_write_P(os_logo[1][0], false);
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
oled_write_P(os_logo[1][1], false);
|
||||
}
|
||||
|
||||
oled_write_P(PSTR(" "), false);
|
||||
# ifdef SSD1306OLED
|
||||
render_layer_status(matrix);
|
||||
# else
|
||||
render_layer_status();
|
||||
# endif
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
|
||||
// Host Keyboard LED Status
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
|
||||
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
|
||||
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
# ifdef SSD1306OLED
|
||||
render_rgbled_status(true, matrix);
|
||||
# else
|
||||
render_rgbled_status(true);
|
||||
oled_write_P(PSTR("\n"), false);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
# ifdef SSD1306OLED
|
||||
# if OLED_UPDATE_INTERVAL > 0
|
||||
uint16_t oled_update_timeout;
|
||||
# endif
|
||||
|
||||
void iota_gfx_task_user(void) {
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
# if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
#if OLED_UPDATE_INTERVAL > 0
|
||||
if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
oled_update_timeout = timer_read();
|
||||
#endif
|
||||
matrix_clear(&matrix);
|
||||
if (is_keyboard_master()) {
|
||||
render_status(&matrix);
|
||||
} else {
|
||||
render_logo(&matrix);
|
||||
render_rgbled_status(false, &matrix);
|
||||
render_layer_status(&matrix);
|
||||
}
|
||||
matrix_update(&display, &matrix);
|
||||
}
|
||||
# else
|
||||
void oled_task_user(void) {
|
||||
|
||||
# if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
if (is_keyboard_master()) {
|
||||
render_status();
|
||||
} else {
|
||||
render_logo();
|
||||
render_rgbled_status(false);
|
||||
render_layer_status();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user