Arkiverade
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
2016-09-19 19:46:03 -06:00

26 rader
886 B
C++

#ifndef KEY_LAYEREDKEYS_H
#define KEY_LAYEREDKEYS_H
#include <Arduino.h>
#include <inttypes.h>
#include <LayerStateInterface.h>
#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.
When the key is pressed, active layerId is retreived from refLayerState and
the Key object of the active layerId is called.
*/
class Key_LayeredKeys : public Key
{
private:
Key*const *const ptrsKeys; //array of Key pointers, one Key per layer
uint8_t layerId; //active layer when key was pressed
static LayerStateInterface& refLayerState;
public:
Key_LayeredKeys(Key* const ptrsKeys[]): ptrsKeys(ptrsKeys) {}
virtual void press();
virtual void release();
};
#endif