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

33 lines
997 B
C++

#ifndef CODE_LEDLOCK_H
#define CODE_LEDLOCK_H
#include <Arduino.h>
#include <inttypes.h>
#include "Code.h"
#include "LEDInterface.h"
extern volatile uint8_t keyboard_leds;
/* Class Code_LEDLock turns LED on and off
scancode is KEY_CAPS_LOCK, KEY_SCROLL_LOCK, or KEY_NUM_LOCK
In keybrd sketch, ports should be instantiated before Code_LEDLock is instantiated
because LED.off() needs ports to be configured by port constructor.
If a key does not have an LED indictor light, use Code_S instead e.g.:
Code_S CapsLck(KEY_CAPS_LOCK);
*/
class Code_LEDLock : public Code
{
private:
const uint16_t scancode;
uint8_t USB_LED_bit; //codes used by keyboard output report
LEDInterface& refLED; //indicator on keyboard
void updateLED() const;
public:
Code_LEDLock(const uint16_t scancode, LEDInterface& refLED);
virtual void press();
virtual void release();
};
#endif