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/LayerState.h

25 lines
939 B
C
Raw Normal View History

2016-05-09 14:05:08 +00:00
#ifndef LAYERSTATE_H
#define LAYERSTATE_H
#include <inttypes.h>
2016-05-28 21:16:32 +00:00
#include <LayerStateInterface.h>
2016-05-09 14:05:08 +00:00
2016-07-18 02:03:03 +00:00
/* Basic LayerState for keyboard.
2016-05-28 21:16:32 +00:00
When pressed, Code_Layer objects call LayerState functions lock() or hold().
When pressed, Layered objects call LayerState function getActiveLayer().
2016-05-09 14:05:08 +00:00
*/
2016-05-28 21:16:32 +00:00
class LayerState : public LayerStateInterface
2016-05-09 14:05:08 +00:00
{
protected:
uint8_t activeLayer; //currently active layer
uint8_t lockedLayer; //most recently pressed lock layer
virtual void setActiveLayer(const uint8_t layer);
public:
2016-05-28 21:16:32 +00:00
LayerState() : activeLayer(0), lockedLayer(0) {}
2016-05-19 17:51:57 +00:00
virtual void hold(uint8_t layer); //set activeLayer
virtual void unhold(const uint8_t layer); //restore activeLayer to lockedLayer
virtual void lock(uint8_t layer); //set activeLayer and lock it
2016-05-09 14:05:08 +00:00
virtual uint8_t getActiveLayer();
};
#endif