Skip to content

Some README and example cleanup #681

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

Merged
merged 4 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,28 +304,31 @@ App|Description
App|Description
---|---
[hello_pio](pio/hello_pio) | Absolutely minimal example showing how to control an LED by pushing values into a PIO FIFO.
[apa102](pio/apa102) | Rainbow pattern on on a string of APA102 addressable RGB LEDs.
[clocked_input](pio/clocked_input) | Shift in serial data, sampling with an external clock.
[differential_manchester](pio/differential_manchester) | Send and receive differential Manchester-encoded serial (BMC).
[hub75](pio/hub75) | Display an image on a 128x64 HUB75 RGB LED matrix.
[i2c](pio/i2c) | Scan an I2C bus.
[ir_nec](pio/ir_nec) | Sending and receiving IR (infra-red) codes using the PIO.
[logic_analyser](pio/logic_analyser) | Use PIO and DMA to capture a logic trace of some GPIOs, whilst a PWM unit is driving them.
[manchester_encoding](pio/manchester_encoding) | Send and receive Manchester-encoded serial.
[onewire](pio/onewire)| A library for interfacing to 1-Wire devices, with an example for the DS18B20 temperature sensor.
[pio_apa102](pio/apa102) | Rainbow pattern on on a string of APA102 addressable RGB LEDs.
[pio_clocked_input](pio/clocked_input) | Shift in serial data, sampling with an external clock.
[pio_differential_manchester](pio/differential_manchester) | Send and receive differential Manchester-encoded serial (BMC).
[pio_hub75](pio/hub75) | Display an image on a 128x64 HUB75 RGB LED matrix.
[pio_i2c_bus_scan](pio/i2c) | Scan an I2C bus.
[pio_ir_loopback](pio/ir_nec) | Sending and receiving IR (infra-red) codes using the PIO.
[pio_logic_analyser](pio/logic_analyser) | Use PIO and DMA to capture a logic trace of some GPIOs, whilst a PWM unit is driving them.
[pio_manchester_encoding](pio/manchester_encoding) | Send and receive Manchester-encoded serial.
[pio_onewire](pio/onewire)| A library for interfacing to 1-Wire devices, with an example for the DS18B20 temperature sensor.
[pio_blink](pio/pio_blink) | Set up some PIO state machines to blink LEDs at different frequencies, according to delay counts pushed into their FIFOs.
[pwm](pio/pwm) | Pulse width modulation on PIO. Use it to gradually fade the brightness of an LED.
[spi](pio/spi) | Use PIO to erase, program and read an external SPI flash chip. A second example runs a loopback test with all four CPHA/CPOL combinations.
[squarewave](pio/squarewave) | Drive a fast square wave onto a GPIO. This example accesses low-level PIO registers directly, instead of using the SDK functions.
[squarewave_div_sync](pio/squarewave) | Generates a square wave on three GPIOs and synchronises the divider on all the state machines
[st7789_lcd](pio/st7789_lcd) | Set up PIO for 62.5 Mbps serial output, and use this to display a spinning image on a ST7789 serial LCD.
[quadrature_encoder](pio/quadrature_encoder) | A quadrature encoder using PIO to maintain counts independent of the CPU.
[quadrature_encoder_substep](pio/quadrature_encoder_substep) | High resolution speed measurement using a standard quadrature encoder
[uart_rx](pio/uart_rx) | Implement the receive component of a UART serial port. Attach it to the spare Arm UART to see it receive characters.
[uart_tx](pio/uart_tx) | Implement the transmit component of a UART serial port, and print hello world.
[ws2812](pio/ws2812) | Examples of driving WS2812 addressable RGB LEDs.
[addition](pio/addition) | Add two integers together using PIO. Only around 8 billion times slower than Cortex-M0+.
[uart_pio_dma](pio/uart_pio_dma) | Send and receive data from a UART implemented using the PIO and DMA
[pio_pwm](pio/pwm) | Pulse width modulation on PIO. Use it to gradually fade the brightness of an LED.
[pio_quadrature_encoder](pio/quadrature_encoder) | A quadrature encoder using PIO to maintain counts independent of the CPU.
[pio_quadrature_encoder_substep](pio/quadrature_encoder_substep) | High resolution speed measurement using a standard quadrature encoder
[pio_spi_flash](pio/spi) | Use PIO to erase, program and read an external SPI flash chip
[pio_spi_loopback](pio/spi) | Use PIO to run a loopback test with all four CPHA/CPOL combinations.
[pio_squarewave](pio/squarewave) | Drive a fast square wave onto a GPIO. This example accesses low-level PIO registers directly, instead of using the SDK functions.
[pio_squarewave_div_sync](pio/squarewave) | Generates a square wave on three GPIOs and synchronises the divider on all the state machines
[pio_st7789_lcd](pio/st7789_lcd) | Set up PIO for 62.5 Mbps serial output, and use this to display a spinning image on a ST7789 serial LCD.
[pio_uart_dma](pio/uart_dma) | Send and receive data from a UART implemented using the PIO and DMA
[pio_uart_rx](pio/uart_rx) | Implement the receive component of a UART serial port. Attach it to the spare Arm UART to see it receive characters.
[pio_uart_rx_intr](pio/uart_rx) | Implement the receive component of a UART serial port with an interrupt for received characters. Attach it to the spare Arm UART to see it receive characters.
[pio_uart_tx](pio/uart_tx) | Implement the transmit component of a UART serial port, and print hello world.
[pio_ws2812](pio/ws2812) | Example of driving a string WS2812 addressable RGB LEDs.
[pio_ws2812_parallel](pio/ws2812) | Examples of driving multiple strings of WS2812 addressable RGB LEDs efficiently.
[pio_addition](pio/addition) | Add two integers together using PIO. Only around 8 billion times slower than Cortex-M0+.

