thejpster / monotron

A simple 8-bit home computer style application for the TI Tiva-C Launchpad
Apache License 2.0
191 stars 9 forks source link

Finish keyboard driver #1

Closed thejpster closed 5 years ago

thejpster commented 6 years ago

Pull clock line low to belay keyboard output. Release during v-blank when we can process messages.

thejpster commented 6 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?

thejpster commented 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.

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.

thejpster commented 5 years ago

Used an external chip.