diff options
author | QMK Bot <hello@qmk.fm> | 2021-09-18 02:51:35 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-09-18 02:51:35 +0000 |
commit | 5e4c34f8903adc105a15bf4f054915192582a1c0 (patch) | |
tree | 99a770d90bb0a10229e6292fe25d3ae46665ecd0 | |
parent | c14abd8c14f512ca160f99a942734b0f652a453c (diff) | |
parent | f93597d66b0698cbea87b24aad79f60e5a9db6ad (diff) |
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r-- | keyboards/helix/rev3_5rows/keymaps/five_rows/oled_display.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/keyboards/helix/rev3_5rows/keymaps/five_rows/oled_display.c b/keyboards/helix/rev3_5rows/keymaps/five_rows/oled_display.c index fcbd81c9b6..e8ba0d720f 100644 --- a/keyboards/helix/rev3_5rows/keymaps/five_rows/oled_display.c +++ b/keyboards/helix/rev3_5rows/keymaps/five_rows/oled_display.c @@ -25,6 +25,10 @@ #include <string.h> #include "layer_number.h" +char *sprints(char *buf, char *src); +char *sprintd(char *buf, char *leadstr, int data); +char *sprint2d(char *buf, char *leadstr, int data); + extern int current_default_layer; void init_helix_oled(void) { @@ -64,55 +68,6 @@ void matrix_update(struct CharacterMatrix *dest, } # endif -static char *sprint_decimal(char *buf, int data) { - if (data > 9) { - buf = sprint_decimal(buf, data/10); - } - *buf++ = "0123456789"[data%10]; - *buf = '\0'; - return buf; -} - -static char *sprint_hex(char *buf, uint32_t data) { - if (data > 0xf) { - buf = sprint_hex(buf, data/0x10); - } - *buf++ = "0123456789abcdef"[data & 0xf]; - *buf = '\0'; - return buf; -} - -char *sprints(char *buf, char *src) { - while (*src) { - *buf++ = *src++; - } - *buf = '\0'; - return buf; -} - -char *sprintx(char *buf, char *leadstr, uint32_t data) { - buf = sprints(buf, leadstr); - buf = sprint_hex(buf, data); - return buf; -} - -char *sprintd(char *buf, char *leadstr, int data) { - buf = sprints(buf, leadstr); - buf = sprint_decimal(buf, data); - return buf; -} - -char *sprint2d(char *buf, char *leadstr, int data) { - buf = sprints(buf, leadstr); - if (data > 99) { - return sprint_decimal(buf, data); - } - if (data < 10) { - *buf++ = ' '; - } - return sprint_decimal(buf, data); -} - # ifdef SSD1306OLED static void render_logo(struct CharacterMatrix *matrix) { # else |