Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the basic structure to work with PN532 and did some refactoring #6

Merged
merged 3 commits into from
Mar 19, 2022

Conversation

UliPrantz
Copy link
Contributor

I added the basic file structure and files to work with the PN532. Currently only reading passiv targets is supported but adding more commands is just simple porting from already existent PN532 implementations into the pn532.dart file. All the underlying communication and encoding is already tested and implemented in the spi_impl.dart and i2c_impl.dart files.
If anyone needs a UART implementation feel free to add one by extending the BaseProtocol class defined in base_protocol.dart. I would always recommend using some more wires and go with the much more reliable SPI protocol and using at least the IRQ pin.

Also currently the reset procedure defined in the BaseProtocol doesn't seem to actual reset the board but I don't know why at the moment maybe somebody can contribute to this.

@UliPrantz
Copy link
Contributor Author

I just saw that you made your own version of the dart ByteBuffer (actually it seems like it is the ByteBuffer class of dart with some little changes I guess?!) class which is somehow used to read 8 bit and 16 bit values but I really don't know where it's used and how it actually works.
I added a Uint8 class which I guess does the same job and could easily be abstracted to work reading x bytes and replace the ByteBuffer class. I also already added tests for the Uint8 class.
If you want I could make an 8 and 16 bit Uint version but you would have to refactor your code to work with these classes or refactor my code to work with your class. Let me know what you think and how you would like to approach this.

@UliPrantz
Copy link
Contributor Author

Just added capabilities for the PN532 driver to also read and write to Mifare and NTag cards and also added support for Uint8, Uint16, Uint32 by abstracting the Uint8 class to a general Uint class and extending it. If needed support for int8, int16, int32 can be added analog.

I just couldn't test the write and read commands yet also a small explanation in the README.md how to use and wire up the PN532 would be great. Maybe somebody else could do it and test it since I'm currently don't have access to a PN532 board.

@pezi
Copy link
Owner

pezi commented Mar 17, 2022

Thanks for you contribution - I will review and merge your changes probably this coming weekend,

@pezi pezi merged commit b97571a into pezi:main Mar 19, 2022
@pezi
Copy link
Owner

pezi commented Mar 21, 2022

Thanks for great work, I merged your project yesterday (v0.8.29). A little example would be nice for the readme file

[PN532](https://github.com/pezi/dart_periphery/pull/6) NFC Reader Module, Thanks to UliPrantz! 

like for the ohter sensors

* [SGP30](https://github.com/pezi/dart_periphery/blob/main/example/i2c_sgp30.dart): tVOC and eCO2 Gas Sensor

The readme links currently to the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants