Skip to content

Commit

Permalink
Refactor Lily58 to use split_common (#6260)
Browse files Browse the repository at this point in the history
* Refactor core keyboard files to use split_common

* Refactor OLED libs for compatibility with split_common

* Override default glcd font to get lily58 logo

* Switch to OLED library, clean up references to SSD1306OLED, and update default to match

* Remove duplicated #define tapping_term

* Add in logo_reader that was accidentally deleted

* fix yuchi keymap as well to get CI passing

* remove serial_config

* keyboards/lily58/lib/layer_state_reader.c

* incorporate layer changes

* add my own lily58 keymap

* incorporate suggestions and fix CI warnings

* Remove reference to SSD1306OLED in @ninjonas' build

* Update ninjonas.c

* fix build/import issues

* update km

* update debounce

* update DIODE_DIRECTION

* address comments

* address comments

* add Changelog

* Apply suggestions
  • Loading branch information
yyc authored and noroadsleft committed May 15, 2020
1 parent 041a90d commit 61cd6f6
Show file tree
Hide file tree
Showing 30 changed files with 412 additions and 976 deletions.
38 changes: 38 additions & 0 deletions docs/ChangeLog/20200530/PR6260.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Migrating Lily58 to use split_common

[#6260](https://github.com/qmk/qmk_firmware/pull/6260) Modifies the default firmware for Lily58 to use the `split_common` library, instead of including and depending on its own set of libraries for the following functionality:
- SSD1306 display
- i2c for OLED
- Serial Communication

This allows current lily58 firmware to advance with updates to the `split_common` library, which is shared with many other split keyboards.

## To migrate existing Lily58 firmware:

[Changes to `config.h`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-445ac369c8717dcd6fc6fc3630836fc1):
- Remove `#define SSD1306OLED` from config.h


[Changes to `keymap.c`](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7):
- Find/Replace each instance of `#ifdef SSD1306OLED` with `#ifdef OLED_DRIVER_ENABLE`
- The following changes are for compatibility with the OLED driver. If you don't use the OLED driver you may safely delete [this section](https://github.com/qmk/qmk_firmware/blob/e6b9980bd45c186f7360df68c24b6e05a80c10dc/keyboards/lily58/keymaps/default/keymap.c#L144-L190)
- Alternatively, if you did not change the OLED code from that in `default`, you may find it easier to simply copy the [relevant section](https://github.com/qmk/qmk_firmware/blob/4ac310668501ae6786c711ecc8f01f62ddaa1c0b/keyboards/lily58/keymaps/default/keymap.c#L138-L172). Otherwise, the changes you need to make are as follows (sample change [here](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7R138-R173))
- [Remove](https://github.com/qmk/qmk_firmware/pull/6260/files#diff-20943ea59856e9bdf3d99ecb2eee40b7L138-L141) the block
```c
#ifdef SSD1306OLED
iota_gfx_init(!has_usb()); // turns on the display
#endif
```
- Within the block bounded by `#ifdef OLED_DRIVER_ENABLE` and `#endif // OLED_DRIVER_ENABLE`, add the following block to ensure that your two OLEDs are rotated correctly across the left and right sides:
```c
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master())
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
return rotation;
}
```
- Remove the functions `matrix_scan_user`, `matrix_update` and `iota_gfx_task_user`
- Find/Replace `matrix_render_user(struct CharacterMatrix *matrix)` with `iota_gfx_task_user(void)`
- Find/Replace `is_master` with `is_keyboard_master()`
- For each instance of `matrix_write_ln(matrix, display_fn())`, rewrite it as `oled_write_ln(read_layer_state(), false);`
- For each instance of `matrix_write(matrix, read_logo());`, replace with `oled_write(read_logo(), false);`
12 changes: 9 additions & 3 deletions keyboards/lily58/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#include "config_common.h"
#include <serial_config.h>

#define USE_I2C
#define USE_SERIAL
#ifndef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D2
#define SERIAL_USE_MULTI_TRANSACTION
#endif

#if !defined(NO_ACTION_MACRO)
#define NO_ACTION_MACRO
#endif
#if !defined(NO_ACTION_FUNCTION)
#define NO_ACTION_FUNCTION
#endif

#define DIODE_DIRECTION COL2ROW

// Use the lily version to get the Lily58 logo instead of the qmk logo
#define OLED_FONT_H "lib/glcdfont_lily.c"
162 changes: 0 additions & 162 deletions keyboards/lily58/i2c.c

This file was deleted.

46 changes: 0 additions & 46 deletions keyboards/lily58/i2c.h

This file was deleted.

64 changes: 64 additions & 0 deletions keyboards/lily58/keymaps/chuan/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
This is the c configuration file for the keymap
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
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/>.
*/

#pragma once

// #define USE_MATRIX_I2C

// #define USE_I2C

/* Select hand configuration */

#define MASTER_LEFT
// #define MASTER_RIGHT
// #define EE_HANDS

// #define SSD1306OLED

#define USE_SERIAL_PD2

#define TAPPING_FORCE_HOLD

/* define tapping term */
#define TAPPING_TERM 200


#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 27
#define RGBLIGHT_LIMIT_VAL 120
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17

#define ENCODERS_PAD_A { F4 }
#define ENCODERS_PAD_B { F5 }


/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5

// Underglow
/*
#undef RGBLED_NUM
#define RGBLED_NUM 14 // Number of LEDs
#define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_SLEEP
*/

0 comments on commit 61cd6f6

Please sign in to comment.