Keyboard: Partial refactor of the crkbd code (#3600)
* Add display to LED-parameters function * Improvement of update timing for OLED display (Need TWI_Init)pull/3726/head
parent
9d27d55443
commit
6076ed85be
@ -1,13 +1,15 @@
|
|||||||
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "crkbd.h"
|
||||||
|
|
||||||
char host_led_state[40];
|
char host_led_state_str[24];
|
||||||
|
|
||||||
char *read_host_led_state(void)
|
const char *read_host_led_state(void)
|
||||||
{
|
{
|
||||||
snprintf(host_led_state, sizeof(host_led_state), "\n%s %s %s",
|
uint8_t leds = host_keyboard_leds();
|
||||||
(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
|
||||||
(host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
(leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
|
||||||
(host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
(leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
|
||||||
|
(leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
|
||||||
|
|
||||||
return host_led_state;
|
return host_led_state_str;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#include "crkbd.h"
|
#include "crkbd.h"
|
||||||
|
|
||||||
char *read_logo(void)
|
const char *read_logo(void) {
|
||||||
{
|
static char logo[] = {
|
||||||
static char logo[]={
|
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||||
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,
|
||||||
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,
|
||||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
0};
|
||||||
0};
|
|
||||||
|
|
||||||
return logo;
|
return logo;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern rgblight_config_t rgblight_config;
|
||||||
|
char rbf_info_str[24];
|
||||||
|
const char *read_rgb_info(void) {
|
||||||
|
|
||||||
|
snprintf(rbf_info_str, sizeof(rbf_info_str), "%s %2d h%3d s%3d v%3d",
|
||||||
|
rgblight_config.enable ? "on" : "- ", rgblight_config.mode,
|
||||||
|
rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
return rbf_info_str;
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,17 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "crkbd.h"
|
||||||
|
|
||||||
char timelog[40] = {};
|
char timelog_str[24] = {};
|
||||||
int last_time = 0;
|
int last_time = 0;
|
||||||
int elapsed_time = 0;
|
int elapsed_time = 0;
|
||||||
|
|
||||||
void set_timelog(void)
|
void set_timelog(void) {
|
||||||
{
|
|
||||||
elapsed_time = timer_elapsed(last_time);
|
elapsed_time = timer_elapsed(last_time);
|
||||||
last_time = timer_read();
|
last_time = timer_read();
|
||||||
snprintf(timelog, sizeof(timelog), "lt:%5d, et:%5d", last_time, elapsed_time);
|
snprintf(timelog_str, sizeof(timelog_str), "lt:%5d, et:%5d", last_time, elapsed_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *read_timelog(void)
|
const char *read_timelog(void) {
|
||||||
{
|
return timelog_str;
|
||||||
return timelog;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue