lucasnicolau / nespad

Automatically exported from code.google.com/p/nespad
0 stars 0 forks source link

Default pin numbers does not work #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If I start the SNESpad object with:

    SNESpad nintendo = SNESpad();

it'll not work (the returned number is always 0b1111111111111111).

But if I change the code to:

    SNESpad nintendo = SNESpad(2, 3, 4);

and change some parameters of some delayMicroseconds in the SNESpad.cpp, it'll 
work correctly. It occurs on version SNESpad_1.2.zip.

I think the actual implementation have a lot of overhead (for example, 
strobe(), shiftin() functions etc.) and probably we can create a class with a 
just-one flat function (+ the constructor) that does the job.

Based on http://www.gamesx.com/controldata/snesdat.htm description of the SNES 
controller I've created a function called getSNESbuttons that does the work 
right (please see the times in this page so you can see that your 
implementation have some timing errors).
The sketch attached uses my function as an example. If we change this function 
to be a class, probably we should change the times on delayMicroseconds because 
of the overhead in calling an object's method.

Original issue reported on code.google.com by alvarojusten on 8 Nov 2010 at 4:31

Attachments:

GoogleCodeExporter commented 8 years ago
If I have access to this repository I can maintain the SNESpad library.

Original comment by alvarojusten on 8 Nov 2010 at 4:32

GoogleCodeExporter commented 8 years ago
The code that you posed is all new and has a different interface.  It seems 
like it would make more sense to just create a different project for your 
library, than to wipe this one out and start it again.  The issue with using 
the constructor without pin numbers is the same as issue #2 - I think I'm going 
to just change the documentation to say that you need to specify the pin 
numbers and call it fixed.  :)  This timing problem that you have is something 
else, though.  It's strange that it's worked for others using the timing that's 
in the library - I used an actual nintendo game pad (don't have it anymore).. 
shouldn't matter I would think but I wonder if that's the difference between 
your setup and others who aren't having a timing issue?

Original comment by rah...@gmail.com on 8 Nov 2010 at 6:06

GoogleCodeExporter commented 8 years ago
I've uploaded a new version 1.3, that gets rid of the default constructor.  If 
you end up going back to this library instead of your own and find that the 
timing is off, let us know - the library has worked for others so I'm 
interested to know why the timing didn't work for you.

Original comment by rah...@gmail.com on 13 Nov 2010 at 2:53