lthiery / SPI-Py

Hardware SPI as a C Extension for Python
289 stars 150 forks source link

spi.transfert type error #23

Open hawaii-do opened 5 years ago

hawaii-do commented 5 years ago

the command spi.transfer((2,15)) return the error TypeError: function takes exactly 2 arguments (1 given)

This command used to work before recent commit.

Highlife93 commented 5 years ago

same problem here. No working with MFRC522 because only one argument is given.

lthiery commented 5 years ago

Try removing one set of paranthesis perhaps?

On Thu, Feb 21, 2019 at 6:22 AM Highlife93 notifications@github.com wrote:

same problem here. No working with MFRC522 because only one argument is given.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lthiery/SPI-Py/issues/23#issuecomment-466017117, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiD8Cp7Uwnogjq_D12Bu0r-omaXP48oks5vPqubgaJpZM4bHKYh .

saphirblanc commented 5 years ago

@lthiery hi! since the latest commits, the library https://github.com/mxgxw/MFRC522-python is not working anymore as the tag is not even detected :/ (tried with multiple raspberry pi 3, multiple cables, RFID readers...)

steaward commented 5 years ago

@saphirblanc that repo is no longer being maintained. It's best to use pi-rc522

gasseritsolutions commented 5 years ago

Same problem: TypeError: function takes exactly 2 arguments (1 given)

How can I get the previous version it worked perfect with this one?

lthiery commented 5 years ago

Hi all, I merged in a PR that @naleefer made, since at inspection, it looks like some great work.

I didn't notice the API change, but I'd guess that removing one set of parenthesis might resolve it? That seems like a general style improvement to me if that's the case.

I apologize for not having more time to maintain this project; I'm trying to add collaborators as they bring in PRs. As such, I've invited @naleefer as a collaborator so hopefully that improves support from this project.

All the best, Louis

naleefer commented 5 years ago

Hi all,

To follow up on this, there has been an API change, but it is rather minor. Previously the module maintained the spi device properties behind the scenes in global variables, which prevented the module from using both chip select pins in the same process. On top of this, there were some memory handling issues that prevented repeatedly using the spi.openSPI(...) and spi.closeSPI() to get around this.

The changes are documented in the updated README.md, along with examples of the new usage. spi.openSPI(...) returns a handle that should be preserved for later calls to spi.transfer(..) and spi.closeSPI().

For the MFRC522 case, I also forked that repository and made an update to reflect the new API for this library: MFRC522.

Best, N

jeffersonkr commented 5 years ago

if you guys dont wanna redo all work with your code just rollback to this commit, 8cce26b9ee6e69eb041e9d5665944b88688fca68

simonneutert commented 5 years ago

@saphirblanc you. saved. my. day. ❤️

chibunna commented 5 years ago

@saphirblanc you. saved. my. day. ❤️

Have you been able to resolve this issue? and if so could you kindly explain how you did it? I'm still struggling with getting the RFID to read/write the tags

captainreed commented 3 years ago

This problem has been solved on this fork of the repo: https://github.com/mxgxw/MFRC522-python

nbx3 commented 3 years ago

This problem has been solved on this fork of the repo: https://github.com/mxgxw/MFRC522-python

Either you linked to the wrong repo or the fix has been rolled back because i still get this error