Compare commits

..

14 Commits

Author SHA1 Message Date
37fb14f1b5 CLI-ify rgblight_breathing_table_calc.c (#11174)
Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Co-authored-by: Zach White <skullydazed@drpepper.org>
2020-12-16 14:24:42 +11:00
3925ff5342 gh60/satan: fix indicator LED define (#11216) 2020-12-15 17:26:18 +00:00
0831a3181a [Keymap] Helix default keymap oled update (#11152)
* update keyboards/helix/rev2/local_features.mk - Improved parsing of the `HELIX =` option

* add 'is_mac_mode()' into keyboards/helix/rev2/rev2.c

* update helix/rev2/keymaps/default/keymap.c: use rgblight query functions

* Makes the OLED driver used by the helix:default keymap switchable.

* use TOP/drivers/oled/oled_driver.c
  `make  helix:default`
  or
  `make OLED_SELECT=core  helix:default`
* use helix/local_drivers/ssd1306.c
  `make OLED_SELECT=local  helix:default`

* Separated the OLED related code from keymap.c and moved it to oled_display.c.

* Change the 'led_test' keymap to follow the changes in the 'default' keymap.

* update helix/rev2/keymaps/default/oled_display.c

* add '#define OLED_UPDATE_INTERVAL 50' into keyboards/helix/rev2/config.h

* Support for OLED_UPDATE_INTERVAL, even for older types of OLED tasks

* add readme.md for helix/rev2

* Apply drashna's suggestions to rev2.c.

* Apply drashna's suggestions to rev3_4rows.c, rev3_5rows.c.

Co-authored-by: mtei <2170248+mtei@users.noreply.github.com>
2020-12-15 20:14:14 +09:00
ac8cddda22 [Keyboard] rart/rart45 (#11096)
* Create config.h

* Create info.json

* Create rart45.c

* Create rart45.h

* Create readme.md

* Create rules.mk

* Create keymap.c

* Create keymap.c

* Create rules.mk

* Update config.h

* Update rart45.c

* Update rart45.h

* Update rules.mk

* Update readme.md

* Update info.json
2020-12-14 14:26:30 -08:00
e6217b6aa6 Selectively enable command and console for yanfali userspace (#11212)
* Remove command and console

 - these options prevent community layouts from being built on other
   keyboards. Selectively enable it on keyboards I own rather than on
   everything.

* Update users/yanfali/rules.mk
2020-12-14 11:13:00 -08:00
795e82074d Another attempt to fix formatting workflow (#11187) 2020-12-13 21:47:20 +00:00
70f40339c2 Add i2c 24LC64 eeprom (#11200)
* add 24LC64 eeprom

* docs update

* Update docs/eeprom_driver.md

Co-authored-by: Joel Challis <git@zvecr.com>

Co-authored-by: Joel Challis <git@zvecr.com>
2020-12-14 05:50:50 +11:00
10e4487ba3 Fix incorrect search order for rgblight_breathe_table.h that rgblight.c includes. (#11192)
When `rgblight.c` includes `rgblight_breathe_table.h`, the search order should be as follows.

* `keyboards/KEYBOARD/keymaps/USER/rgblight_breathe_table.h`
* `users/USER/rgblight_breathe_table.h`
* `quantum/rgblight_breathe_table.h`

However, the current implementation was wrong, so I fixed it.
2020-12-13 03:19:15 +09:00
8ea7f4f45f Fixed french quotes on canadian multilingual (#11183) 2020-12-11 19:00:07 +00:00
4b03b6f7f4 Nightingale Studios Hailey production fixes (#11180) 2020-12-11 13:49:31 +00:00
1ebd243cdc CI automated format fixes (#11179)
* Format all C files for now, till diff logic works within CI

* Fix recursion of dos2unix
2020-12-11 13:49:03 +00:00
b185816717 Add XD75am as supported in XD75 readme (#11170) 2020-12-11 23:50:05 +11:00
501f2fdef1 Normalise include statements in core code (#11153)
* Normalise include statements in core code

* Missed one
2020-12-11 13:45:24 +11:00
5b5d74a267 Fix warning logic when running 'qmk format -a' (#11177) 2020-12-10 19:02:41 +00:00
104 changed files with 1157 additions and 843 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,9 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
これは最初に include されるものの 1 つである C ヘッダファイルで、プロジェクト全体(もし含まれる場合)にわたって持続します。多くの変数をここで設定し、他の場所からアクセスすることができます。`config.h` ファイルでは、以下のもの以外の、他の `config.h` ファイルやその他のファイルの include をしないでください:
#include "config_common.h"
```c
#include "config_common.h"
```
## ハードウェアオプション

View File

@ -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"
```
### メモリ内の文字列

View File

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

View File

@ -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 関数を使用することが出来ます。

View File

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

View File

@ -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"
```
之后,您可以使用一些不同的打印功能:

View File

@ -16,7 +16,7 @@
#include "quantum.h"
#include "analog.h"
#include "ch.h"
#include <ch.h>
#include <hal.h>
#if !HAL_USE_ADC

View File

@ -24,7 +24,7 @@
*/
#pragma once
#include "ch.h"
#include <ch.h>
#include <hal.h>
#ifdef I2C1_BANK

View File

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

View File

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

View File

@ -18,7 +18,7 @@
#include <ch.h>
#include <hal.h>
#include <quantum.h>
#include "quantum.h"
#ifndef SPI_DRIVER
# define SPI_DRIVER SPID2

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View 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