nfc-module #10

Merged
stefank merged 5 commits from nfc-module into main 2025-03-25 21:21:28 +00:00
Member

Simple nfc module with async polling task.

Simple nfc module with async polling task.
stefank added 2 commits 2025-03-04 20:21:38 +00:00
WIP: First working example for an async background task
Some checks failed
Check code formatting / Check-C-Format (push) Successful in 8s
Check code formatting / Check-Python-Flake8 (push) Failing after 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
61843e121e
Added docstrings and license information.
Some checks failed
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Failing after 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
d40ecd897e
Moved main.py contents to documentation as a simple example.
matthias requested changes 2025-03-10 19:02:30 +00:00
Dismissed
matthias left a comment
Owner

Please also fix the failing flake8 check.

Please also fix the failing flake8 check.
@@ -0,0 +28,4 @@
asyncio.run(main())
'''
def __init__(self):
self.reader = MFRC522(spi_id=1, sck=10, miso=12, mosi=11, cs=13, rst=9, tocard_retries=10)
Owner

I don't like the hardcoded pin numbers. Actually, I think I would prefer it if the reader was passed in:

def __init__(reader: IReader):
    self.reader = reader

That way we could also pass in some FakeReader for testing.

I don't like the hardcoded pin numbers. Actually, I think I would prefer it if the reader was passed in: ```python def __init__(reader: IReader): self.reader = reader ``` That way we could also pass in some FakeReader for testing.
stefank marked this conversation as resolved
@@ -0,0 +40,4 @@
'''
return '0x' + ''.join(f'{i:02x}' for i in uid)
async def _reader_poll_task(self, poll_interval_ms: int = 50) -> list:
Owner

Is the return type really list?

Is the return type really `list`?
stefank marked this conversation as resolved
stefank force-pushed nfc-module from d40ecd897e to 7e57b00c1e 2025-03-18 18:43:45 +00:00 Compare
stefank added 1 commit 2025-03-18 20:03:08 +00:00
Made nfc.py executable, increased tocard_retries to 20 due to increased CPU frequency.
Some checks failed
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m2s
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Failing after 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 6s
89e58a92c3
stefank force-pushed nfc-module from 89e58a92c3 to 976bc4053c 2025-03-25 19:38:22 +00:00 Compare
stefank added 1 commit 2025-03-25 21:05:19 +00:00
Nfc module now depends on initialized MFRC522, fixed incorrect return type hint.
Some checks failed
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m0s
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Failing after 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
a2a9c82471
stefank added 1 commit 2025-03-25 21:16:42 +00:00
Providing public interface, fixed formatting.
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m0s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
ee43ad816a
matthias approved these changes 2025-03-25 21:21:06 +00:00
stefank merged commit b818ed933d into main 2025-03-25 21:21:28 +00:00
stefank deleted branch nfc-module 2025-03-25 21:21:29 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TonBERRY/tonberry-pico#10