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>
namespace KaleidoscopePlugins {
TypingBreaks::settings_t TypingBreaks::settings = {
TypingBreaks::settings_t TypingBreaks::settings = {
.idleTimeLimit = 10000, // 10s
.lockTimeOut = 2700000, // 45m
.lockLength = 300000, // 5m
.leftHandMaxKeys = 0,
.rightHandMaxKeys = 0
};
};
uint32_t TypingBreaks::sessionStartTime;
uint32_t TypingBreaks::lastKeyTime;
uint32_t TypingBreaks::lockStartTime;
uint16_t TypingBreaks::leftHandKeys;
uint16_t TypingBreaks::rightHandKeys;
uint16_t TypingBreaks::settingsBase;
uint32_t TypingBreaks::sessionStartTime;
uint32_t TypingBreaks::lastKeyTime;
uint32_t TypingBreaks::lockStartTime;
uint16_t TypingBreaks::leftHandKeys;
uint16_t TypingBreaks::rightHandKeys;
uint16_t TypingBreaks::settingsBase;
TypingBreaks::TypingBreaks (void) {
}
TypingBreaks::TypingBreaks (void) {
}
void
TypingBreaks::begin (void) {
void
TypingBreaks::begin (void) {
event_handler_hook_use (this->eventHandlerHook);
}
}
Key
TypingBreaks::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
Key
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 (lockStartTime && (millis () - lockStartTime <= settings.lockLength))
return Key_NoKey;
@ -110,10 +110,10 @@ namespace KaleidoscopePlugins {
}
return mappedKey;
}
}
void
TypingBreaks::enableEEPROM (void) {
void
TypingBreaks::enableEEPROM (void) {
settingsBase = ::EEPROMSettings.requestSlice (sizeof (settings));
// If idleTime is max, assume that EEPROM is uninitialized, and store the
@ -125,10 +125,10 @@ namespace KaleidoscopePlugins {
}
EEPROM.get (settingsBase, settings);
}
}
bool
TypingBreaks::focusHook (const char *command) {
bool
TypingBreaks::focusHook (const char *command) {
enum {
IDLE_TIME_LIMIT,
LOCK_TIMEOUT,
@ -192,7 +192,7 @@ namespace KaleidoscopePlugins {
EEPROM.put (settingsBase, settings);
return true;
}
}
};
KaleidoscopePlugins::TypingBreaks TypingBreaks;

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

Loading…
Cancel
Save