Skip to content

Commit 8ee49a2

Browse files
authored
Fix due to debounce not working (#27)
1 parent c164302 commit 8ee49a2

File tree

4 files changed

+10
-50
lines changed

4 files changed

+10
-50
lines changed

kbduplexmatrix.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
8585
d.cycleCounter[idx] = 0
8686
}
8787
case NoneToPress:
88-
if current {
89-
d.State[idx] = Press
90-
} else {
91-
d.State[idx] = PressToRelease
92-
}
88+
d.State[idx] = Press
9389
case Press:
9490
if current {
9591
d.cycleCounter[idx] = 0
@@ -102,11 +98,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
10298
}
10399
}
104100
case PressToRelease:
105-
if current {
106-
d.State[idx] = NoneToPress
107-
} else {
108-
d.State[idx] = None
109-
}
101+
d.State[idx] = None
110102
}
111103
}
112104
d.Col[c].High()
@@ -132,11 +124,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
132124
d.cycleCounter[idx] = 0
133125
}
134126
case NoneToPress:
135-
if current {
136-
d.State[idx] = Press
137-
} else {
138-
d.State[idx] = PressToRelease
139-
}
127+
d.State[idx] = Press
140128
case Press:
141129
if current {
142130
d.cycleCounter[idx] = 0
@@ -149,11 +137,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
149137
}
150138
}
151139
case PressToRelease:
152-
if current {
153-
d.State[idx] = NoneToPress
154-
} else {
155-
d.State[idx] = None
156-
}
140+
d.State[idx] = None
157141
}
158142
}
159143
d.Row[r].High()

kbgpio.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ func (d *GpioKeyboard) Get() []State {
8484
d.cycleCounter[c] = 0
8585
}
8686
case NoneToPress:
87-
if current {
88-
d.State[c] = Press
89-
} else {
90-
d.State[c] = PressToRelease
91-
}
87+
d.State[c] = Press
9288
case Press:
9389
if current {
9490
d.cycleCounter[c] = 0
@@ -101,11 +97,7 @@ func (d *GpioKeyboard) Get() []State {
10197
}
10298
}
10399
case PressToRelease:
104-
if current {
105-
d.State[c] = NoneToPress
106-
} else {
107-
d.State[c] = None
108-
}
100+
d.State[c] = None
109101
}
110102
}
111103

kbmatrix.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ func (d *MatrixKeyboard) Get() []State {
9999
d.cycleCounter[idx] = 0
100100
}
101101
case NoneToPress:
102-
if current {
103-
d.State[idx] = Press
104-
} else {
105-
d.State[idx] = PressToRelease
106-
}
102+
d.State[idx] = Press
107103
case Press:
108104
if current {
109105
d.cycleCounter[idx] = 0
@@ -116,11 +112,7 @@ func (d *MatrixKeyboard) Get() []State {
116112
}
117113
}
118114
case PressToRelease:
119-
if current {
120-
d.State[idx] = NoneToPress
121-
} else {
122-
d.State[idx] = None
123-
}
115+
d.State[idx] = None
124116
}
125117
if !d.options.InvertDiode {
126118
d.Col[c].Low()

kbsquaredmatrix.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ func (d *SquaredMatrixKeyboard) Get() []State {
8989
d.cycleCounter[idx] = 0
9090
}
9191
case NoneToPress:
92-
if current {
93-
d.State[idx] = Press
94-
} else {
95-
d.State[idx] = PressToRelease
96-
}
92+
d.State[idx] = Press
9793
case Press:
9894
if current {
9995
d.cycleCounter[idx] = 0
@@ -106,11 +102,7 @@ func (d *SquaredMatrixKeyboard) Get() []State {
106102
}
107103
}
108104
case PressToRelease:
109-
if current {
110-
d.State[idx] = NoneToPress
111-
} else {
112-
d.State[idx] = None
113-
}
105+
d.State[idx] = None
114106
}
115107
d.Pins[j].Configure(machine.PinConfig{Mode: machine.PinInputPullup})
116108
}

0 commit comments

Comments
 (0)