solderparty / bbq10kbd_i2c_sw

MIT License
46 stars 7 forks source link

Problem with L1, L2, Joystick, R1 and R2 buttons with alt or when NUMLOCK is on #3

Open veryalien opened 3 years ago

veryalien commented 3 years ago

Discussed in https://github.com/solderparty/bbq10kbd_i2c_sw/discussions/2

Originally posted by **veryalien** September 5, 2021 There seems to be a problem that all the buttons under the feathering keyboard screen don't return anything when alt is pressed or NUMLOCK (alt+left-shift) is on. I'm busily modifying pye_lcd and simpleTerminal to work as a self-contained editor with circuitpython on a keyboard featherwing. I noticed that I couldn't use alt to modify the up, down, left and right joystick buttons. You can use CFG_REPORT_MODS to get reports of all the individual modifiers being pressed/released left-shift, right-shift, sym and alt. You can press and hold a modifier for example left-shift and press L1, this returns the L1 code which means you can use the modifiers left-shift, right-shift and sym held down together with the buttons as different soft keys/buttons. But you can't press for example alt and L1 and get a key returned. Also, when NUMLOCK is on, all those buttons go dead until you get out of NUMLOCK. Which is a little bit confusing, because you can't easily see why the buttons don't work any more. As far as I can see the problem is in the firmware. I could be wrong but, without actually debugging the featherwing firmware, it looks like this to me. There are no symbol entries for the L1, L2, Joystick, R1 and R2 buttons in the table, only for the bbq10 keboard keys itself, this code from keyboard.c will incorrectly change chr to 0 if alt is pressed at the same time as a button: ``` default: { if (reg_is_bit_set(REG_ID_CFG, CFG_USE_MODS)) { const bool shift = (self.mods[MOD_SHL] || self.mods[MOD_SHR]) | self.capslock; const bool alt = self.mods[MOD_ALT] | self.numlock; if (alt) { chr = p_entry->symb; } else if (!shift && (chr >= 'A' && chr <= 'Z')) { chr = (chr + ' '); } } break; } ``` I'm not sure if my logic is right, but something like that must be going wrong when alt and a button are pressed at the same time. I really don't want to turn off CFG_USE_MODS and do all the keyboard modifier handling myself in my editor. I've used the left and right shift modifiers instead of alt. But,whatever the real problem is, it's still a little bit annoying,
SapientHetero commented 2 years ago

The problem is probably in the keyboard controller chip (SAMD20) firmware. The code is called "BB Q10 Keyboard-to-I2C Software" (https://github.com/solderparty/bbq10kbd_i2c_sw) and there is an interface that allows the chip to be reprogrammed, if you can use a soldering iron. You have to solder wires to the KBD IC SWD pads on the back of the board and use a hardware debugger. I haven't done it (yet) but it appears to be possible.

dumblob commented 2 years ago

Sounds promising - thanks @SapientHetero for the info.

I'm now looking for ordering the Solderparty Featherwing keyboard (https://www.adafruit.com/product/4818 ) but can't seem to find it anywhere. I just hope it wasn't discontinued.

SapientHetero commented 2 years ago

I got an email from Digi-Key, who resold them for Adafruit, saying that it's obsolete. The hardware is open source, so it's possible to build your own. I have no idea whether solderparty plans to make more batches in the future. They've made two batches so far.

asmagill commented 2 years ago

Finally getting around to using this and came across this issue issue -- FWIW for those of you looking to order one of these, I originally found it at at Tindie (https://www.tindie.com/products/arturo182/keyboard-featherwing-qwerty-keyboard-26-lcd/?pt=ac_prod_search), but it's currently out of stock there; Pimoroni seems to have some in stock (at least at the time of my posting this): https://shop.pimoroni.com/products/keyboard-featherwing-qwerty-keyboard-2-6-lcd?variant=32192379256915

SapientHetero commented 2 years ago

Arturo replied to my query about the product's future on Feb 2, 2022:

"Hi, Adafruit didn't restock after they ran out recently. There are still over 100pcs available at Pimoroni: https://shop.pimoroni.com/products/keyboard-featherwing-qwerty-keyboard-2-6-lcd Currently there's no plan to do another production run because of the chip shortages, but I'm not ruling it out in 6-12 months if things get better on that front."