Advertisement
joric

bluetooth_battery_level.patch

Jun 11th, 2016
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.50 KB | None | 0 0
  1. diff --git a/keyboard/hhkb/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c
  2. index 710169e..0af0daf 100644
  3. --- a/keyboard/hhkb/rn42/rn42.c
  4. +++ b/keyboard/hhkb/rn42/rn42.c
  5. @@ -235,3 +235,16 @@ static void config_send_keyboard(report_keyboard_t *report) {}
  6.  static void config_send_mouse(report_mouse_t *report) {}
  7.  static void config_send_system(uint16_t data) {}
  8.  static void config_send_consumer(uint16_t data) {}
  9. +
  10. +void rn42_printf(const char * format, ...) {
  11. +    int i;
  12. +    char buf[256];
  13. +    va_list args;
  14. +    va_start(args, format);
  15. +    vsprintf(buf, format, args);
  16. +    va_end(args);
  17. +    for (i=0; i<strlen(buf); i++) {
  18. +        serial_send(buf[i]);
  19. +    }
  20. +}
  21. +
  22. diff --git a/keyboard/hhkb/rn42/rn42.h b/keyboard/hhkb/rn42/rn42.h
  23. index db6916f..9ec0d0c 100644
  24. --- a/keyboard/hhkb/rn42/rn42.h
  25. +++ b/keyboard/hhkb/rn42/rn42.h
  26. @@ -19,5 +19,6 @@ void rn42_cts_hi(void);
  27.  void rn42_cts_lo(void);
  28.  bool rn42_linked(void);
  29.  void rn42_set_leds(uint8_t l);
  30. +void rn42_printf(const char * format, ...);
  31.  
  32.  #endif
  33. diff --git a/keyboard/hhkb/rn42/rn42_task.c b/keyboard/hhkb/rn42/rn42_task.c
  34. index 5107fef..e465eaa 100644
  35. --- a/keyboard/hhkb/rn42/rn42_task.c
  36. +++ b/keyboard/hhkb/rn42/rn42_task.c
  37. @@ -364,6 +364,7 @@ bool command_extra(uint8_t code)
  38.              xprintf("%02u:",   t/3600);
  39.              xprintf("%02u:",   t%3600/60);
  40.              xprintf("%02u\n",  t%60);
  41. +            rn42_printf("BAT: %umV\t", b);
  42.              return true;
  43.          case KC_U:
  44.              if (config_mode) return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement