keybrd library is an open source library for creating custom-keyboard firmware.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

Key_LayeredKeys.h 886B

12345678910111213141516171819202122232425
  1. #ifndef KEY_LAYEREDKEYS_H
  2. #define KEY_LAYEREDKEYS_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <LayerStateInterface.h>
  6. #include <Key.h>
  7. /* Class Key_LayeredKeys contains an array of Key pointers, one pointer per layer.
  8. Codes are a kind of Key, so the Key pointers can point to Codes or Keys.
  9. When the key is pressed, active layerId is retreived from refLayerState and
  10. the Key object of the active layerId is called.
  11. */
  12. class Key_LayeredKeys : public Key
  13. {
  14. private:
  15. Key*const *const ptrsKeys; //array of Key pointers, one Key per layer
  16. uint8_t layerId; //active layer when key was pressed
  17. static LayerStateInterface& refLayerState;
  18. public:
  19. Key_LayeredKeys(Key* const ptrsKeys[]): ptrsKeys(ptrsKeys) {}
  20. virtual void press();
  21. virtual void release();
  22. };
  23. #endif