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

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