aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2017-07-12 22:18:13 +1000
committerBen V. Brown <[email protected]>2017-07-12 22:18:13 +1000
commitc8f49d173a975e31c8120b8812ac64687223c93e (patch)
tree1321629bbc8963d44a2f468519aa998c9691b5ac
parente6f343c8c30d48fad924a5c04c357bcf416710f0 (diff)
downloadIronOS-c8f49d173a975e31c8120b8812ac64687223c93e.tar.gz
IronOS-c8f49d173a975e31c8120b8812ac64687223c93e.zip
Add key auto-repeatv1.13
-rw-r--r--workspace/ts100/inc/Interrupt.h7
-rw-r--r--workspace/ts100/src/Modes.c9
2 files changed, 10 insertions, 6 deletions
diff --git a/workspace/ts100/inc/Interrupt.h b/workspace/ts100/inc/Interrupt.h
index ef0ed2fa..c7eba7c1 100644
--- a/workspace/ts100/inc/Interrupt.h
+++ b/workspace/ts100/inc/Interrupt.h
@@ -26,9 +26,9 @@ inline void resetLastButtonPress() {
}
inline void resetButtons() {
- lastKeyPress = millis();
keyState = 0;
}
+
inline uint32_t getLastMovement() {
return lastMovement;
}
@@ -39,7 +39,10 @@ inline uint16_t getButtons() {
inline uint16_t getRawButtons() {
return rawKeys;
}
-
+inline void restoreButtons()
+{
+ keyState=getRawButtons();
+}
/*IRQ prototypes*/
void NMI_Handler(void);
diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c
index 41e69fd9..8fba445c 100644
--- a/workspace/ts100/src/Modes.c
+++ b/workspace/ts100/src/Modes.c
@@ -22,13 +22,14 @@ uint32_t temporaryTempStorage = 0;
void ProcessUI() {
uint8_t Buttons = getButtons(); //read the buttons status
static uint32_t lastModeChange = 0;
- if (millis() - getLastButtonPress() < 30)
+ if (getRawButtons() && ((millis() - getLastButtonPress()) > 1000)) {
+ lastKeyPress = millis() - 600;
+ Buttons = getRawButtons();
+ } else if (millis() - getLastButtonPress() < 80) {
Buttons = 0;
- else if (Buttons != 0) {
- resetLastButtonPress();
+ } else if (Buttons != 0) {
resetButtons();
}
- //rough prevention for de-bouncing and allocates settling time
switch (operatingMode) {
case STARTUP: