Skip to content

Commit

Permalink
Fix due to debounce not working (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
sago35 authored Jan 16, 2024
1 parent c164302 commit 8ee49a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 50 deletions.
24 changes: 4 additions & 20 deletions kbduplexmatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
d.cycleCounter[idx] = 0
}
case NoneToPress:
if current {
d.State[idx] = Press
} else {
d.State[idx] = PressToRelease
}
d.State[idx] = Press
case Press:
if current {
d.cycleCounter[idx] = 0
Expand All @@ -102,11 +98,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
}
}
case PressToRelease:
if current {
d.State[idx] = NoneToPress
} else {
d.State[idx] = None
}
d.State[idx] = None
}
}
d.Col[c].High()
Expand All @@ -132,11 +124,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
d.cycleCounter[idx] = 0
}
case NoneToPress:
if current {
d.State[idx] = Press
} else {
d.State[idx] = PressToRelease
}
d.State[idx] = Press
case Press:
if current {
d.cycleCounter[idx] = 0
Expand All @@ -149,11 +137,7 @@ func (d *DuplexMatrixKeyboard) Get() []State {
}
}
case PressToRelease:
if current {
d.State[idx] = NoneToPress
} else {
d.State[idx] = None
}
d.State[idx] = None
}
}
d.Row[r].High()
Expand Down
12 changes: 2 additions & 10 deletions kbgpio.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ func (d *GpioKeyboard) Get() []State {
d.cycleCounter[c] = 0
}
case NoneToPress:
if current {
d.State[c] = Press
} else {
d.State[c] = PressToRelease
}
d.State[c] = Press
case Press:
if current {
d.cycleCounter[c] = 0
Expand All @@ -101,11 +97,7 @@ func (d *GpioKeyboard) Get() []State {
}
}
case PressToRelease:
if current {
d.State[c] = NoneToPress
} else {
d.State[c] = None
}
d.State[c] = None
}
}

Expand Down
12 changes: 2 additions & 10 deletions kbmatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ func (d *MatrixKeyboard) Get() []State {
d.cycleCounter[idx] = 0
}
case NoneToPress:
if current {
d.State[idx] = Press
} else {
d.State[idx] = PressToRelease
}
d.State[idx] = Press
case Press:
if current {
d.cycleCounter[idx] = 0
Expand All @@ -116,11 +112,7 @@ func (d *MatrixKeyboard) Get() []State {
}
}
case PressToRelease:
if current {
d.State[idx] = NoneToPress
} else {
d.State[idx] = None
}
d.State[idx] = None
}
if !d.options.InvertDiode {
d.Col[c].Low()
Expand Down
12 changes: 2 additions & 10 deletions kbsquaredmatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ func (d *SquaredMatrixKeyboard) Get() []State {
d.cycleCounter[idx] = 0
}
case NoneToPress:
if current {
d.State[idx] = Press
} else {
d.State[idx] = PressToRelease
}
d.State[idx] = Press
case Press:
if current {
d.cycleCounter[idx] = 0
Expand All @@ -106,11 +102,7 @@ func (d *SquaredMatrixKeyboard) Get() []State {
}
}
case PressToRelease:
if current {
d.State[idx] = NoneToPress
} else {
d.State[idx] = None
}
d.State[idx] = None
}
d.Pins[j].Configure(machine.PinConfig{Mode: machine.PinInputPullup})
}
Expand Down

0 comments on commit 8ee49a2

Please sign in to comment.