remote_kb.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 2020 Jay Greco
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include "quantum.h"
  18. #define SERIAL_UART_BAUD 153600 //low error rate for 32u4 @ 16MHz
  19. #define UART_PREAMBLE 0x69
  20. #define UART_MSG_LEN 5
  21. #define UART_NULL 0
  22. #define IDX_PREAMBLE 0
  23. #define IDX_KCLSB 1
  24. #define IDX_KCMSB 2
  25. #define IDX_PRESSED 3
  26. #define IDX_CHECKSUM 4
  27. #define IS_HID_KC(x) ((x > 0) && (x < 0xFF))
  28. #define IS_RM_KC(x) ((x >= RM_BASE) && (x <= 0xFFFF))
  29. #define RM_BASE 0xFFFF-16
  30. enum remote_macros {
  31. RM_1 = RM_BASE,
  32. RM_2, RM_3,
  33. RM_4, RM_5,
  34. RM_6, RM_7,
  35. RM_8, RM_9,
  36. RM_10, RM_11,
  37. RM_12, RM_13,
  38. RM_14, RM_15,
  39. };
  40. // Public functions
  41. void
  42. matrix_init_remote_kb(void),
  43. process_record_remote_kb(uint16_t keycode, keyrecord_t *record),
  44. matrix_scan_remote_kb(void);