### PWM

Expand Down
2 changes: 1 addition & 1 deletion pio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ if (TARGET hardware_pio)
add_subdirectory_exclude_platforms(spi)
add_subdirectory_exclude_platforms(squarewave)
add_subdirectory_exclude_platforms(st7789_lcd)
add_subdirectory_exclude_platforms(uart_dma)
add_subdirectory_exclude_platforms(uart_rx)
add_subdirectory_exclude_platforms(uart_tx)
add_subdirectory_exclude_platforms(ws2812)
add_subdirectory_exclude_platforms(uart_pio_dma)
else()
message("Skipping PIO examples as hardware_pio is unavailable on this platform")
endif()
2 changes: 1 addition & 1 deletion pio/ir_nec/ir_loopback/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable (pio_ir_loopback ir_loopback.c)
add_executable(pio_ir_loopback ir_loopback.c)

# link the executable using the IR transmit and receive libraries
#
Expand Down
11 changes: 6 additions & 5 deletions pio/ir_nec/nec_receive_library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# build a normal library
#
add_library(nec_receive_library nec_receive.c)
add_library(nec_receive_library INTERFACE)

target_sources(nec_receive_library INTERFACE
${CMAKE_CURRENT_LIST_DIR}/nec_receive.c)

# invoke pio_asm to assemble the state machine program
#
pico_generate_pio_header(nec_receive_library ${CMAKE_CURRENT_LIST_DIR}/nec_receive.pio)

target_link_libraries(nec_receive_library PRIVATE
target_link_libraries(nec_receive_library INTERFACE
pico_stdlib
hardware_pio
)

# add the `binary` directory so that the generated headers are included in the project
#
target_include_directories (nec_receive_library PUBLIC
target_include_directories (nec_receive_library INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
11 changes: 6 additions & 5 deletions pio/ir_nec/nec_transmit_library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# build a normal library
#
add_library(nec_transmit_library nec_transmit.c)
add_library(nec_transmit_library INTERFACE)

target_sources(nec_transmit_library INTERFACE
${CMAKE_CURRENT_LIST_DIR}/nec_transmit.c)

# invoke pio_asm to assemble the PIO state machine programs
#
pico_generate_pio_header(nec_transmit_library ${CMAKE_CURRENT_LIST_DIR}/nec_carrier_burst.pio)
pico_generate_pio_header(nec_transmit_library ${CMAKE_CURRENT_LIST_DIR}/nec_carrier_control.pio)

target_link_libraries(nec_transmit_library PRIVATE
target_link_libraries(nec_transmit_library INTERFACE
pico_stdlib
hardware_pio
)

# add the `binary` directory so that the generated headers are included in the project
#
target_include_directories (nec_transmit_library PUBLIC
target_include_directories (nec_transmit_library INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
11 changes: 11 additions & 0 deletions pio/uart_dma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add_executable(pio_uart_dma)
pico_generate_pio_header(pio_uart_dma ${CMAKE_CURRENT_LIST_DIR}/../uart_rx/uart_rx.pio)
pico_generate_pio_header(pio_uart_dma ${CMAKE_CURRENT_LIST_DIR}/../uart_tx/uart_tx.pio)
target_sources(pio_uart_dma PRIVATE uart_dma.c)
target_link_libraries(pio_uart_dma PRIVATE
pico_stdlib
hardware_pio
hardware_dma
)
pico_add_extra_outputs(pio_uart_dma)
example_auto_set_url(pio_uart_dma)
File renamed without changes.
11 changes: 0 additions & 11 deletions pio/uart_pio_dma/CMakeLists.txt

This file was deleted.