Archived
1
0
This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
keybrd/src/Key_LayeredKeysArray.h

26 lines
906 B
C
Raw Normal View History

2016-05-09 14:05:08 +00:00
#ifndef KEY_LAYEREDKEYSARRAY_H
#define KEY_LAYEREDKEYSARRAY_H
#include <Arduino.h>
#include <inttypes.h>
2016-05-28 21:16:32 +00:00
#include <LayerStateInterface.h>
2016-05-09 14:05:08 +00:00
#include <Key.h>
/* Class Key_LayeredKeysArray contains an array of Key pointers, one pointer per layer.
Codes are a kind of Key, so the Key pointers can point to Codes as well.
2016-05-28 21:16:32 +00:00
When the key is pressed, active layer is retreived from refLayerState and
2016-05-09 14:05:08 +00:00
the Key object of the active layer is called.
*/
class Key_LayeredKeysArray : public Key
{
private:
Key *const *const ptrsKeys; //array of Key pointers, one Key per layer
uint8_t layer; //active layer when key was pressed
2016-05-28 21:16:32 +00:00
static LayerStateInterface& refLayerState;
2016-05-09 14:05:08 +00:00
public:
Key_LayeredKeysArray(Key *const ptrsKeys[]): ptrsKeys(ptrsKeys) {}
virtual void press();
virtual void release();
};
#endif