Skip to content

Commit 21a801d

Browse files
committed
all 5 working!
1 parent 84cc3cf commit 21a801d

4 files changed

Lines changed: 136 additions & 68 deletions

File tree

Keypad.Flasher.Server.Tests/ConfigurationGeneratorTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,19 @@ public void GenerateSource_WithTenButtons_WritesExpectedConfiguration()
225225
{
226226
var buttons = new List<ButtonBinding>
227227
{
228-
new ButtonBinding(7, true, 0, false, false, new HidSequenceBinding("a", 0)),
229-
new ButtonBinding(8, true, 1, false, false, new HidSequenceBinding("b", 0)),
230-
new ButtonBinding(9, true, 2, false, false, new HidSequenceBinding("c", 0)),
231-
new ButtonBinding(10, true, 3, false, false, new HidSequenceBinding("d", 0)),
232-
new ButtonBinding(11, true, 4, false, false, new HidSequenceBinding("e", 0)),
233-
new ButtonBinding(12, true, 5, false, false, new HidSequenceBinding("f", 0)),
234-
new ButtonBinding(13, true, 6, false, false, new HidSequenceBinding("g", 0)),
235-
new ButtonBinding(14, true, 7, false, false, new HidSequenceBinding("h", 0)),
236-
new ButtonBinding(15, true, 8, false, false, new HidSequenceBinding("i", 0)),
237-
new ButtonBinding(16, true, 9, false, false, new HidSequenceBinding("j", 0))
228+
new ButtonBinding(32, true, -1, true, true, new HidSequenceBinding("0", 0)),
229+
new ButtonBinding(14, true, -1, true, true, new HidSequenceBinding("1", 0)),
230+
new ButtonBinding(15, true, -1, true, true, new HidSequenceBinding("2", 0)),
231+
new ButtonBinding(16, true, -1, true, true, new HidSequenceBinding("3", 0)),
232+
new ButtonBinding(17, true, -1, true, true, new HidSequenceBinding("4", 0)),
233+
new ButtonBinding(31, true, -1, true, true, new HidSequenceBinding("5", 0)),
234+
new ButtonBinding(30, true, -1, true, true, new HidSequenceBinding("6", 0)),
235+
new ButtonBinding(11, true, -1, true, true, new HidSequenceBinding("7", 0)),
236+
new ButtonBinding(33, true, -1, true, true, new HidSequenceBinding("8", 0)),
237+
new ButtonBinding(34, true, -1, true, true, new HidSequenceBinding("9", 0))
238238
};
239239

240-
var configuration = new ConfigurationDefinition(buttons, Array.Empty<EncoderBinding>(), DebugMode: false, NeoPixelPin: 34);
240+
var configuration = new ConfigurationDefinition(buttons, Array.Empty<EncoderBinding>(), DebugMode: false, NeoPixelPin: -1);
241241

242242
var expected = ReadExpected("generate_source_10_buttons.c");
243243

Keypad.Flasher.Server.Tests/ExpectedOutputs/ConfigurationGenerator/generate_source_10_buttons.c

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,150 +3,150 @@
33

44
const button_binding_t button_bindings[] = {
55
{
6-
.pin = 7,
6+
.pin = 32,
77
.active_low = true,
8-
.led_index = 0,
9-
.bootloader_on_boot = false,
10-
.bootloader_chord_member = false,
8+
.led_index = -1,
9+
.bootloader_on_boot = true,
10+
.bootloader_chord_member = true,
1111
.function = {
1212
.type = HID_BINDING_SEQUENCE,
1313
.function.sequence = {
14-
.sequence = {'a'},
14+
.sequence = {'0'},
1515
.length = 1,
1616
.delay = 0
1717
}
1818
}
1919
},
2020
{
21-
.pin = 8,
21+
.pin = 14,
2222
.active_low = true,
23-
.led_index = 1,
24-
.bootloader_on_boot = false,
25-
.bootloader_chord_member = false,
23+
.led_index = -1,
24+
.bootloader_on_boot = true,
25+
.bootloader_chord_member = true,
2626
.function = {
2727
.type = HID_BINDING_SEQUENCE,
2828
.function.sequence = {
29-
.sequence = {'b'},
29+
.sequence = {'1'},
3030
.length = 1,
3131
.delay = 0
3232
}
3333
}
3434
},
3535
{
36-
.pin = 9,
36+
.pin = 15,
3737
.active_low = true,
38-
.led_index = 2,
39-
.bootloader_on_boot = false,
40-
.bootloader_chord_member = false,
38+
.led_index = -1,
39+
.bootloader_on_boot = true,
40+
.bootloader_chord_member = true,
4141
.function = {
4242
.type = HID_BINDING_SEQUENCE,
4343
.function.sequence = {
44-
.sequence = {'c'},
44+
.sequence = {'2'},
4545
.length = 1,
4646
.delay = 0
4747
}
4848
}
4949
},
5050
{
51-
.pin = 10,
51+
.pin = 16,
5252
.active_low = true,
53-
.led_index = 3,
54-
.bootloader_on_boot = false,
55-
.bootloader_chord_member = false,
53+
.led_index = -1,
54+
.bootloader_on_boot = true,
55+
.bootloader_chord_member = true,
5656
.function = {
5757
.type = HID_BINDING_SEQUENCE,
5858
.function.sequence = {
59-
.sequence = {'d'},
59+
.sequence = {'3'},
6060
.length = 1,
6161
.delay = 0
6262
}
6363
}
6464
},
6565
{
66-
.pin = 11,
66+
.pin = 17,
6767
.active_low = true,
68-
.led_index = 4,
69-
.bootloader_on_boot = false,
70-
.bootloader_chord_member = false,
68+
.led_index = -1,
69+
.bootloader_on_boot = true,
70+
.bootloader_chord_member = true,
7171
.function = {
7272
.type = HID_BINDING_SEQUENCE,
7373
.function.sequence = {
74-
.sequence = {'e'},
74+
.sequence = {'4'},
7575
.length = 1,
7676
.delay = 0
7777
}
7878
}
7979
},
8080
{
81-
.pin = 12,
81+
.pin = 31,
8282
.active_low = true,
83-
.led_index = 5,
84-
.bootloader_on_boot = false,
85-
.bootloader_chord_member = false,
83+
.led_index = -1,
84+
.bootloader_on_boot = true,
85+
.bootloader_chord_member = true,
8686
.function = {
8787
.type = HID_BINDING_SEQUENCE,
8888
.function.sequence = {
89-
.sequence = {'f'},
89+
.sequence = {'5'},
9090
.length = 1,
9191
.delay = 0
9292
}
9393
}
9494
},
9595
{
96-
.pin = 13,
96+
.pin = 30,
9797
.active_low = true,
98-
.led_index = 6,
99-
.bootloader_on_boot = false,
100-
.bootloader_chord_member = false,
98+
.led_index = -1,
99+
.bootloader_on_boot = true,
100+
.bootloader_chord_member = true,
101101
.function = {
102102
.type = HID_BINDING_SEQUENCE,
103103
.function.sequence = {
104-
.sequence = {'g'},
104+
.sequence = {'6'},
105105
.length = 1,
106106
.delay = 0
107107
}
108108
}
109109
},
110110
{
111-
.pin = 14,
111+
.pin = 11,
112112
.active_low = true,
113-
.led_index = 7,
114-
.bootloader_on_boot = false,
115-
.bootloader_chord_member = false,
113+
.led_index = -1,
114+
.bootloader_on_boot = true,
115+
.bootloader_chord_member = true,
116116
.function = {
117117
.type = HID_BINDING_SEQUENCE,
118118
.function.sequence = {
119-
.sequence = {'h'},
119+
.sequence = {'7'},
120120
.length = 1,
121121
.delay = 0
122122
}
123123
}
124124
},
125125
{
126-
.pin = 15,
126+
.pin = 33,
127127
.active_low = true,
128-
.led_index = 8,
129-
.bootloader_on_boot = false,
130-
.bootloader_chord_member = false,
128+
.led_index = -1,
129+
.bootloader_on_boot = true,
130+
.bootloader_chord_member = true,
131131
.function = {
132132
.type = HID_BINDING_SEQUENCE,
133133
.function.sequence = {
134-
.sequence = {'i'},
134+
.sequence = {'8'},
135135
.length = 1,
136136
.delay = 0
137137
}
138138
}
139139
},
140140
{
141-
.pin = 16,
141+
.pin = 34,
142142
.active_low = true,
143-
.led_index = 9,
144-
.bootloader_on_boot = false,
145-
.bootloader_chord_member = false,
143+
.led_index = -1,
144+
.bootloader_on_boot = true,
145+
.bootloader_chord_member = true,
146146
.function = {
147147
.type = HID_BINDING_SEQUENCE,
148148
.function.sequence = {
149-
.sequence = {'j'},
149+
.sequence = {'9'},
150150
.length = 1,
151151
.delay = 0
152152
}

Keypad.Flasher.Server/Controllers/FlasherController.cs

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,80 @@ public record Firmware(byte[] FileBytes);
131131

132132
internal static ConfigurationDefinition CreateDefaultConfiguration()
133133
{
134-
var buttons = new List<ButtonBinding>
135-
{
136-
new ButtonBinding(32, true, 0, true, true, new HidSequenceBinding("1", 0)),
137-
new ButtonBinding(14, true, 1, true, true, new HidSequenceBinding("2", 0))
134+
var buttons = new List<ButtonBinding>{
135+
new ButtonBinding(
136+
Pin: 32,
137+
ActiveLow: true,
138+
LedIndex: -1,
139+
BootloaderOnBoot: true,
140+
BootloaderChordMember: true,
141+
Function: new HidSequenceBinding("0", 0)),
142+
new ButtonBinding(
143+
Pin: 14,
144+
ActiveLow: true,
145+
LedIndex: -1,
146+
BootloaderOnBoot: true,
147+
BootloaderChordMember: true,
148+
Function: new HidSequenceBinding("1", 0)),
149+
new ButtonBinding(
150+
Pin: 15,
151+
ActiveLow: true,
152+
LedIndex: -1,
153+
BootloaderOnBoot: true,
154+
BootloaderChordMember: true,
155+
Function: new HidSequenceBinding("2", 0)),
156+
new ButtonBinding(
157+
Pin: 16,
158+
ActiveLow: true,
159+
LedIndex: -1,
160+
BootloaderOnBoot: true,
161+
BootloaderChordMember: true,
162+
Function: new HidSequenceBinding("3", 0)),
163+
new ButtonBinding(
164+
Pin: 17,
165+
ActiveLow: true,
166+
LedIndex: -1,
167+
BootloaderOnBoot: true,
168+
BootloaderChordMember: true,
169+
Function: new HidSequenceBinding("4", 0)),
170+
new ButtonBinding(
171+
Pin: 31,
172+
ActiveLow: true,
173+
LedIndex: -1,
174+
BootloaderOnBoot: true,
175+
BootloaderChordMember: true,
176+
Function: new HidSequenceBinding("5", 0)),
177+
new ButtonBinding(
178+
Pin: 30,
179+
ActiveLow: true,
180+
LedIndex: -1,
181+
BootloaderOnBoot: true,
182+
BootloaderChordMember: true,
183+
Function: new HidSequenceBinding("6", 0)),
184+
new ButtonBinding(
185+
Pin: 11,
186+
ActiveLow: true,
187+
LedIndex: -1,
188+
BootloaderOnBoot: true,
189+
BootloaderChordMember: true,
190+
Function: new HidSequenceBinding("7", 0)),
191+
new ButtonBinding(
192+
Pin: 33,
193+
ActiveLow: true,
194+
LedIndex: -1,
195+
BootloaderOnBoot: true,
196+
BootloaderChordMember: true,
197+
Function: new HidSequenceBinding("8", 0)),
198+
new ButtonBinding(
199+
Pin: 34,
200+
ActiveLow: true,
201+
LedIndex: -1,
202+
BootloaderOnBoot: true,
203+
BootloaderChordMember: true,
204+
Function: new HidSequenceBinding("9", 0)),
138205
};
139206

140-
return new ConfigurationDefinition(buttons, Array.Empty<EncoderBinding>(), DebugMode: false, NeoPixelPin: 34);
207+
return new ConfigurationDefinition(buttons, Array.Empty<EncoderBinding>(), DebugMode: false, NeoPixelPin: -1);
141208
}
142209

143210
private bool IsDebugRequested()

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ If you find and successfully test a new compatible device not in this list, plea
7979
They all have USB-C connectors unless otherwise noted:
8080

8181
- [2 Keys](https://www.aliexpress.com/item/1005004970126333.html?spm=a2g0o.order_detail.order_detail_item.3.3c7af19cNrdJJB)
82-
- Note: Uses non-standard LEDs that are not compatible with this project's NeoPixel support so LED functionality will not work
82+
- Uses non-standard LEDs that are not compatible with this project's NeoPixel support so LED functionality will not work
8383
- [3 Keys 1 Knob](https://www.aliexpress.com/item/1005006627901462.html?spm=a2g0o.order_detail.order_detail_item.3.295bf19c3IDC8m)
8484
- [4 Keys](https://www.aliexpress.com/item/1005008020501723.html?spm=a2g0o.order_detail.order_detail_item.3.7d51f19cZTzoOY)
8585
- [6 Keys 1 Knob](https://www.aliexpress.com/item/1005009812219099.html?spm=a2g0o.order_detail.order_detail_item.3.6afff19cXlayc4)
8686
- [10 Keys](https://www.aliexpress.com/item/1005005509140217.html?spm=a2g0o.order_detail.order_detail_item.7.3c7af19cNrdJJB)
87-
- Note: Uses a Micro-USB connector, will need a Micro-USB to USB-C adapter and USB-C cable to use the bootloader adapter / contraption above
87+
- Uses a Micro-USB connector, will need a Micro-USB to USB-C adapter and USB-C cable to use the bootloader adapter / contraption above
88+
- Uses fixed blue LEDs that are always on and cannot be controlled by the firmware
8889

8990
## Unsupported devices
9091

0 commit comments

Comments
 (0)