Drew Fisher [Mon, 21 Jun 2010 00:49:36 +0000 (17:49 -0700)]
Functional code for SNES port 2.
The assembly routine doesn't work. No idea why; I'll rework it later.
In the meantime, it's a bad idea to poll the SNES in an interrupt
routine, so the interrupt now sets readyToPollSnes every 1/60th of a
second instead, and the actual polling code has been placed in
getButtons().
This will likely all need a rework when I move to support polling two
controllers simultaneously.
Drew Fisher [Wed, 24 Feb 2010 18:38:40 +0000 (13:38 -0500)]
Correct interrupt usage.
This patch corrects usage of usbDeviceDisconnect() and usbDeviceConnect().
In addition, we allow SNES interrupts to be further interrupted, so the
USB interrupts always get serviced. To prevent stack overflow, we enforce
completion of one SNES poll before the next one can be triggered. Rather than
crash the chip, we take a (tiny) hit in latency.
Drew Fisher [Wed, 24 Feb 2010 17:37:43 +0000 (12:37 -0500)]
Fix a bug where the USB interrupt doesn't make it to the interrupt vector table.
Somehow, either due to version differences between v-usb or
avr-gcc/avr-libc, SIG_INTERRUPT0 was not getting linked to the interrupt
vector table where it belonged. Naming the routine INT0_vect seems to
fix the problem.
Drew Fisher [Wed, 24 Feb 2010 02:19:52 +0000 (21:19 -0500)]
Setup pins, setup timer, shrink code size (static declarations), test
This commit sets up all the appropriate I/O for the AVR as well as
declaring some functions static so GCC will inline them. In addition,
it provides a simple test function to see if the USB HID reports are
being sent correctly - every 60 reports, it adds one to the report that
it returns, which should result in a binary "counting" appearance in a
gamepad state viewer.