Skip to content

Commit e5feabf

Browse files
authored
Merge pull request #122 from fhoedemakers/i2s_audio
Audio can be played through audio jack of Pimoroni Pico DV Demo base
2 parents 5f29801 + ad763b1 commit e5feabf

File tree

10 files changed

+148
-174
lines changed

10 files changed

+148
-174
lines changed

.github/workflows/BuildAndRelease.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- "v*.*-alpha"
1010
- "v*.*.*"
1111
- "v*.*"
12+
workflow_dispatch:
13+
1214
# branches: [ main ]
1315
# pull_request:
1416
# branches: [ main ]
@@ -92,7 +94,7 @@ jobs:
9294

9395
- name: Create release
9496
uses: softprops/action-gh-release@v2
95-
if: startsWith(github.ref, 'refs/tags/')
97+
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
9698
with:
9799
files: |
98100
releases/*.uf2

.github/workflows/TEST.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*Zone.Identifier
22
fh.log
3+
CMakePresets.json
34
/pimoroni-pico/
45
# Prerequisites
56
*.d

CHANGELOG.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Binaries for each configuration and PCB design are at the end of this page.
66

7-
- For Raspberry Pi Pico (RP2040) you need to download the .uf2 files starting with pico_piconesPlus.
8-
- For Raspberry Pi Pico w (rp2040) you can download the .uf2 files starting with pico_w_piconesPlus. Although you can also use the pico_piconesPlus binaries on the Pico w if you don't mind the blinking led.
9-
- For Raspberry Pi Pico 2 (RP2350) you need to download the .uf2 files starting with pico2_piconesPlus for ARM or pico2_riscv_piconesPlus for Risc-V.
10-
- For Raspberry Pi Pico 2 w (RP2350) you can download the .uf2 files starting with pico2_w_piconesPlus for ARM or pico2_w_riscv_piconesPlus for Risc-V Although you can also use the pico2_piconesPlus binaries on the Pico w if you don't mind the blinking led.
7+
- For Raspberry Pi Pico (RP2040): Download the .uf2 files that start with pico_piconesPlus.
8+
- For Raspberry Pi Pico W (RP2040 with WiFi): Download the .uf2 files that start with pico_w_piconesPlus. You can also use the regular pico_piconesPlus files if you dont mind the WiFi LED blinking.
9+
- For Raspberry Pi Pico 2 (RP2350): Download the .uf2 files that start with pico2_piconesPlus (for ARM) or pico2_riscv_piconesPlus (for RISC-V).
10+
- For Raspberry Pi Pico 2 W (RP2350 with WiFi): Download the .uf2 files that start with pico2_w_piconesPlus (for ARM) or pico2_w_riscv_piconesPlus (for RISC-V). You can also use the non-W files if you dont mind the WiFi LED blinking.
1111

1212
[Click here for tested configurations](testresults.md).
1313

@@ -34,19 +34,13 @@ For the latest two player PCB 2.0, you need:
3434

3535
[https://www.thingiverse.com/thing:6758682](https://www.thingiverse.com/thing:6758682)
3636

37-
# v0.27 release notes
38-
39-
- Added second PCB design for use with Waveshare [RP2040-Zero](https://www.waveshare.com/rp2040-zero.htm) or [RP2350-Zero](https://www.waveshare.com/rp2350-zero.htm) mini development board. The PCB is designed to fit in a 3D-printed case. PCB and Case design by [@DynaMight1124](https://github.com/DynaMight1124).
40-
Based around cheaper but harder to solder components for those that fancy a bigger challenge. It also allows the design to be smaller.
41-
- Added new configuration to BoardConfigs.cmake and bld.sh to support the new configuration for this PCB.
42-
43-
| | |
44-
| ---- | ---- |
45-
| ![NESMiniPCB](https://github.com/user-attachments/assets/64696de1-2896-4a9c-94e9-692f125c55b6) | ![NESMiniCase](https://github.com/user-attachments/assets/a68f31ff-529f-49fb-9ec4-f3512c8e9e38) |
37+
# v0.28 release notes
4638

39+
- Enable I2S audio on the Pimoroni Pico DV Demo Base. This allows audio output through external speakers connected to the line-out jack of the Pimoroni Pico DV Demo Base. You can toggle audio output to this jack with SELECT + LEFT. Thanks to [Layer812](https://github.com/Layer812) for testing and providing feedback.
4740

4841
## Fixes
49-
- Pico 2 W executables added to the release.
42+
- improved error handling in build scripts.
43+
- Github action can be started manual.
5044

5145
All changes are in the pico_shared submodule. When building from source, make sure you do a **git submodule update --init** from within the source folder to get the latest pico_shared module.
5246

CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,16 @@ IF(NOT CMAKE_BUILD_TYPE)
4444
FORCE)
4545
ENDIF(NOT CMAKE_BUILD_TYPE)
4646
message("* Current build type is : ${CMAKE_BUILD_TYPE}")
47-
47+
if (NOT PICO_BOARD )
48+
set(PICO_BOARD pico CACHE STRING "Board type")
49+
endif()
4850
add_definitions( -DNDEBUG )
4951
include(pico_sdk_import.cmake)
50-
5152
project(${projectname} C CXX ASM)
5253
pico_sdk_init()
53-
# IF(EXISTS "${PICO_SDK_PATH}/lib/mbedtls")
54-
# message(FATAL_ERROR "\nPico SDK 1.5.0 or higher cannot be used to build this project.\n"
55-
# "Remove build subdirectory and use SDK 1.4.0 to build this project.\n"
56-
# "See https://github.com/fhoedemakers/pico-infonesPlus/issues/7")
57-
# ENDIF()
5854

5955
if (NOT HW_CONFIG)
60-
set(HW_CONFIG 2 CACHE STRING "Select the hardware configuration for your board")
56+
set(HW_CONFIG 1 CACHE STRING "Select the hardware configuration for your board")
6157
endif()
6258
# Although Pico 2 has enough memory, mapper 5 games do not work properly. (sound and screen glitches)
6359
# if (PICO_BOARD STREQUAL "pico2" OR PICO_BOARD STREQUAL "pico2_w")
@@ -124,6 +120,12 @@ target_compile_definitions(${projectname} PRIVATE
124120
NES_MAPPER_5_ENABLED=${INFONES_MAPPER_5_ENABLED}
125121
HW_CONFIG=${HW_CONFIG}
126122
WIIPAD_I2C=${WIIPAD_I2C}
123+
USE_I2S_AUDIO=${USE_I2S_AUDIO}
124+
PICO_AUDIO_I2S_DATA_PIN=${PICO_AUDIO_I2S_DATA_PIN}
125+
PICO_AUDIO_I2S_CLOCK_PIN_BASE=${PICO_AUDIO_I2S_CLOCK_PIN_BASE}
126+
PICO_AUDIO_I2S_PIO=${PICO_AUDIO_I2S_PIO}
127+
PICO_AUDIO_I2S_DMA_IRQ=1
128+
PICO_AUDIO_I2S_CLOCK_PINS_SWAPPED=${PICO_AUDIO_I2S_CLOCK_PINS_SWAPPED}
127129
)
128130
target_link_libraries(${projectname} PRIVATE
129131
pico_stdlib
@@ -164,6 +166,7 @@ endif()
164166
add_subdirectory(pico_lib/util)
165167
add_subdirectory(pico_shared)
166168
add_subdirectory(tusb_xinput xinput_host)
169+
target_link_options(${projectname} PRIVATE -Xlinker --print-memory-usage --data-sections)
167170
pico_add_extra_outputs(${projectname})
168171

169172

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ Click on the link below for your specific board configuration:
170170
- USB C to USB data cable when using the Sony Dual Sense controller.
171171
- FAT32 or exFAT formatted Micro SD card with roms you legally own. Roms must have the .nes extension. You can organise your roms into different folders.
172172

173+
> [!NOTE]
174+
> An external speaker can be connected to the audio jack of the Pimoroni Pico DV Demo Base. You can toggle audio output to this jack with SELECT + LEFT.
173175
174176
### flashing the Pico
175177
- When using a Pico / Pico W, download **pico_piconesPlusPimoroniDV.uf2** / **pico_w_piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
@@ -796,6 +798,7 @@ Gamepad buttons:
796798
- SELECT + UP/SELECT + DOWN: switches screen modes.
797799
- SELECT + A/B: toggle rapid-fire.
798800
- START + A : Toggle framerate display
801+
- SELECT + LEFT: Switch audio output to the connected speakers on the line-out jack of the Pimoroni Pico DV Demo Base. The speaker setting will be remembered when the emulator is restarted.
799802

800803
When using a Genesis Mini controller, press C for SELECT.
801804

@@ -875,12 +878,9 @@ Some displays need 5V connected to the HDMI breakout in order to work:
875878
***
876879

877880
# Known Issues and limitations
878-
- Pimoroni Pico DV:
879-
- Audio through the audio out jack is not supported, audio only works over hdmi.
880-
- Debug printf statements over UART (GPIO0 and GPIO1) are disabled because GPIO1 is used for second nes controller port.
881+
881882
- Due to the Pico's memory limitations, not all games will work. Games not working will show a "Mapper n is unsupported." (n is a number). For example starting Castlevania III will show the "Mapper 5 is unsupported." message.
882883
- tar file support is removed.
883-
- Pico2 W: Blinking the onboard led causes display issues and ioctl timeout errors on the uart console.
884884

885885
***
886886

buildAll.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ if ! command -v picotool &> /dev/null
1212
then
1313
echo "picotool could not be found"
1414
echo "Please install picotool from https://github.com/raspberrypi/picotool.git"
15-
exit
15+
exit 1
1616
fi
1717
# build for Pico
1818
HWCONFIGS="1 2 3 4 6"
1919
for HWCONFIG in $HWCONFIGS
2020
do
21-
./bld.sh -c $HWCONFIG
21+
./bld.sh -c $HWCONFIG || exit 1
2222
done
2323
# build for Pico w
2424
HWCONFIGS="1 2"
2525
for HWCONFIG in $HWCONFIGS
2626
do
27-
./bld.sh -c $HWCONFIG -w
27+
./bld.sh -c $HWCONFIG -w || exit 1
2828
done
2929
# build for Pico 2 (w) -arm-s
3030
HWCONFIGS="1 2 5 6"
3131
for HWCONFIG in $HWCONFIGS
3232
do
33-
./bld.sh -c $HWCONFIG -2
33+
./bld.sh -c $HWCONFIG -2 || exit 1
3434
# don't build for w when HWCONFIG=5 and 6
3535
if [[ $HWCONFIG -ne 5 && $HWCONFIG -ne 6 ]]; then
36-
./bld.sh -c $HWCONFIG -2 -w
36+
./bld.sh -c $HWCONFIG -2 -w || exit 1
3737
fi
3838
done
3939
# build for Pico 2 -riscv, Metro RP2350 has no risc support because sd card not working
@@ -45,16 +45,16 @@ if [ ! -d $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin ] ; then
4545
else
4646
for HWCONFIG in $HWCONFIGS
4747
do
48-
./bld.sh -c $HWCONFIG -r -t $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin
48+
./bld.sh -c $HWCONFIG -r -t $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin || exit 1
4949
# don't build for w when HWCONFIG=5 or 6
5050
if [[ $HWCONFIG -ne 5 && $HWCONFIG -ne 6 ]]; then
51-
./bld.sh -c $HWCONFIG -r -t $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin -w
51+
./bld.sh -c $HWCONFIG -r -t $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin -w || exit 1
5252
fi
5353
done
5454
fi
5555
if [ -z "$(ls -A releases)" ]; then
5656
echo "No UF2 files found in releases folder"
57-
exit
57+
exit 1
5858
fi
5959
for UF2 in releases/*.uf2
6060
do

0 commit comments

Comments
 (0)