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.

Key_LayeredCodeScBase.h 798B

12345678910111213141516171819202122232425
  1. #ifndef KEY_LAYEREDCODESCBASE_H
  2. #define KEY_LAYEREDCODESCBASE_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include "Code.h"
  6. /* Class Key_LayeredCodeScBase is an abstract base class for 2-layer keys:
  7. if layerId=0, send code0
  8. if layerId=1, send scancode1
  9. */
  10. class Key_LayeredCodeScBase : public Code
  11. {
  12. private:
  13. Code& refCode0;
  14. const uint16_t scancode1;
  15. protected:
  16. bool layerId; //active layer when key was pressed, 0 or 1
  17. public:
  18. Key_LayeredCodeScBase(Code& refCode0, const uint16_t scancode1, uint8_t layerId):
  19. refCode0(refCode0), scancode1(scancode1), layerId(layerId) { }
  20. virtual void press()=0;
  21. virtual void release();
  22. virtual void pressCode();
  23. };
  24. #endif