Currently, I have a few buttons connected via an I2C shift register, hooked up to an MCU. Super simple, so not sure if it needs a schematic, but I can share one (and any other details) if needed. I'm flexible with what MCU I can use, suggestions welcome.
The MCU checks the button state every n ms. The problem is that if the user presses the push button too quickly, between the MCU loop function, the button press is not detected. One temporary solution is to increase the loop speed, but this isn't super energy efficient, and only diminishes the problem. Even with a faster loop, it's still possible to miss the pulse from the button press if pressed quickly enough, since the MCU has it's speed limitations, especially if it's doing some intense operation then the loop delay is increased unpredictably.
Thinking out loud, possibly rambling: I figured maybe I'd use a latch. I suspect there is a way of getting a good balance between hardware and firmware without over-complicating either. It seems to me that if I want to use a push button for a simple toggle switch, it's simpler to use a latch rather than a flipflop. If a flipflop is the best option, does it matter if D or JK? Or positive/native edge? Or, is there a way to avoid using a flipflop altogether and let the MCU do the work?
Edit: Seems the toggle can also be done with a timer IC.
Edit 2: Can't believe I forgot to mention this, but I'm using the PCF8574.