Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error helix:five_rows #16847

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
279 changes: 0 additions & 279 deletions keyboards/helix/rev2/keymaps/five_rows/oled_display.c

This file was deleted.

3 changes: 2 additions & 1 deletion keyboards/helix/rev2/keymaps/five_rows/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SPLIT_KEYBOARD = yes
USER_NAME := mtei
SPLIT_KEYBOARD = yes

CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
Expand Down
2 changes: 2 additions & 0 deletions keyboards/helix/rev3_5rows/keymaps/five_rows/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define OLED_UPDATE_INTERVAL 50
#endif

#define PSEUDO_SPRINTF_DEFINED

// place overrides here

// If you need more program area, try select and reduce rgblight modes to use.
Expand Down
2 changes: 2 additions & 0 deletions keyboards/helix/rev3_5rows/keymaps/five_rows/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
USER_NAME := mtei

CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# CONSOLE_ENABLE and COMMAND_ENABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#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);
#include "pseudo_sprintf.h"

extern int current_default_layer;

Expand Down Expand Up @@ -68,6 +66,10 @@ void matrix_update(struct CharacterMatrix *dest,
}
# endif

#ifndef PSEUDO_SPRINTF_DEFINED
#include "pseudo_sprintf.c"
#endif

# ifdef SSD1306OLED
static void render_logo(struct CharacterMatrix *matrix) {
# else
Expand All @@ -80,8 +82,10 @@ static void render_logo(void) {
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
0};
oled_write_P(helix_logo, false);
# if defined(RGBLIGHT_ENABLE) || defined(DEBUG_MATRIX_SCAN_RATE)
char buf[30];
char *bufp;
# endif
# ifdef RGBLIGHT_ENABLE
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
bufp = sprint2d(buf, " LED ", rgblight_get_mode());
Expand Down
53 changes: 53 additions & 0 deletions users/mtei/pseudo_sprintf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2022 Takeshi Ishii (@mtei)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "pseudo_sprintf.h"

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);
}
8 changes: 8 additions & 0 deletions users/mtei/pseudo_sprintf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2022 Takeshi Ishii (@mtei)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

char *sprints(char *buf, char *src);
char *sprintd(char *buf, char *leadstr, int data);
char *sprint2d(char *buf, char *leadstr, int data);