make astyle

pull/389/head
Jesse Vincent 8 years ago
parent e936c9c59a
commit 437a349288
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -21,31 +21,31 @@
#include <Kaleidoscope-Focus.h> #include <Kaleidoscope-Focus.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
TypingBreaks::settings_t TypingBreaks::settings = { TypingBreaks::settings_t TypingBreaks::settings = {
.idleTimeLimit = 10000, // 10s .idleTimeLimit = 10000, // 10s
.lockTimeOut = 2700000, // 45m .lockTimeOut = 2700000, // 45m
.lockLength = 300000, // 5m .lockLength = 300000, // 5m
.leftHandMaxKeys = 0, .leftHandMaxKeys = 0,
.rightHandMaxKeys = 0 .rightHandMaxKeys = 0
}; };
uint32_t TypingBreaks::sessionStartTime; uint32_t TypingBreaks::sessionStartTime;
uint32_t TypingBreaks::lastKeyTime; uint32_t TypingBreaks::lastKeyTime;
uint32_t TypingBreaks::lockStartTime; uint32_t TypingBreaks::lockStartTime;
uint16_t TypingBreaks::leftHandKeys; uint16_t TypingBreaks::leftHandKeys;
uint16_t TypingBreaks::rightHandKeys; uint16_t TypingBreaks::rightHandKeys;
uint16_t TypingBreaks::settingsBase; uint16_t TypingBreaks::settingsBase;
TypingBreaks::TypingBreaks (void) { TypingBreaks::TypingBreaks (void) {
} }
void void
TypingBreaks::begin (void) { TypingBreaks::begin (void) {
event_handler_hook_use (this->eventHandlerHook); event_handler_hook_use (this->eventHandlerHook);
} }
Key Key
TypingBreaks::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { TypingBreaks::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
// If we are locked, and didn't time out yet, no key has to be pressed. // If we are locked, and didn't time out yet, no key has to be pressed.
if (lockStartTime && (millis () - lockStartTime <= settings.lockLength)) if (lockStartTime && (millis () - lockStartTime <= settings.lockLength))
return Key_NoKey; return Key_NoKey;
@ -110,10 +110,10 @@ namespace KaleidoscopePlugins {
} }
return mappedKey; return mappedKey;
} }
void void
TypingBreaks::enableEEPROM (void) { TypingBreaks::enableEEPROM (void) {
settingsBase = ::EEPROMSettings.requestSlice (sizeof (settings)); settingsBase = ::EEPROMSettings.requestSlice (sizeof (settings));
// If idleTime is max, assume that EEPROM is uninitialized, and store the // If idleTime is max, assume that EEPROM is uninitialized, and store the
@ -125,10 +125,10 @@ namespace KaleidoscopePlugins {
} }
EEPROM.get (settingsBase, settings); EEPROM.get (settingsBase, settings);
} }
bool bool
TypingBreaks::focusHook (const char *command) { TypingBreaks::focusHook (const char *command) {
enum { enum {
IDLE_TIME_LIMIT, IDLE_TIME_LIMIT,
LOCK_TIMEOUT, LOCK_TIMEOUT,
@ -192,7 +192,7 @@ namespace KaleidoscopePlugins {
EEPROM.put (settingsBase, settings); EEPROM.put (settingsBase, settings);
return true; return true;
} }
}; };
KaleidoscopePlugins::TypingBreaks TypingBreaks; KaleidoscopePlugins::TypingBreaks TypingBreaks;

@ -21,7 +21,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
class TypingBreaks : public KaleidoscopePlugin { class TypingBreaks : public KaleidoscopePlugin {
public: public:
TypingBreaks (void); TypingBreaks (void);
@ -50,7 +50,7 @@ namespace KaleidoscopePlugins {
static uint16_t settingsBase; static uint16_t settingsBase;
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
}; };
}; };
extern KaleidoscopePlugins::TypingBreaks TypingBreaks; extern KaleidoscopePlugins::TypingBreaks TypingBreaks;

Loading…
Cancel
Save