Closed thejpster closed 5 years ago
Or, pull clock line low just during scan-line setup period (which is a very high priority interrupt). We should be OK to process signals during the scan-line rendering if we're quick about it.
Interrupt latency is 12 cycles in and 10 cycles out. Plus a bit-banded GPIO pin read, a global variable write (the bit) and a global variable read/increment/write (the bit index). That's about 30 cycles, or 7.5 screen pixels. At 10 kHz we have to do that every 100us, so at most once every 4 scan lines (26.4us). At 16.7 kHz that's once every 60 us, or every other scan line.
Actually that's a thought - can we just poll the keyboard in the horizontal blanking interval?
Or, pull clock line low just during scan-line setup period (which is a very high priority interrupt). We should be OK to process signals during the scan-line rendering if we're quick about it.
Pulling clock low cancels any existing message, so this won't work. Plus V-blank isn't long enough - a 10 bit message at 10 kHz (minimum) is 1ms and the blanking interval is only ~790us. We need 38 clear scan-lines and the blanking interval is only 28 scan-lines.
Used an external chip.
Pull clock line low to belay keyboard output. Release during v-blank when we can process messages.