Closed mutantbob closed 2 years ago
Sorry for the trouble. Nothing seems wrong with your routines. The one thing I don't explicitly see in these snippets is calls to set_enable(true)
. That call must be happening for GPT1, or it wouldn't work. Is a similar call also happening for GPT2?
As a small sanity check, I
Your initial instinct was correct. I was missing gpt2.set_enable(true)
.
I wonder if this means that there should be separate types for the object before and after set_enable
. If there are multiple methods that only make sense to call after set_enable, this might be worth investigating (although the API change would be inconvenient to all downstream projects).
This is precisely the use case for a type state, but at some point the type states become burdensome to manage. It's a tradeoff as always.
I am using gpt1 to blink an LED. I want to use gpt2 to toggle the virtual shift modifier on my USB keyboard experiment. I have the following code (derived from https://github.com/imxrt-rs/imxrt-usbd/blob/master/examples/teensy4/src/support.rs)
and I use it later
but it appears that only gpt1 is usable with the idiom (also from support.rs)
If I use gpt2, I never observe
status.is_set()
being true.I flipped things so that gpt2 controls the LED and gpt1 controls the virtual shift key, and then the shift key flips like I want, but the LED never toggles, so I am reasonably confident the problem is with gpt2 (probably my configuration of gpt2).
What am I overlooking? What should I change to make gpt2 work the way I think it should?