keybrd library is an open source library for creating custom-keyboard firmware.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

StateLayers.h 988B

12345678910111213141516171819202122232425
  1. #ifndef LAYERSTATE_H
  2. #define LAYERSTATE_H
  3. #include <inttypes.h>
  4. #include <StateLayersInterface.h>
  5. //#include <LED.h>
  6. /* basic StateLayers for keyboard.
  7. When pressed, Code_Layer objects call StateLayers functions lock() or hold().
  8. When pressed, Layered objects call StateLayers function getActiveLayer().
  9. */
  10. class StateLayers : public StateLayersInterface
  11. {
  12. protected:
  13. uint8_t activeLayer; //currently active layer
  14. uint8_t lockedLayer; //most recently pressed lock layer
  15. virtual void setActiveLayer(const uint8_t layer);
  16. public:
  17. StateLayers() : activeLayer(0), lockedLayer(0) {}
  18. virtual void hold(uint8_t layer); //set activeLayer
  19. virtual void unhold(const uint8_t layer); //restore activeLayer to lockedLayer
  20. virtual void lock(uint8_t layer); //set activeLayer and lock it
  21. virtual uint8_t getActiveLayer();
  22. };
  23. #endif