Gearchiveerd
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_LayeredKeys.h

26 regels
886 B
C

#ifndef KEY_LAYEREDKEYS_H
#define KEY_LAYEREDKEYS_H
2016-05-09 14:05:08 +00:00
#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_LayeredKeys contains an array of Key pointers, one pointer per layer.
Codes are a kind of Key, so the Key pointers can point to Codes or Keys.
2016-05-09 14:05:08 +00:00
2016-09-20 01:46:03 +00:00
When the key is pressed, active layerId is retreived from refLayerState and
the Key object of the active layerId is called.
2016-05-09 14:05:08 +00:00
*/
class Key_LayeredKeys : public Key
2016-05-09 14:05:08 +00:00
{
private:
2016-07-18 02:26:00 +00:00
Key*const *const ptrsKeys; //array of Key pointers, one Key per layer
2016-09-20 01:46:03 +00:00
uint8_t layerId; //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_LayeredKeys(Key* const ptrsKeys[]): ptrsKeys(ptrsKeys) {}
2016-05-09 14:05:08 +00:00
virtual void press();
virtual void release();
};
#endif