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_stack.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_STACK_H
  15. #define LAYER_STACK_H
  16. #include <stdint.h>
  17. #include "action.h"
  18. /*
  19. * Layer stack
  20. */
  21. #define LAYER_STACK_SIZE 8
  22. typedef struct {
  23. uint8_t layer:4;
  24. uint8_t next:3;
  25. bool used;
  26. } layer_item_t;
  27. bool layer_stack_push(uint8_t layer);
  28. bool layer_stack_pop(void);
  29. bool layer_stack_remove(uint8_t layer);
  30. bool layer_stack_remove_then_push(uint8_t layer);
  31. bool layer_stack_remove_or_push(uint8_t layer);
  32. void layer_stack_debug(void);
  33. action_t layer_stack_get_action(key_t key);
  34. #endif