Keyboard firmwares for Atmel AVR and Cortex-M
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

eeconfig.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. Copyright 2013 Jun Wako <[email protected]>
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef EECONFIG_H
  15. #define EECONFIG_H
  16. #include <stdint.h>
  17. #ifndef EECONFIG_IS_ENABLED
  18. #define EECONFIG_IS_ENABLED() true
  19. #endif
  20. #define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEED
  21. /* eeprom parameteter address */
  22. #define EECONFIG_MAGIC (uint16_t *)0
  23. #define EECONFIG_DEBUG (uint8_t *)2
  24. #define EECONFIG_DEFAULT_LAYER (uint8_t *)3
  25. #define EECONFIG_KEYCONF (uint8_t *)4
  26. #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5
  27. /* debug bit */
  28. #define EECONFIG_DEBUG_ENABLE (1<<0)
  29. #define EECONFIG_DEBUG_MATRIX (1<<1)
  30. #define EECONFIG_DEBUG_KEYBOARD (1<<2)
  31. #define EECONFIG_DEBUG_MOUSE (1<<3)
  32. /* keyconf bit */
  33. #define EECONFIG_KEYCONF_SWAP_CONTROL_CAPSLOCK (1<<0)
  34. #define EECONFIG_KEYCONF_CAPSLOCK_TO_CONTROL (1<<1)
  35. #define EECONFIG_KEYCONF_SWAP_LALT_LGUI (1<<2)
  36. #define EECONFIG_KEYCONF_SWAP_RALT_RGUI (1<<3)
  37. #define EECONFIG_KEYCONF_NO_GUI (1<<4)
  38. #define EECONFIG_KEYCONF_SWAP_GRAVE_ESC (1<<5)
  39. #define EECONFIG_KEYCONF_SWAP_BACKSLASH_BACKSPACE (1<<6)
  40. /* XXX: Not portable. Bit field order depends on implementation */
  41. typedef union {
  42. uint8_t raw;
  43. struct {
  44. bool swap_control_capslock:1;
  45. bool capslock_to_control:1;
  46. bool swap_lalt_lgui:1;
  47. bool swap_ralt_rgui:1;
  48. bool no_gui:1;
  49. bool swap_grave_esc:1;
  50. bool swap_backslash_backspace:1;
  51. bool reserved:1;
  52. };
  53. } keyconf;
  54. bool eeconfig_is_enabled(void);
  55. void eeconfig_init(void);
  56. void eeconfig_enable(void);
  57. void eeconfig_disable(void);
  58. uint8_t eeconfig_read_debug(void);
  59. void eeconfig_write_debug(uint8_t val);
  60. uint8_t eeconfig_read_defalt_layer(void);
  61. void eeconfig_write_defalt_layer(uint8_t val);
  62. uint8_t eeconfig_read_keyconf(void);
  63. void eeconfig_write_keyconf(uint8_t val);
  64. #endif