1
0
Fork 0

Keyboard: Partial refactor of the crkbd code (#3600)

* Add display to LED-parameters function
* Improvement of update timing for OLED display (Need TWI_Init)
This commit is contained in:
marksard 2018-08-23 01:51:37 +09:00 committed by Drashna Jaelre
parent 9d27d55443
commit 6076ed85be
12 changed files with 159 additions and 114 deletions

View file

@ -18,10 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#pragma once
/* Use I2C or Serial */
@ -50,4 +47,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#endif

View file

@ -1,24 +1,14 @@
#include "crkbd.h"
#include QMK_KEYBOARD_H
#include "bootloader.h"
#include "action_layer.h"
#include "action_util.h"
#include "eeconfig.h"
#ifdef PROTOCOL_LUFA
#include "lufa.h"
#include "split_util.h"
#include "lufa.h"
#include "split_util.h"
#endif
#include "LUFA/Drivers/Peripheral/TWI.h"
#ifdef SSD1306OLED
#include "LUFA/Drivers/Peripheral/TWI.h"
#include "ssd1306.h"
#endif
#include "../lib/mode_icon_reader.c"
#include "../lib/layer_state_reader.c"
#include "../lib/host_led_state_reader.c"
#include "../lib/logo_reader.c"
#include "../lib/keylogger.c"
#include "../lib/timelogger.c"
extern keymap_config_t keymap_config;
#ifdef RGBLIGHT_ENABLE
@ -148,12 +138,25 @@ void matrix_init_user(void) {
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
// When add source files to SRC in rules.mk, you can use functions.
const char *read_layer_state(void);
const char *read_logo(void);
void set_keylog(uint16_t keycode, keyrecord_t *record);
const char *read_keylog(void);
const char *read_keylogs(void);
// const char *read_mode_icon(bool swap);
// const char *read_host_led_state(void);
// void set_timelog(void);
// const char *read_timelog(void);
void matrix_scan_user(void) {
iota_gfx_task();
}
void matrix_render_user(struct CharacterMatrix *matrix) {
if (is_master) {
// If you want to change the display of OLED, you need to change here
matrix_write_ln(matrix, read_layer_state());
matrix_write_ln(matrix, read_keylog());
matrix_write_ln(matrix, read_keylogs());
@ -182,7 +185,7 @@ void iota_gfx_task_user(void) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
set_timelog();
// set_timelog();
}
switch (keycode) {

View file

@ -15,11 +15,16 @@ AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
ONEHAND_ENABLE = no # Enable one-hand typing
SWAP_HANDS_ENABLE = no # Enable one-hand typing
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif
# If you want to change the display of OLED, you need to change here
SRC += ../lib/rgb_state_reader.c \
../lib/layer_state_reader.c \
../lib/logo_reader.c \
../lib/keylogger.c \
# ../lib/mode_icon_reader.c \
# ../lib/host_led_state_reader.c \
# ../lib/timelogger.c \