keybrd library is an open source library for creating custom-keyboard firmware.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.

LayerState.h 947B

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