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