recalbox / mk_arcade_joystick_rpi

Raspberry PI kernel module for arcade joystick on GPIO and MCP23017
GNU General Public License v2.0
200 stars 120 forks source link

Added /dev/i2c-0 support + i2c0, i2c1 parameters #60

Closed mcspaeth closed 1 year ago

mcspaeth commented 6 years ago

@digitalLumberjack For devices with the RGB overlay using the GPIO, the pins for /dev/i2c-1 get used as h/vsync outputs.

This adds module paramaters i2c0=

and i2c1=
to explicitly add MCP23017 controllers on the different i2c busses. To keep compatibility with older versions, i2c addresses in the map= parameter get added to /dev/i2c-1.

I've only tested this with i2c, but the changes shouldn't break the GPIO part. The code could be cleaned up a bit, but I left the io memory pointers as hard #defines for now. It probably wouldn't hurt to add a parameter to set PERI_BASE (or include code to autodetect it) for backwards compatiblity, but this is a start. The duplicated code in the 2 pad_config functions is a little ugly too.

Feedback welcomed -- haven't worked on a kernel driver in >15 years. :)

vince87 commented 5 years ago

@mcspaeth your work is great!, but have you tried the daphne emulator? there seems to be errors in reading the keys! (any key i press, produce the screenshot and pause the game). With all the other emulators, there are no problem!

mcspaeth commented 5 years ago

I haven't tried the recalbox daphne, but the last time I looked at the base emulator (several years ago, adding support for a hardware scoreboard over USB), the I/O routines weren't pi-specific.

Daphne is really hacky garbage code from 15 years ago and should be completely rewritten anyway, especially now that it's abandonware.

interlude86 commented 3 years ago

@mcspaeth Can you update the code so it works with the updated kernel? I am having trouble building. I need your fork for my RGB-Pi to work. There was just 1 error and 2 warnings I think.

@Pinuct has his fork updated, and I can build it, but it lacks the i2c parameters :(

mcspaeth commented 3 years ago

Post the error/warnings -- maybe it's something easy. I haven't actually touched any of my Pi stuff in years.

On Sun, Sep 13, 2020 at 7:59 PM interlude86 notifications@github.com wrote:

@mcspaeth https://github.com/mcspaeth Can you update the code so it works with the updated kernel? I am having trouble building. I need your fork for my RGB-Pi to work. There was just 1 error and 2 warnings I think.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/recalbox/mk_arcade_joystick_rpi/pull/60#issuecomment-691744688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMEGOIHOEIHJDHFHLGFWWLSFVMFBANCNFSM4EKS7FGQ .

-- Mark Spaeth mspaeth@gmail.com