CrazyRedMachine / PN5180-cardio

PN5180 eAmusement wavepass USB HID card reader (cardio)
GNU General Public License v3.0
61 stars 12 forks source link

Hello,This is a SpiceAPI version of PN532 reader,runs on stm32duino with a pcb design by myself #6

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello,This is a SpiceAPI version of PN532 reader,runs on stm32duino with a pcb design by myself

With this code and a little modify ,it can be run on regular Arduino platform
may help somebody who wants to use SpiceAPI with PN532 on a Arduino Platform with no Hardware direct USB-Device like UNO or Nano

CrazyRedMachine commented 1 year ago

hi, thanks for the pull request! and very nice project, the custom pcb is awesome

I feel like this drifts more and more away from the original project (lately I even removed spiceapi support from the main branch to put it in a separate one cause a lot of people were confused about it).

If you don't mind me merging into its own separate branch I'd gladly accept the PR, however I feel like it being in a separate branch would hinder visibility... probably a better idea to advertise your fork in the main branch readme, what do you think?

ghost commented 1 year ago

Thanks for responding to my Pull Request.

In fact, this is the first time I initiate a Pull Request, and my idea before was to open a new branch and throw these codes into it. But I don't seem to want to ask to submit to a new branch, so I submitted a pull request to the spiceapi branch.

I wanted to add support for koanmi games on my sgea-compatible card reader (intentionally typed the wrong name to avoid trademark disputes), but my pcb is pn532, and the stm32duino platform package lacks PluggableUSB, resulting in cardio The version hid part cannot be compiled, so the combination of pn532+spiceapi is used. But I found that no one has made pn532 and spiceapi version at the same time, so it took a day, I combined the spiceapi version of pn5180 with the cardio version of pn532, and it worked successfully on my pcb.

In fact, there are quite a lot of problems, (probably only stm32duino has these problems)

  1. If you use the spiceapi library directly, since the internal memory is opened in the form of new, it will cause stm32 to directly run RuntimeError and cannot run normally.
  2. Modify 'new' to directly open up memory of a specified size, and it can work normally. But I don't know why, if the card is not swiped in time after power on, the whole program will run extremely slowly, or even freeze. And modifying the library file I feel is a very bad solution.

Based on the above reasons and the lack of a keypad on my pcb, there is no need to encrypt passwords and transmit other special json communications, and the previous solution will crash and need to modify the library file, I used a simple way to directly output the specified format content to the Spicetools submitted the card swiping report, so far I have successfully completed the support for the koanmi game on my pcb

Although a lot of content is unique to my pcb, such as an oled, and ws2812led lights, there are platform differences and no encryption and keypad support. As the solution of pn532+spiceapi that no one has shared yet, I think my code may help other boards who want to use pn532 and boards without USB-Device capabilities, such as ArduinoNano, ArduinoUNO, etc. to make this read carder.

(I think deleting oled and lights from the code should be much simpler than completing the entire program theme of pn532+spiceapi from scratch)

So I hope that it can be added to your repositories as a new branch, or that it doesn't even need to be mentioned in the home page, and it is enough.

(The English text is from the original Chinese text translated by Google, sorry for my poor English)

ghost commented 1 year ago

At the same time, there are some chips, such as AtTiny85, ATtiny88, and even atmega328p. Although they do not have USB-Device capability, there is a way to make them use ordinary IO to simulate USBHID devices. I am considering porting cardio to them. If it is feasible, use the cardio communication solution to change from Leonardo/Pro Micro to Attiny88. According to the price of the development board on the Chinese shopping website, the cost of a single development board will become about a quarter of the original (32u4 based 32 CNY, tiny88 based 8CNY)

But using the method of simulating USB, the related function of USB simulation must run once every 50 milliseconds, otherwise the computer will report an error. Considering that the PN5xxx card reading takes a long time and may cause blockage, and the simulated USB can only run at USB Low Speed, I don’t I can guarantee the success of this idea.

ghost commented 1 year ago

hi, thanks for the pull request! and very nice project, the custom pcb is awesome

I feel like this drifts more and more away from the original project (lately I even removed spiceapi support from the main branch to put it in a separate one cause a lot of people were confused about it).

If you don't mind me merging into its own separate branch I'd gladly accept the PR, however I feel like it being in a separate branch would hinder visibility... probably a better idea to advertise your fork in the main branch readme, what do you think?

hi?could you read my new reply?thanks

CrazyRedMachine commented 1 year ago

oh sorry about the delay.. supporting other chips like attiny or 328p is not something i'm interested in due to performance, and merging such pr exposes me to having to provide technical support for it which I don't want to.

i think your code is great but the oled screen etc is also out of scope for this project and I feel like it deserves its own repo, which is why I offer to advertise it in my readme or merge it in a separate branch (i don't think pn532+spiceapi by itself is a requested feature, people generally use leonardo to get hid support)