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.

action_layer.h 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 ACTION_LAYER_H
  15. #define ACTION_LAYER_H
  16. #include <stdint.h>
  17. #include "keyboard.h"
  18. #include "action.h"
  19. /*
  20. * Default Layer
  21. */
  22. extern uint32_t default_layer_state;
  23. void default_layer_debug(void);
  24. void default_layer_set(uint32_t state);
  25. #ifndef NO_ACTION_LAYER
  26. /* bitwise operation */
  27. void default_layer_or(uint32_t state);
  28. void default_layer_and(uint32_t state);
  29. void default_layer_xor(uint32_t state);
  30. #else
  31. #define default_layer_or(state)
  32. #define default_layer_and(state)
  33. #define default_layer_xor(state)
  34. #endif
  35. /*
  36. * Keymap Layer
  37. */
  38. #ifndef NO_ACTION_LAYER
  39. extern uint32_t layer_state;
  40. void layer_debug(void);
  41. void layer_clear(void);
  42. void layer_move(uint8_t layer);
  43. void layer_on(uint8_t layer);
  44. void layer_off(uint8_t layer);
  45. void layer_invert(uint8_t layer);
  46. /* bitwise operation */
  47. void layer_or(uint32_t state);
  48. void layer_and(uint32_t state);
  49. void layer_xor(uint32_t state);
  50. #else
  51. #define layer_state 0
  52. #define layer_clear()
  53. #define layer_move(layer)
  54. #define layer_on(layer)
  55. #define layer_off(layer)
  56. #define layer_invert(layer)
  57. #define layer_or(state)
  58. #define layer_and(state)
  59. #define layer_xor(state)
  60. #define layer_debug()
  61. #endif
  62. /* return action depending on current layer status */
  63. action_t layer_switch_get_action(keypos_t key);
  64. #endif