X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=keyboard%2Fhhkb%2Frn42%2Frn42.c;h=88951be4278007ca28a64e061499ba66e9a06f5e;hb=39aeb1f7a23e3bb1415fd47ca91f522d30697dc3;hp=710169ef3826d16e35ea1bd9d15b8a9cb66a6c14;hpb=f37805e698a34ce07f10c7f5316f9bbd2a63563b;p=max%2Ftmk_keyboard.git diff --git a/keyboard/hhkb/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c index 710169ef..88951be4 100644 --- a/keyboard/hhkb/rn42/rn42.c +++ b/keyboard/hhkb/rn42/rn42.c @@ -134,6 +134,34 @@ static uint8_t leds = 0; static uint8_t keyboard_leds(void) { return leds; } void rn42_set_leds(uint8_t l) { leds = l; } + +void rn42_send_str(const char *str) +{ + uint8_t c; + while ((c = pgm_read_byte(str++))) + rn42_putc(c); +} + +const char *rn42_send_command(const char *cmd) +{ + static const char *s; + rn42_send_str(cmd); + wait_ms(500); + s = rn42_gets(100); + xprintf("%s\r\n", s); + rn42_print_response(); + return s; +} + +void rn42_print_response(void) +{ + int16_t c; + while ((c = rn42_getc()) != -1) { + xprintf("%c", c); + } +} + + static void send_keyboard(report_keyboard_t *report) { // wake from deep sleep