Kaleidoscope
TypingBreaks.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*-
2  * Kaleidoscope-TypingBreaks -- Enforced typing breaks
3  * Copyright (C) 2017 Gergely Nagy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include <Kaleidoscope.h>
22 
23 namespace kaleidoscope {
24 
26  public:
27  TypingBreaks(void);
28 
29  void begin(void) final;
30 
31  static void enableEEPROM(void);
32  static bool focusHook(const char *command);
33 
34  typedef struct settings_t {
35  uint32_t idle_time_limit;
36  uint32_t lock_time_out;
37  uint32_t lock_length;
40  } settings_t;
41 
43 
44  private:
45  static uint32_t session_start_time_;
46  static uint32_t lock_start_time_;
47  static uint32_t last_key_time_;
48  static uint16_t left_hand_keys_;
49  static uint16_t right_hand_keys_;
50 
51  static uint16_t settings_base_;
52 
53  static Key eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_state);
54 };
55 
56 }
57 
59 
60 void TypingBreak(bool is_locked);
61 
62 #define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \
63  "typingbreaks.idleTimeLimit\n" \
64  "typingbreaks.lockTimeOut\n" \
65  "typingbreaks.lockLength\n" \
66  "typingbreaks.leftMaxKeys\n" \
67  "typingbreaks.rightMaxKeys")
uint16_t right_hand_max_keys
Definition: TypingBreaks.h:39
uint32_t lock_length
Definition: TypingBreaks.h:37
uint32_t idle_time_limit
Definition: TypingBreaks.h:35
Definition: TypingBreaks.h:34
struct kaleidoscope::TypingBreaks::settings_t settings_t
Definition: hid.cpp:4
byte byte col
Definition: TapDance.cpp:229
Definition: key_defs.h:13
TypingBreaks(void)
Definition: TypingBreaks.cpp:40
uint32_t lock_time_out
Definition: TypingBreaks.h:36
Definition: Kaleidoscope.h:40
static void enableEEPROM(void)
Definition: TypingBreaks.cpp:114
void TypingBreak(bool is_locked)
byte row
Definition: TapDance.cpp:229
void begin(void) final
Definition: TypingBreaks.cpp:43
Definition: TypingBreaks.h:25
static settings_t settings
Definition: TypingBreaks.h:42
static bool focusHook(const char *command)
Definition: TypingBreaks.cpp:128
uint16_t left_hand_max_keys
Definition: TypingBreaks.h:38