1
0

Increase buffer of rn42_gets() and change rn42_linked()

This commit is contained in:
tmk 2015-01-12 04:32:53 +09:00
parent 1b95b3c51a
commit 3b3af3bae0
2 changed files with 6 additions and 6 deletions

View File

@ -53,13 +53,13 @@ int16_t rn42_getc(void)
return serial_recv2(); 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(); uint16_t t = timer_read();
uint8_t i = 0; uint8_t i = 0;
int16_t c; int16_t c;
while (i < 15 && timer_elapsed(t) < timeout) { while (i < 23 && timer_elapsed(t) < timeout) {
if ((c = rn42_getc()) != -1) { if ((c = rn42_getc()) != -1) {
if ((char)c == '\r') continue; if ((char)c == '\r') continue;
if ((char)c == '\n') break; if ((char)c == '\n') break;
@ -126,7 +126,7 @@ bool rn42_linked(void)
// Hi-Z: Not powered // Hi-Z: Not powered
// High: Linked // High: Linked
// Low: Connecting // Low: Connecting
return !rn42_rts() && PINF&(1<<6); return PINF&(1<<6);
} }

View File

@ -8,7 +8,7 @@ host_driver_t rn42_config_driver;
void rn42_init(void); void rn42_init(void);
int16_t rn42_getc(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_putc(uint8_t c);
void rn42_puts(char *s); void rn42_puts(char *s);
bool rn42_autoconnecting(void); bool rn42_autoconnecting(void);