You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

command_extra.c 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include "stdbool.h"
  2. #include "stdint.h"
  3. #include "keycode.h"
  4. #include "serial.h"
  5. #include "print.h"
  6. #include "command.h"
  7. bool sun_bell = false;
  8. bool sun_click = false;
  9. bool command_extra(uint8_t code)
  10. {
  11. switch (code) {
  12. case KC_H:
  13. case KC_SLASH: /* ? */
  14. print("\n\n----- Sun converter Help -----\n");
  15. print("Home: Toggle Bell\n");
  16. print("End: Toggle Click\n");
  17. print("PgUp: LED all On\n");
  18. print("PgDown: LED all On\n");
  19. print("Insert: Layout\n");
  20. print("Delete: Reset\n");
  21. return false;
  22. case KC_DEL:
  23. print("Reset\n");
  24. serial_send(0x01);
  25. break;
  26. case KC_HOME:
  27. sun_bell = !sun_bell;
  28. if (sun_bell) {
  29. print("Bell On\n");
  30. serial_send(0x02);
  31. } else {
  32. print("Bell Off\n");
  33. serial_send(0x03);
  34. }
  35. break;
  36. case KC_END:
  37. sun_click = !sun_click;
  38. if (sun_click) {
  39. print("Click On\n");
  40. serial_send(0x0A);
  41. } else {
  42. print("Click Off\n");
  43. serial_send(0x0B);
  44. }
  45. break;
  46. case KC_PGUP:
  47. print("LED all on\n");
  48. serial_send(0x0E);
  49. serial_send(0xFF);
  50. break;
  51. case KC_PGDOWN:
  52. print("LED all off\n");
  53. serial_send(0x0E);
  54. serial_send(0x00);
  55. break;
  56. case KC_INSERT:
  57. print("layout\n");
  58. serial_send(0x0F);
  59. break;
  60. default:
  61. xprintf("Unknown extra command: %02X\n", code);
  62. return false;
  63. }
  64. return true;
  65. }