Commit Graph

63 Commits

Author SHA1 Message Date
7ccab40cd6 rp2_sd: Add write support to SD driver
Add write support to rp2_sd driver.

Cleanup standalone-mp3 test tool and add write test mode.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
2025-07-22 21:30:27 +02:00
96fea9dab6 Add standalone-mp3 test tool 2025-06-26 20:49:03 +02:00
9059da1a70 Merge pull request 'nfc-mp3-demo' (#19) from nfc-mp3-demo into main
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m3s
Check code formatting / Check-C-Format (push) Successful in 6s
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 8s
Reviewed-on: #19
Reviewed-by: Stefan Kratochwil <kratochwil-la@gmx.de>
2025-05-27 18:48:42 +00:00
ce02daad3a Move playlist handling from mp3player to app
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m28s
This completes the move of the nfc-mp3-demo to the new architecture.
2025-05-20 22:04:27 +02:00
7778147b66 app: Implement volume curve 2025-05-20 22:04:27 +02:00
7712c25627 Turn TimerManager into a Singleton 2025-05-20 22:04:27 +02:00
69b6f6e860 build: Copy python files to staging dir for littlefs 2025-05-20 22:04:27 +02:00
903840f982 wip: New architecture
Change PlayerApp to new architecture
 - depedencies injected via named tuple
 - some initial type checking
 - move on button press logic to PlayerApp

TODO: Adapt MP3 player
2025-05-20 22:04:27 +02:00
b477aba94c Add initial button handling 2025-05-20 22:04:27 +02:00
f0c3fe4db8 Use context managers to ensure deinit of audiocore and sd 2025-05-20 22:04:27 +02:00
d02776eea8 Add basic application for playback based on NFC tags
Copy and clean up test.py to main.py. Add app module (currently on
app.py, maybe make it a directory later) for application classes.

Implement app.TimerManager to allow scheduling of delayed events in the
micropython async framework.

Implement app.TagPlaybackManager which handles playing back MP3 files
based on the NFC tag reader. Currently, simply plays all MP3 files in a
folder, for which the folder name matches the tag id, in order. Resume,
random and other features not yet supported.
2025-05-20 22:04:27 +02:00
fb496b6991 nfc: Add tag change notification callback 2025-05-20 22:04:27 +02:00
1b683358d1 micropython: upgrade to 1.25.0 plus necessary changes and fixes.
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m6s
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 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Upgrade and cherry-picks were necessary due to a compilation issue
introduced with gcc 15.1 regarding unterminated string literals. For more
details see https://github.com/micropython/micropython/pull/17269.

Still hot and untested...
2025-05-20 20:13:24 +02:00
7f8282315e Restructure sources
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 5m29s
Check code formatting / Check-C-Format (push) Successful in 9s
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 8s
The python and C modules that are supposed to be built into the firmware
image (i.e. those that are in manifest.py or in USER_C_MODULES) have
been moved to the software/modules directory.

The software/src directory should now only contain python scripts and
other files that should be installed to the Picos flash filesystem. The
idea is that these should be those scripts that implement the
application behaviour, as these are the ones that a user who does not
want to build the whole firmware themself wants to modify.
2025-04-01 22:05:30 +02:00
8a8cb85c39 ci: Add firmware with filesystem image to artifacts 2025-04-01 22:05:30 +02:00
ee43ad816a 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
2025-03-25 22:16:38 +01:00
a2a9c82471 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
2025-03-25 22:05:14 +01:00
976bc4053c 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 2m57s
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 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
2025-03-25 20:37:58 +01:00
5cda9891f5 Added docstrings and license information.
Moved main.py contents to documentation as a simple example.
2025-03-25 20:37:58 +01:00
ba4c5175eb WIP: First working example for an async background task 2025-03-25 20:37:53 +01:00
dfd48a0314 Fix crash when starting audiocore from REPL
All checks were successful
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
Build RPi Pico firmware image / Build-Firmware (push) Successful in 3m0s
2025-03-23 19:12:51 +01:00
1385eee85c audiocore: Make it more obvious what __sev does
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 2m55s
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 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
2025-03-22 10:54:23 +01:00
444b7c4d9f audiocore: Use constant for MP3 frame size 2025-03-22 10:54:23 +01:00
389fed4d3b MP3Player module to manage mp3 playing 2025-03-22 10:53:27 +01:00
931571bd0a audiocore: Add async support
Rename the exising audiocore C module to _audiocore and create a new
Micropython wrapper module audiocore. This makes it easier to implement
async methods.
Add interrupt support to _audiocore that notifies core0 whenever data
has been consumed from the MP3 bitstream buffer.
Use this interrupt and an asyncio.ThreadSafeFlag to implement
audiocore.async_put which will play back the provided buffer, allowing
other async tasks to run while waiting for space in the bitstream
buffer.
2025-03-22 10:53:27 +01:00
cc2bf8a84b audiocore: Integrate mp3 decoder 2025-03-22 10:53:27 +01:00
ff1ddfb639 Add helix_mp3 fixed-point MP3 decoder library 2025-03-17 21:13:34 +01:00
9c898853f8 ci: Add firmware build step
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 2m57s
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
Try to build the actual firmware image in CI
2025-03-10 20:17:27 +01:00
c698dad6da micropython: Update to 1.24.1, with cherrypicked patches for pico-sdk 2.1.1 2025-03-10 20:17:25 +01:00
98ecca0d09 rp2_sd: Cleanup and fixes
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
- Use SD_SECTOR_SIZE define instead of magic number 512
- Replace uint8_t buf[1] with plain uint8_t
- Check sd_spi_read_dma precondition that sd_dma_context state has to be
  DMA_IDLE explicitly and return false instead of relying on assert
- sd_spi_dma_isr is time critical
2025-03-10 20:15:05 +01:00
f7d44516df test.py: Update to use rp2_sd module
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
2025-03-10 20:15:05 +01:00
460a67cf9f Add rp2 PIO and DMA fast SD card driver
The builtin micropython SD card driver using the default micropython SPI
implementation suffered from very low read speeds. Add an optimized SD
card driver using rp2 PIO and DMA. Currently read only, write support to
be added later.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
2025-03-10 20:15:05 +01:00
b57283a04f microdot: First working example. We observe wifi instabilities/detectability issues.
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
2025-01-28 21:44:40 +01:00
b5124b9b1c wifi: announce ssid, set ip. SSID visibilty varies between adapters. 2025-01-28 21:30:00 +01:00
fbea092a95 Added microdot submodule. 2025-01-28 21:23:48 +01:00
f213a51e36 Documented maximum observed delay for future reference.
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
2025-01-28 19:25:57 +01:00
e79d3886ed Usable mfrc522 code.
Not as async as possible, and definately needs a future revisit. But
works for now, with acceptable delays, if the newly introduced
tocard_retries parameter of class MFRC522 is used and set to a
reasonable low value.
2025-01-28 19:25:57 +01:00
1caa3f54a5 Being more pythonesk. 2025-01-28 19:25:57 +01:00
f00b2b1ab1 Made mfrc522.py part of our micropython environment. 2025-01-28 19:25:57 +01:00
3deba7d604 Fixes for flake8. 2025-01-28 19:25:57 +01:00
7188722cc8 Made tag uid retrieval awaitable. 2025-01-28 19:25:57 +01:00
553bbe95b2 Fixed uid output. Also fixed line endings (sorry). 2025-01-28 19:25:57 +01:00
62b93de024 We are not interested in the card's content. 2025-01-28 19:25:57 +01:00
4e7968fc0c Added deployment script and example main.py. 2025-01-28 19:25:57 +01:00
df33e072c3 Added micropython library for the mfrc522 card reader. 2025-01-28 19:25:57 +01:00
1981cac7de Check all shell scripts in our repo. 2025-01-14 20:11:53 +01:00
8b9d6ce9fc Check for required commands, cleanup, added help.
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
2024-12-10 21:27:56 +01:00
50118aea49 Flashing via picotool is the new default.
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 11s
Check code formatting / Check-Python-Flake8 (push) Successful in 10s
Run unit tests on host / Run-Unit-Tests (push) Successful in 11s
2024-12-10 00:26:51 +01:00
ee5ea90e0a audiocore: Comment python API, some cleanup
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Run unit tests on host / Run-Unit-Tests (push) Successful in 7s
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
2024-06-02 11:58:21 +02:00
23a9c3f507 audiocore: Add unit tests for audiocore
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
2024-06-02 11:58:21 +02:00