veroxzik / arduino-psx-controller

Use an Arduino (ATmega32U4-based) board as a Playstation 1 / 2 Controller.
MIT License
20 stars 7 forks source link

Porting the library #2

Open eduardokenj opened 2 years ago

eduardokenj commented 2 years ago

If possible port the library for another AVR microcontroller (ex: 328p)?

veroxzik commented 2 years ago

Shouldn't be too much of an issue. I'll see if I can get to it this weekend. I don't think I have anything other than a 328p to test though.

veroxzik commented 2 years ago

@eduardokenj Can you test this branch and let me know if it works? https://github.com/veroxzik/arduino-psx-controller/tree/feat/328p

eduardokenj commented 2 years ago

Sorry for the delay, but the lib not work in 328p microcontrollers. I got that error on my IDE, when i compile on 328p 8MHz (aka Pro Mini): C:\Users\eduar\Documents\Arduino\libraries\arduino-psx-controller-feat-328p\src\arduinopsx.cpp: In member function 'void PSX::init(int, bool, bool)': C:\Users\eduar\Documents\Arduino\libraries\arduino-psx-controller-feat-328p\src\arduino_psx.cpp:36:19: error: 'SPR2' was not declared in this scope SPCR |= (1 << SPR2) | (1 << SPR1); // Fosc/32 @8MHz==250KHz ^~~~ C:\Users\eduar\Documents\Arduino\libraries\arduino-psx-controller-feat-328p\src\arduino_psx.cpp:36:19: note: suggested alternative: 'SPR0' SPCR |= (1 << SPR2) | (1 << SPR1); // Fosc/32 @8MHz==250KHz ^~~~ SPR0 image

And when compile the code okay on 328p 16MHz, i tested in my arduino pro mini and uno, in both situations PS1 and PS2 not work.

djsedaw commented 1 month ago

Hi I'd like to add support for the joysticks if that's ok?

veroxzik commented 1 month ago

Hi I'd like to add support for the joysticks if that's ok?

@djsedaw Go for it.

djsedaw commented 1 month ago

Hi, all going well, one question, do you think the micro has enough pins for 4 d-pad buttons, 4 on the right, start and select, L1 and L2, R1 and R2, L3 and R3 which are the buttons on the 2 joysticks, plus the 4 pins for the spi?

djsedaw commented 1 month ago

I was looking at the raspberry pi Pico board which has enough pins but only 3 analog pins, which means I would need a ADS1115 to increase the analog pins

djsedaw commented 1 month ago

Sorry 5 pins for the spi