makapuf / bitbox

The bitbox console (example, firmwares, doc)
http://bitboxconsole.blogspot.com
88 stars 13 forks source link

support gravis/snes controller #72

Open makapuf opened 7 years ago

makapuf commented 7 years ago

the support of those controllers could be made using a library,

(edit:removed serial related)

pulkomandy commented 7 years ago

Example for Gravis protocol implementation: https://github.com/pulkomandy/stm32f3/blob/master/src/main.c#L80

makapuf commented 7 years ago

I see you're using interrupts, which I'd like to avoid , so would it be possible to poll on the GPIO ? What is the data rate ? Do you think we could use SPI to deserialize data ?

makapuf commented 7 years ago

also, I hestitate to use as a makefile variable -DGRAVIS , an explicit lib call or a dynamic (but how would we use different hardware ?)

pulkomandy commented 7 years ago

I think you can look at the previous commit for a polling version. My notes about the protocol: http://pulkomandy.tk/_/_Electronique/_Gravis%20Interface%20Protocol

The data rate is about 20 to 25KHz on my controllers. SPI is possible except there is a continuous clock stream and no "chip select" so it won't detect the start and end of frames. You will need to look for the known start pattern (5 consecutive 1 bits) to resynchronize with the bitstream coming from SPI. Once synchronized, the stream has frames of 24bits so you can decode it with a fixed shift.

pulkomandy commented 7 years ago

(and for the SNES: IIRC, it is up to us to generate the clock. This means we can be SPI master, whereas for Gravis, the controller generates the clock and we are SPI slave).

makapuf commented 7 years ago

Yes the bitbox1 used snes, it's delightfully easy compared to usb https://github.com/makapuf/bitbox/blob/rev1/src/lib/gamepad.c

Le 15 nov. 2016 14:17, "Adrien Destugues" notifications@github.com a écrit :

(and for the SNES: IIRC, it is up to us to generate the clock. This means we can be SPI master, whereas for Gravis, the controller generates the clock and we are SPI slave).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/makapuf/bitbox/issues/72#issuecomment-260638380, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlREQz_dZj9a4S_oYtTZ9SjmA627Shfks5q-bDZgaJpZM4KNdIV .