Keyboard firmwares for Atmel AVR and Cortex-M
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.

layer_switch.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 LAYER_SWITCH_H
  15. #define LAYER_SWITCH_H
  16. #include <stdint.h>
  17. #include "keyboard.h"
  18. #include "action.h"
  19. /*
  20. * Default Layer
  21. */
  22. /* base layer to fall back */
  23. extern uint8_t default_layer;
  24. void default_layer_set(uint8_t layer);
  25. /*
  26. * Keymap Layer
  27. */
  28. #ifndef NO_ACTION_LAYER
  29. extern uint16_t keymap_stat;
  30. /* return current active layer */
  31. uint8_t keymap_get_layer(void);
  32. void keymap_clear(void);
  33. void keymap_set(uint16_t stat);
  34. void keymap_move(uint8_t layer);
  35. void keymap_on(uint8_t layer);
  36. void keymap_off(uint8_t layer);
  37. void keymap_invert(uint8_t layer);
  38. /* bitwise operation */
  39. void keymap_or(uint16_t stat);
  40. void keymap_and(uint16_t stat);
  41. void keymap_xor(uint16_t stat);
  42. void keymap_debug(void);
  43. #else
  44. #define keymap_stat 0
  45. #define keymap_get_layer()
  46. #define keymap_clear()
  47. #define keymap_set(stat)
  48. #define keymap_move(layer)
  49. #define keymap_on(layer)
  50. #define keymap_off(layer)
  51. #define keymap_invert(layer)
  52. #define keymap_or(stat)
  53. #define keymap_and(stat)
  54. #define keymap_xor(stat)
  55. #define keymap_debug()
  56. #endif
  57. /* return action depending on current layer status */
  58. action_t layer_switch_get_action(key_t key);
  59. #endif