summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <hasu@tmk-kbd.com>2015-01-12 04:32:53 +0900
committertmk <hasu@tmk-kbd.com>2015-01-15 17:08:49 +0900
commit3b3af3bae0deac7831c85847bae7729b0e281b8d (patch)
treede7b6b2fa8a6e15a829ac20067a369621ec21670
parent1b95b3c51a0eee5c8e47b189ece68ac55d7e4069 (diff)
Increase buffer of rn42_gets() and change rn42_linked()
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42.c10
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/keyboard/hhkb_rn42/rn42/rn42.c b/keyboard/hhkb_rn42/rn42/rn42.c
index aa6015cbf2..756285d7bb 100644
--- a/keyboard/hhkb_rn42/rn42/rn42.c
+++ b/keyboard/hhkb_rn42/rn42/rn42.c
@@ -53,14 +53,14 @@ int16_t rn42_getc(void)
return serial_recv2();
}
-char *rn42_gets(uint16_t timeout)
+const char *rn42_gets(uint16_t timeout)
{
- static char s[16];
+ static char s[24];
uint16_t t = timer_read();
uint8_t i = 0;
int16_t c;
- while (i < 15 && timer_elapsed(t) < timeout) {
- if ((c = rn42_getc()) != -1) {
+ while (i < 23 && timer_elapsed(t) < timeout) {
+ if ((c = rn42_getc()) != -1) {
if ((char)c == '\r') continue;
if ((char)c == '\n') break;
s[i++] = c;
@@ -126,7 +126,7 @@ bool rn42_linked(void)
// Hi-Z: Not powered
// High: Linked
// Low: Connecting
- return !rn42_rts() && PINF&(1<<6);
+ return PINF&(1<<6);
}
diff --git a/keyboard/hhkb_rn42/rn42/rn42.h b/keyboard/hhkb_rn42/rn42/rn42.h
index 86090be7c5..db6916fe86 100644
--- a/keyboard/hhkb_rn42/rn42/rn42.h
+++ b/keyboard/hhkb_rn42/rn42/rn42.h
@@ -8,7 +8,7 @@ host_driver_t rn42_config_driver;
void rn42_init(void);
int16_t rn42_getc(void);
-char *rn42_gets(uint16_t timeout);
+const char *rn42_gets(uint16_t timeout);
void rn42_putc(uint8_t c);
void rn42_puts(char *s);
bool rn42_autoconnecting(void);