├── pico_w ├── wifi │ ├── mqtt │ │ ├── certs │ │ │ ├── .gitignore │ │ │ ├── sub.sh │ │ │ └── pub.sh │ │ ├── mbedtls_config.h │ │ └── lwipopts.h │ ├── httpd │ │ ├── content │ │ │ ├── img │ │ │ │ └── rpi.png.gz │ │ │ ├── ledfail.shtml │ │ │ ├── 404.html │ │ │ ├── ledpass.shtml │ │ │ ├── test.shtml │ │ │ └── index.shtml │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── tls_client │ │ ├── mbedtls_config.h │ │ └── lwipopts.h │ ├── http_client │ │ ├── mbedtls_config.h │ │ └── lwipopts.h │ ├── freertos │ │ ├── http_client │ │ │ ├── mbedtls_config.h │ │ │ ├── FreeRTOSConfig.h │ │ │ └── lwipopts.h │ │ ├── ping │ │ │ ├── FreeRTOSConfig.h │ │ │ └── lwipopts.h │ │ ├── httpd │ │ │ ├── FreeRTOSConfig.h │ │ │ ├── content │ │ │ │ ├── 404.html │ │ │ │ ├── test.shtml │ │ │ │ └── index.shtml │ │ │ └── lwipopts.h │ │ ├── iperf │ │ │ ├── FreeRTOSConfig.h │ │ │ └── lwipopts.h │ │ ├── CMakeLists.txt │ │ └── ntp_client_socket │ │ │ ├── lwipopts.h │ │ │ └── CMakeLists.txt │ ├── iperf │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── ota_update │ │ ├── private.pem │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── ntp_client │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── tcp_client │ │ └── lwipopts.h │ ├── tcp_server │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── udp_beacon │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── wifi_scan │ │ ├── lwipopts.h │ │ └── CMakeLists.txt │ ├── access_point │ │ ├── lwipopts.h │ │ ├── dnsserver │ │ │ └── dnsserver.h │ │ └── dhcpserver │ │ │ └── LICENSE │ └── blink │ │ ├── picow_blink.c │ │ ├── picow_blink_fast_clock.c │ │ └── picow_blink_slow_clock.c ├── bt │ ├── le_mitm │ │ └── CMakeLists.txt │ ├── gap_inquiry │ │ └── CMakeLists.txt │ ├── gatt_browser │ │ └── CMakeLists.txt │ ├── gatt_counter │ │ └── CMakeLists.txt │ ├── led_counter │ │ └── CMakeLists.txt │ ├── spp_counter │ │ └── CMakeLists.txt │ ├── spp_streamer │ │ └── CMakeLists.txt │ ├── gap_link_keys │ │ └── CMakeLists.txt │ ├── hid_host_demo │ │ └── CMakeLists.txt │ ├── hid_mouse_demo │ │ └── CMakeLists.txt │ ├── hog_host_demo │ │ └── CMakeLists.txt │ ├── hog_mouse_demo │ │ └── CMakeLists.txt │ ├── sdp_bnep_query │ │ └── CMakeLists.txt │ ├── spp_flowcontrol │ │ └── CMakeLists.txt │ ├── ancs_client_demo │ │ └── CMakeLists.txt │ ├── dut_mode_classic │ │ └── CMakeLists.txt │ ├── hid_keyboard_demo │ │ └── CMakeLists.txt │ ├── hog_keyboard_demo │ │ └── CMakeLists.txt │ ├── pbap_client_demo │ │ └── CMakeLists.txt │ ├── sdp_general_query │ │ └── CMakeLists.txt │ ├── sdp_rfcomm_query │ │ └── CMakeLists.txt │ ├── att_delayed_response │ │ └── CMakeLists.txt │ ├── gatt_battery_query │ │ └── CMakeLists.txt │ ├── gatt_streamer_server │ │ └── CMakeLists.txt │ ├── hog_boot_host_demo │ │ └── CMakeLists.txt │ ├── le_streamer_client │ │ └── CMakeLists.txt │ ├── sm_pairing_central │ │ └── CMakeLists.txt │ ├── spp_and_gatt_counter │ │ └── CMakeLists.txt │ ├── spp_streamer_client │ │ └── CMakeLists.txt │ ├── ublox_spp_le_counter │ │ └── CMakeLists.txt │ ├── avrcp_browsing_client │ │ └── CMakeLists.txt │ ├── gap_dedicated_bonding │ │ └── CMakeLists.txt │ ├── gap_le_advertisements │ │ └── CMakeLists.txt │ ├── gatt_heart_rate_client │ │ └── CMakeLists.txt │ ├── nordic_spp_le_counter │ │ └── CMakeLists.txt │ ├── nordic_spp_le_streamer │ │ └── CMakeLists.txt │ ├── sm_pairing_peripheral │ │ └── CMakeLists.txt │ ├── spp_and_gatt_streamer │ │ └── CMakeLists.txt │ ├── standalone │ │ ├── CMakeLists.txt │ │ ├── client │ │ │ ├── btstack_config.h │ │ │ └── CMakeLists.txt │ │ └── server │ │ │ ├── btstack_config.h │ │ │ ├── temp_sensor.gatt │ │ │ └── CMakeLists.txt │ ├── gatt_device_information_query │ │ └── CMakeLists.txt │ ├── hfp_ag_demo │ │ └── CMakeLists.txt │ ├── hsp_ag_demo │ │ └── CMakeLists.txt │ ├── hsp_hs_demo │ │ └── CMakeLists.txt │ ├── a2dp_source_demo │ │ └── CMakeLists.txt │ ├── le_credit_based_flow_control_mode_client │ │ └── CMakeLists.txt │ ├── le_credit_based_flow_control_mode_server │ │ └── CMakeLists.txt │ ├── sine_player │ │ └── CMakeLists.txt │ ├── mod_player │ │ └── CMakeLists.txt │ ├── a2dp_sink_demo │ │ └── CMakeLists.txt │ ├── hfp_hf_demo │ │ └── CMakeLists.txt │ ├── picow_bt_example_common.h │ ├── gatt_counter_with_wifi │ │ └── CMakeLists.txt │ ├── spp_streamer_with_wifi │ │ └── CMakeLists.txt │ ├── gatt_streamer_server_with_wifi │ │ └── CMakeLists.txt │ ├── picow_bt_example_poll.c │ ├── picow_bt_example_background.c │ ├── config │ │ └── lwipopts.h │ └── pan_lwip_http_server │ │ └── CMakeLists.txt └── CMakeLists.txt ├── cmake ├── CMakeLists.txt └── build_variants │ ├── other.h │ ├── main.c │ └── other.c ├── encrypted ├── hello_encrypted │ ├── secret.txt │ ├── secret.S │ ├── ivsalt.bin │ ├── privateaes.bin │ └── private.pem └── CMakeLists.txt ├── pio ├── squarewave │ ├── generated │ │ ├── squarewave.hex │ │ └── squarewave.pio.h │ ├── squarewave.pio │ ├── squarewave_fast.pio │ └── squarewave_wrap.pio ├── onewire │ ├── pio_onewire.fzz │ ├── pio_onewire.png │ ├── ow_rom.h │ ├── ds18b20.h │ ├── CMakeLists.txt │ └── onewire_library │ │ ├── onewire_library.h │ │ └── CMakeLists.txt ├── hub75 │ ├── mountains_128x64.png │ ├── CMakeLists.txt │ └── Readme.md ├── ir_nec │ ├── pio_ir_loopback.fzz │ ├── pio_ir_loopback.png │ ├── CMakeLists.txt │ ├── nec_transmit_library │ │ ├── nec_transmit.h │ │ └── CMakeLists.txt │ ├── nec_receive_library │ │ ├── nec_receive.h │ │ └── CMakeLists.txt │ └── ir_loopback │ │ └── CMakeLists.txt ├── st7789_lcd │ ├── raspberry_256x256.png │ └── CMakeLists.txt ├── pwm │ ├── CMakeLists.txt │ └── pwm.pio ├── logic_analyser │ └── CMakeLists.txt ├── uart_tx │ └── CMakeLists.txt ├── addition │ ├── CMakeLists.txt │ ├── addition.c │ └── addition.pio ├── apa102 │ └── CMakeLists.txt ├── manchester_encoding │ └── CMakeLists.txt ├── i2c │ ├── CMakeLists.txt │ ├── pio_i2c.h │ └── i2c_bus_scan.c ├── uart_dma │ └── CMakeLists.txt ├── clocked_input │ └── CMakeLists.txt ├── differential_manchester │ └── CMakeLists.txt ├── quadrature_encoder │ └── CMakeLists.txt ├── pio_blink │ ├── CMakeLists.txt │ └── blink.pio ├── hello_pio │ ├── CMakeLists.txt │ └── hello.pio ├── spi │ ├── pio_spi.h │ └── CMakeLists.txt ├── quadrature_encoder_substep │ └── CMakeLists.txt ├── uart_rx │ └── CMakeLists.txt ├── ws2812 │ └── generated │ │ └── ws2812.py └── CMakeLists.txt ├── otp ├── CMakeLists.txt └── hello_otp │ └── CMakeLists.txt ├── dcp ├── CMakeLists.txt └── hello_dcp │ └── CMakeLists.txt ├── status_led ├── CMakeLists.txt ├── color_blink │ ├── CMakeLists.txt │ └── color_blink.c └── status_blink │ ├── CMakeLists.txt │ └── status_blink.c ├── uart ├── lcd_uart │ ├── lcd_uart.fzz │ ├── lcd_uart_bb.png │ └── CMakeLists.txt ├── CMakeLists.txt ├── hello_uart │ └── CMakeLists.txt └── uart_advanced │ └── CMakeLists.txt ├── hello_world ├── CMakeLists.txt ├── serial │ ├── CMakeLists.txt │ └── hello_serial.c └── usb │ ├── hello_usb.c │ └── CMakeLists.txt ├── i2c ├── ssd1306_i2c │ ├── 1306_i2c.fzz │ ├── raspberry26x32.bmp │ ├── ssd1306_i2c_bb.png │ ├── CMakeLists.txt │ └── raspberry26x32.h ├── bmp280_i2c │ ├── bmp280_i2c.fzz │ ├── bmp280_i2c_bb.png │ └── CMakeLists.txt ├── lis3dh_i2c │ ├── lis3dh_i2c.fzz │ ├── lis3dh_i2c.png │ └── CMakeLists.txt ├── mcp9808_i2c │ ├── mcp9808_i2c.fzz │ ├── mcp9808_i2c.png │ └── CMakeLists.txt ├── mma8451_i2c │ ├── mma8451_i2c.fzz │ ├── mma8451_i2c.png │ └── CMakeLists.txt ├── mpu6050_i2c │ ├── mpu6050_i2c.fzz │ ├── mpu6050_i2c_bb.png │ └── CMakeLists.txt ├── pa1010d_i2c │ ├── pa1010d_i2c.fzz │ ├── pa1010d_i2c.png │ └── CMakeLists.txt ├── pcf8523_i2c │ ├── pc8523_i2c.fzz │ ├── pc8523_i2c.png │ ├── CMakeLists.txt │ └── README.adoc ├── lcd_1602_i2c │ ├── lcd_1602_i2c.fzz │ ├── lcd_1602_i2c_bb.png │ └── CMakeLists.txt ├── mpl3115a2_i2c │ ├── mpl3115a2_i2c.fzz │ ├── mpl3115a2_i2c_bb.png │ ├── CMakeLists.txt │ └── mpl3115a2_i2c.h ├── bus_scan │ └── CMakeLists.txt ├── ht16k33_i2c │ └── CMakeLists.txt ├── slave_mem_i2c │ └── CMakeLists.txt └── CMakeLists.txt ├── usb ├── README.md ├── dual │ └── CMakeLists.txt ├── device │ ├── dev_hid_composite │ │ ├── README.md │ │ ├── CMakeLists.txt │ │ └── LICENSE.TXT │ ├── dev_lowlevel │ │ ├── CMakeLists.txt │ │ └── dev_lowlevel_loopback.py │ ├── CMakeLists.txt │ └── dev_multi_cdc │ │ ├── CMakeLists.txt │ │ └── tusb_config.h ├── host │ ├── CMakeLists.txt │ └── host_cdc_msc_hid │ │ ├── CMakeLists.txt │ │ └── LICENSE.TXT └── CMakeLists.txt ├── .gitignore ├── picoboard ├── CMakeLists.txt ├── blinky │ └── CMakeLists.txt └── button │ └── CMakeLists.txt ├── spi ├── bme280_spi │ ├── bme280_spi.fzz │ ├── bme280_spi_bb.png │ └── CMakeLists.txt ├── mpu9250_spi │ ├── mpu9250_spi.fzz │ ├── mpu9250_spi_bb.png │ └── CMakeLists.txt ├── spi_master_slave │ ├── CMakeLists.txt │ ├── spi_master_slave.fzz │ ├── spi_master_slave_bb.png │ ├── spi_master_slave_logic.png │ ├── spi_slave │ │ └── CMakeLists.txt │ └── spi_master │ │ └── CMakeLists.txt ├── spi_dma │ └── CMakeLists.txt ├── spi_flash │ └── CMakeLists.txt ├── max7219_32x8_spi │ └── CMakeLists.txt ├── max7219_8x7seg_spi │ └── CMakeLists.txt └── CMakeLists.txt ├── bootloaders ├── encrypted │ ├── ivsalt.bin │ ├── privateaes.bin │ ├── mbedtls_config.h │ ├── private.pem │ ├── hello_serial.c │ └── enc-pt.json ├── CMakeLists.txt └── uart │ ├── uart-pt.json │ └── CMakeLists.txt ├── gpio ├── dht_sensor │ ├── serial-output.png │ ├── pi-and-pico-uart-and-dht-sensor.fzz │ ├── pi-and-pico-uart-and-dht-sensor.png │ └── CMakeLists.txt ├── hello_7segment │ ├── hello_7segment.fzz │ ├── hello_7segment_bb.png │ └── CMakeLists.txt ├── CMakeLists.txt └── hello_gpio_irq │ └── CMakeLists.txt ├── adc ├── microphone_adc │ ├── microphone_adc.fzz │ ├── microphone_adc_bb.png │ ├── microphone_adc_plotter.png │ └── CMakeLists.txt ├── hello_adc │ ├── CMakeLists.txt │ └── hello_adc.c ├── adc_console │ └── CMakeLists.txt ├── joystick_display │ ├── CMakeLists.txt │ └── joystick_display.c ├── read_vsys │ ├── power_status │ │ ├── CMakeLists.txt │ │ └── power_status.h │ └── CMakeLists.txt ├── onboard_temperature │ └── CMakeLists.txt ├── CMakeLists.txt └── dma_capture │ ├── CMakeLists.txt │ └── resistor_dac.pio ├── binary_info ├── CMakeLists.txt ├── blink_any │ └── CMakeLists.txt └── hello_anything │ └── CMakeLists.txt ├── hstx ├── CMakeLists.txt ├── spi_lcd │ └── CMakeLists.txt └── dvi_out_hstx_encoder │ └── CMakeLists.txt ├── timer ├── CMakeLists.txt ├── hello_timer │ └── CMakeLists.txt ├── periodic_sampler │ └── CMakeLists.txt └── timer_lowlevel │ └── CMakeLists.txt ├── flash ├── runtime_flash_permissions │ ├── pt.json │ └── CMakeLists.txt ├── program │ └── CMakeLists.txt ├── cache_perfctr │ └── CMakeLists.txt ├── ssi_dma │ └── CMakeLists.txt ├── xip_stream │ └── CMakeLists.txt ├── nuke │ └── CMakeLists.txt ├── partition_info │ ├── CMakeLists.txt │ ├── uf2_family_ids.h │ └── pt.json └── CMakeLists.txt ├── .github └── workflows │ ├── choco_packages.config │ └── pr-check.yml ├── freertos ├── FreeRTOSConfig.h └── CMakeLists.txt ├── watchdog ├── CMakeLists.txt └── hello_watchdog │ ├── CMakeLists.txt │ └── hello_watchdog.c ├── interp ├── CMakeLists.txt └── hello_interp │ └── CMakeLists.txt ├── reset ├── CMakeLists.txt └── hello_reset │ ├── CMakeLists.txt │ └── hello_reset.c ├── sha ├── mbedtls_sha256 │ ├── mbedtls_config.h │ └── CMakeLists.txt ├── CMakeLists.txt └── sha256 │ └── sample.txt ├── multicore ├── multicore_doorbell │ └── CMakeLists.txt ├── multicore_runner │ └── CMakeLists.txt ├── multicore_fifo_irqs │ └── CMakeLists.txt ├── multicore_runner_queue │ └── CMakeLists.txt ├── hello_multicore │ ├── CMakeLists.txt │ └── multicore.c └── CMakeLists.txt ├── system ├── CMakeLists.txt ├── rand │ └── CMakeLists.txt ├── boot_info │ └── CMakeLists.txt ├── narrow_io_write │ └── CMakeLists.txt ├── unique_board_id │ ├── CMakeLists.txt │ └── unique_board_id.c └── hello_double_tap │ ├── CMakeLists.txt │ └── hello_double_tap.c ├── rtc ├── CMakeLists.txt ├── hello_rtc │ ├── CMakeLists.txt │ └── hello_rtc.c ├── rtc_alarm │ └── CMakeLists.txt └── rtc_alarm_repeat │ └── CMakeLists.txt ├── dma ├── hello_dma │ └── CMakeLists.txt ├── sniff_crc │ └── CMakeLists.txt ├── control_blocks │ └── CMakeLists.txt ├── CMakeLists.txt └── channel_irq │ ├── CMakeLists.txt │ └── pio_serialiser.pio ├── pwm ├── CMakeLists.txt ├── hello_pwm │ ├── CMakeLists.txt │ └── hello_pwm.c ├── led_fade │ └── CMakeLists.txt └── measure_duty_cycle │ └── CMakeLists.txt ├── example_auto_set_url.cmake ├── clocks ├── hello_gpout │ ├── CMakeLists.txt │ └── hello_gpout.c ├── hello_resus │ ├── CMakeLists.txt │ └── hello_resus.c ├── CMakeLists.txt ├── hello_48MHz │ └── CMakeLists.txt └── detached_clk_peri │ └── CMakeLists.txt ├── blink └── CMakeLists.txt ├── blink_simple ├── CMakeLists.txt └── blink_simple.c ├── universal └── hello_universal │ └── CMakeLists.txt ├── divider └── CMakeLists.txt └── ide └── vscode ├── settings.json ├── launch-remote-openocd.json ├── launch-raspberrypi-swd.json └── launch-probe-swd.json /pico_w/wifi/mqtt/certs/.gitignore: -------------------------------------------------------------------------------- 1 | */ 2 | 3 | -------------------------------------------------------------------------------- /pico_w/bt/le_mitm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(le_mitm) 2 | -------------------------------------------------------------------------------- /cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(build_variants) -------------------------------------------------------------------------------- /encrypted/hello_encrypted/secret.txt: -------------------------------------------------------------------------------- 1 | TODO: Put a funny secret here 2 | -------------------------------------------------------------------------------- /pico_w/bt/gap_inquiry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gap_inquiry) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_browser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_browser) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/led_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(led_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_streamer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_streamer) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gap_link_keys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gap_link_keys) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hid_host_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hid_host_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hid_mouse_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hid_mouse_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hog_host_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hog_host_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hog_mouse_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hog_mouse_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/sdp_bnep_query/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(sdp_bnep_query) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_flowcontrol/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_flowcontrol) 2 | -------------------------------------------------------------------------------- /pio/squarewave/generated/squarewave.hex: -------------------------------------------------------------------------------- 1 | e081 2 | e101 3 | e000 4 | 0001 5 | -------------------------------------------------------------------------------- /otp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(hello_otp host rp2040) 2 | -------------------------------------------------------------------------------- /pico_w/bt/ancs_client_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(ancs_client_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/dut_mode_classic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(dut_mode_classic) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hid_keyboard_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hid_keyboard_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hog_keyboard_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hog_keyboard_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/pbap_client_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(pbap_client_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/sdp_general_query/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(sdp_general_query) 2 | -------------------------------------------------------------------------------- /pico_w/bt/sdp_rfcomm_query/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(sdp_rfcomm_query) 2 | -------------------------------------------------------------------------------- /dcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(hello_dcp host rp2040 rp2350-riscv) -------------------------------------------------------------------------------- /pico_w/bt/att_delayed_response/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(att_delayed_response) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_battery_query/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_battery_query) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_streamer_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_streamer_server) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hog_boot_host_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hog_boot_host_demo) 2 | -------------------------------------------------------------------------------- /pico_w/bt/le_streamer_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(le_streamer_client) 2 | -------------------------------------------------------------------------------- /pico_w/bt/sm_pairing_central/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(sm_pairing_central) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_and_gatt_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_and_gatt_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_streamer_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_streamer_client) 2 | -------------------------------------------------------------------------------- /pico_w/bt/ublox_spp_le_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(ublox_spp_le_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/avrcp_browsing_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(avrcp_browsing_client) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gap_dedicated_bonding/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gap_dedicated_bonding) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gap_le_advertisements/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gap_le_advertisements) 2 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_heart_rate_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_heart_rate_client) 2 | -------------------------------------------------------------------------------- /pico_w/bt/nordic_spp_le_counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(nordic_spp_le_counter) 2 | -------------------------------------------------------------------------------- /pico_w/bt/nordic_spp_le_streamer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(nordic_spp_le_streamer) 2 | -------------------------------------------------------------------------------- /pico_w/bt/sm_pairing_peripheral/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(sm_pairing_peripheral) 2 | -------------------------------------------------------------------------------- /pico_w/bt/spp_and_gatt_streamer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(spp_and_gatt_streamer) 2 | -------------------------------------------------------------------------------- /pico_w/bt/standalone/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(client) 2 | add_subdirectory(server) 3 | -------------------------------------------------------------------------------- /status_led/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(status_blink) 2 | add_subdirectory(color_blink) 3 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_device_information_query/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(gatt_device_information_query) 2 | -------------------------------------------------------------------------------- /uart/lcd_uart/lcd_uart.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/uart/lcd_uart/lcd_uart.fzz -------------------------------------------------------------------------------- /hello_world/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(serial) 2 | add_subdirectory_exclude_platforms(usb) 3 | -------------------------------------------------------------------------------- /i2c/ssd1306_i2c/1306_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/ssd1306_i2c/1306_i2c.fzz -------------------------------------------------------------------------------- /pio/onewire/pio_onewire.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/onewire/pio_onewire.fzz -------------------------------------------------------------------------------- /pio/onewire/pio_onewire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/onewire/pio_onewire.png -------------------------------------------------------------------------------- /usb/README.md: -------------------------------------------------------------------------------- 1 | Note: most of these examples are copies of the tinyusb examples in pico-sdk/lib/tinyusb/examples 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .vscode 3 | _deps 4 | cmake-* 5 | build 6 | build-* 7 | build_* 8 | .DS_Store 9 | *.pdf 10 | -------------------------------------------------------------------------------- /i2c/bmp280_i2c/bmp280_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/bmp280_i2c/bmp280_i2c.fzz -------------------------------------------------------------------------------- /i2c/lis3dh_i2c/lis3dh_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/lis3dh_i2c/lis3dh_i2c.fzz -------------------------------------------------------------------------------- /i2c/lis3dh_i2c/lis3dh_i2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/lis3dh_i2c/lis3dh_i2c.png -------------------------------------------------------------------------------- /i2c/mcp9808_i2c/mcp9808_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mcp9808_i2c/mcp9808_i2c.fzz -------------------------------------------------------------------------------- /i2c/mcp9808_i2c/mcp9808_i2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mcp9808_i2c/mcp9808_i2c.png -------------------------------------------------------------------------------- /i2c/mma8451_i2c/mma8451_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mma8451_i2c/mma8451_i2c.fzz -------------------------------------------------------------------------------- /i2c/mma8451_i2c/mma8451_i2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mma8451_i2c/mma8451_i2c.png -------------------------------------------------------------------------------- /i2c/mpu6050_i2c/mpu6050_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mpu6050_i2c/mpu6050_i2c.fzz -------------------------------------------------------------------------------- /i2c/pa1010d_i2c/pa1010d_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/pa1010d_i2c/pa1010d_i2c.fzz -------------------------------------------------------------------------------- /i2c/pa1010d_i2c/pa1010d_i2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/pa1010d_i2c/pa1010d_i2c.png -------------------------------------------------------------------------------- /i2c/pcf8523_i2c/pc8523_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/pcf8523_i2c/pc8523_i2c.fzz -------------------------------------------------------------------------------- /i2c/pcf8523_i2c/pc8523_i2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/pcf8523_i2c/pc8523_i2c.png -------------------------------------------------------------------------------- /pico_w/bt/hfp_ag_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hfp_ag_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hsp_ag_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hsp_ag_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder) 2 | -------------------------------------------------------------------------------- /pico_w/bt/hsp_hs_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(hsp_hs_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder) 2 | -------------------------------------------------------------------------------- /picoboard/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(blinky host) 2 | add_subdirectory_exclude_platforms(button host) -------------------------------------------------------------------------------- /pio/hub75/mountains_128x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/hub75/mountains_128x64.png -------------------------------------------------------------------------------- /pio/ir_nec/pio_ir_loopback.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/ir_nec/pio_ir_loopback.fzz -------------------------------------------------------------------------------- /pio/ir_nec/pio_ir_loopback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/ir_nec/pio_ir_loopback.png -------------------------------------------------------------------------------- /spi/bme280_spi/bme280_spi.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/bme280_spi/bme280_spi.fzz -------------------------------------------------------------------------------- /spi/mpu9250_spi/mpu9250_spi.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/mpu9250_spi/mpu9250_spi.fzz -------------------------------------------------------------------------------- /uart/lcd_uart/lcd_uart_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/uart/lcd_uart/lcd_uart_bb.png -------------------------------------------------------------------------------- /bootloaders/encrypted/ivsalt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/bootloaders/encrypted/ivsalt.bin -------------------------------------------------------------------------------- /encrypted/hello_encrypted/secret.S: -------------------------------------------------------------------------------- 1 | .section .rodata 2 | .global secret_data 3 | secret_data: 4 | .incbin "secret.txt" 5 | .byte 0 -------------------------------------------------------------------------------- /gpio/dht_sensor/serial-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/gpio/dht_sensor/serial-output.png -------------------------------------------------------------------------------- /i2c/bmp280_i2c/bmp280_i2c_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/bmp280_i2c/bmp280_i2c_bb.png -------------------------------------------------------------------------------- /i2c/lcd_1602_i2c/lcd_1602_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/lcd_1602_i2c/lcd_1602_i2c.fzz -------------------------------------------------------------------------------- /pico_w/bt/a2dp_source_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(a2dp_source_demo pico_btstack_hxcmod_player pico_btstack_sbc_encoder) -------------------------------------------------------------------------------- /pico_w/bt/le_credit_based_flow_control_mode_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(le_credit_based_flow_control_mode_client) 2 | -------------------------------------------------------------------------------- /pico_w/bt/le_credit_based_flow_control_mode_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | picow_bt_example(le_credit_based_flow_control_mode_server) 2 | -------------------------------------------------------------------------------- /spi/bme280_spi/bme280_spi_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/bme280_spi/bme280_spi_bb.png -------------------------------------------------------------------------------- /bootloaders/encrypted/privateaes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/bootloaders/encrypted/privateaes.bin -------------------------------------------------------------------------------- /encrypted/hello_encrypted/ivsalt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/encrypted/hello_encrypted/ivsalt.bin -------------------------------------------------------------------------------- /i2c/lcd_1602_i2c/lcd_1602_i2c_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/lcd_1602_i2c/lcd_1602_i2c_bb.png -------------------------------------------------------------------------------- /i2c/mpl3115a2_i2c/mpl3115a2_i2c.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mpl3115a2_i2c/mpl3115a2_i2c.fzz -------------------------------------------------------------------------------- /i2c/mpu6050_i2c/mpu6050_i2c_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mpu6050_i2c/mpu6050_i2c_bb.png -------------------------------------------------------------------------------- /i2c/ssd1306_i2c/raspberry26x32.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/ssd1306_i2c/raspberry26x32.bmp -------------------------------------------------------------------------------- /i2c/ssd1306_i2c/ssd1306_i2c_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/ssd1306_i2c/ssd1306_i2c_bb.png -------------------------------------------------------------------------------- /pio/st7789_lcd/raspberry_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pio/st7789_lcd/raspberry_256x256.png -------------------------------------------------------------------------------- /spi/mpu9250_spi/mpu9250_spi_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/mpu9250_spi/mpu9250_spi_bb.png -------------------------------------------------------------------------------- /adc/microphone_adc/microphone_adc.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/adc/microphone_adc/microphone_adc.fzz -------------------------------------------------------------------------------- /gpio/hello_7segment/hello_7segment.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/gpio/hello_7segment/hello_7segment.fzz -------------------------------------------------------------------------------- /i2c/mpl3115a2_i2c/mpl3115a2_i2c_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/i2c/mpl3115a2_i2c/mpl3115a2_i2c_bb.png -------------------------------------------------------------------------------- /spi/spi_master_slave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(spi_master) 2 | add_subdirectory_exclude_platforms(spi_slave) 3 | -------------------------------------------------------------------------------- /adc/microphone_adc/microphone_adc_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/adc/microphone_adc/microphone_adc_bb.png -------------------------------------------------------------------------------- /binary_info/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(blink_any host) 2 | add_subdirectory_exclude_platforms(hello_anything host) 3 | -------------------------------------------------------------------------------- /encrypted/hello_encrypted/privateaes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/encrypted/hello_encrypted/privateaes.bin -------------------------------------------------------------------------------- /gpio/hello_7segment/hello_7segment_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/gpio/hello_7segment/hello_7segment_bb.png -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/img/rpi.png.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/pico_w/wifi/httpd/content/img/rpi.png.gz -------------------------------------------------------------------------------- /spi/spi_master_slave/spi_master_slave.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/spi_master_slave/spi_master_slave.fzz -------------------------------------------------------------------------------- /adc/microphone_adc/microphone_adc_plotter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/adc/microphone_adc/microphone_adc_plotter.png -------------------------------------------------------------------------------- /hstx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(dvi_out_hstx_encoder host rp2040) 2 | add_subdirectory_exclude_platforms(spi_lcd host rp2040) 3 | -------------------------------------------------------------------------------- /spi/spi_master_slave/spi_master_slave_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/spi_master_slave/spi_master_slave_bb.png -------------------------------------------------------------------------------- /spi/spi_master_slave/spi_master_slave_logic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/spi/spi_master_slave/spi_master_slave_logic.png -------------------------------------------------------------------------------- /gpio/dht_sensor/pi-and-pico-uart-and-dht-sensor.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/gpio/dht_sensor/pi-and-pico-uart-and-dht-sensor.fzz -------------------------------------------------------------------------------- /gpio/dht_sensor/pi-and-pico-uart-and-dht-sensor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypi/pico-examples/HEAD/gpio/dht_sensor/pi-and-pico-uart-and-dht-sensor.png -------------------------------------------------------------------------------- /cmake/build_variants/other.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | void do_other(); -------------------------------------------------------------------------------- /pico_w/bt/standalone/client/btstack_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _PICO_BTSTACK_CONFIG_H 2 | #define _PICO_BTSTACK_CONFIG_H 3 | 4 | #include "btstack_config_common.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /pico_w/bt/standalone/server/btstack_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _PICO_BTSTACK_CONFIG_H 2 | #define _PICO_BTSTACK_CONFIG_H 3 | 4 | #include "btstack_config_common.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /pico_w/wifi/mqtt/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef MBEDTLS_CONFIG_TLS_CLIENT_H 2 | #define MBEDTLS_CONFIG_TLS_CLIENT_H 3 | 4 | #include "mbedtls_config_examples_common.h" 5 | 6 | #endif -------------------------------------------------------------------------------- /pico_w/wifi/tls_client/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef MBEDTLS_CONFIG_TLS_CLIENT_H 2 | #define MBEDTLS_CONFIG_TLS_CLIENT_H 3 | 4 | #include "mbedtls_config_examples_common.h" 5 | 6 | #endif -------------------------------------------------------------------------------- /pico_w/wifi/http_client/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef MBEDTLS_CONFIG_TLS_CLIENT_H 2 | #define MBEDTLS_CONFIG_TLS_CLIENT_H 3 | 4 | #include "mbedtls_config_examples_common.h" 5 | 6 | #endif -------------------------------------------------------------------------------- /pico_w/wifi/freertos/http_client/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef MBEDTLS_CONFIG_TLS_CLIENT_H 2 | #define MBEDTLS_CONFIG_TLS_CLIENT_H 3 | 4 | #include "mbedtls_config_examples_common.h" 5 | 6 | #endif -------------------------------------------------------------------------------- /gpio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(dht_sensor host) 2 | add_subdirectory_exclude_platforms(hello_7segment host) 3 | add_subdirectory_exclude_platforms(hello_gpio_irq host) 4 | -------------------------------------------------------------------------------- /timer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(hello_timer host) 2 | add_subdirectory_exclude_platforms(periodic_sampler) 3 | add_subdirectory_exclude_platforms(timer_lowlevel host) 4 | -------------------------------------------------------------------------------- /flash/runtime_flash_permissions/pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": [1, 0], 3 | "unpartitioned": { 4 | "families": ["absolute"], 5 | "permissions": { 6 | "bootloader": "rw" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /usb/dual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FAMILY rp2040) 2 | set(BOARD pico_sdk) 3 | set(TINYUSB_FAMILY_PROJECT_NAME_PREFIX "tinyusb_dual_") 4 | add_subdirectory(${PICO_TINYUSB_PATH}/examples/dual tinyusb_dual_examples) -------------------------------------------------------------------------------- /.github/workflows/choco_packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /freertos/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | // This example uses a common include to avoid repetition 5 | #include "FreeRTOSConfig_examples_common.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /watchdog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_watchdog) 2 | add_subdirectory_exclude_platforms(hello_watchdog host) 3 | else() 4 | message("Skipping Watchdog examples as hardware_watchdog unavailable") 5 | endif() -------------------------------------------------------------------------------- /interp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_interp) 2 | add_subdirectory_exclude_platforms(hello_interp) 3 | else() 4 | message("Skipping interp examples as hardware_interp is unavailable on this platform") 5 | endif() 6 | -------------------------------------------------------------------------------- /reset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_resets) 2 | add_subdirectory_exclude_platforms(hello_reset) 3 | else() 4 | message("Skipping reset examples as hardware_resets is unavailable on this platform") 5 | endif() 6 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/ping/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | // This example uses a common include to avoid repetition 5 | #include "FreeRTOSConfig_examples_common.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/httpd/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | // This example uses a common include to avoid repetition 5 | #include "FreeRTOSConfig_examples_common.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/iperf/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | // This example uses a common include to avoid repetition 5 | #include "FreeRTOSConfig_examples_common.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/http_client/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FREERTOS_CONFIG_H 2 | #define FREERTOS_CONFIG_H 3 | 4 | // This example uses a common include to avoid repetition 5 | #include "FreeRTOSConfig_examples_common.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /usb/device/dev_hid_composite/README.md: -------------------------------------------------------------------------------- 1 | This is a copy of the hid_composite example from TinyUSB (https://github.com/hathach/tinyusb/tree/master/examples/device/hid_composite) 2 | showing how to build with TinyUSB when using the Raspberry Pi Pico SDK -------------------------------------------------------------------------------- /bootloaders/encrypted/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _MBEDTLS_CONFIG_H 2 | #define _MBEDTLS_CONFIG_H 3 | 4 | #define MBEDTLS_HAVE_ASM 5 | #define MBEDTLS_AES_C 6 | #define MBEDTLS_AES_ROM_TABLES 7 | #define MBEDTLS_CIPHER_MODE_CTR 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /gpio/dht_sensor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dht 2 | dht.c 3 | ) 4 | 5 | target_link_libraries(dht pico_stdlib) 6 | 7 | pico_add_extra_outputs(dht) 8 | 9 | # add url via pico_set_program_url 10 | example_auto_set_url(dht) 11 | 12 | -------------------------------------------------------------------------------- /sha/mbedtls_sha256/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _MBEDTLS_CONFIG_H 2 | #define _MBEDTLS_CONFIG_H 3 | 4 | #if LIB_PICO_SHA256 5 | // Enable hardware acceleration 6 | #define MBEDTLS_SHA256_ALT 7 | #else 8 | #define MBEDTLS_SHA256_C 9 | #endif 10 | 11 | #endif -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/ledfail.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico post test 4 | 5 | 6 |

Pico post test

7 |

Failed to update led

8 |

Go back

9 | 10 | 11 | -------------------------------------------------------------------------------- /pico_w/bt/sine_player/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sine_player_pins INTERFACE) 2 | target_compile_definitions(sine_player_pins INTERFACE 3 | PICO_AUDIO_I2S_DATA_PIN=9 4 | PICO_AUDIO_I2S_CLOCK_PIN_BASE=10 5 | ) 6 | picow_bt_example(sine_player sine_player_pins) 7 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 404 - Page not found 4 | 5 | 6 |

404 - Page not found

7 |

Sorry, the page you are requesting was not found on this server.

8 | 9 | 10 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/ledpass.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico post test 4 | 5 | 6 |

Pico post test

7 |

Success. Led is now

8 |

Go back

9 | 10 | 11 | -------------------------------------------------------------------------------- /pico_w/bt/mod_player/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(mod_player_pins INTERFACE) 2 | target_compile_definitions(mod_player_pins INTERFACE 3 | PICO_AUDIO_I2S_DATA_PIN=9 4 | PICO_AUDIO_I2S_CLOCK_PIN_BASE=10 5 | ) 6 | picow_bt_example(mod_player pico_btstack_hxcmod_player mod_player_pins) 7 | -------------------------------------------------------------------------------- /pico_w/wifi/mqtt/certs/sub.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/bash 2 | 3 | if [ -z "$MQTT_SERVER" ]; then 4 | echo Define MQTT_SERVER 5 | exit 1 6 | fi 7 | 8 | mosquitto_sub -h $MQTT_SERVER --cafile $MQTT_SERVER/ca.crt --key $MQTT_SERVER/client.key --cert $MQTT_SERVER/client.crt -t "$1" 9 | 10 | -------------------------------------------------------------------------------- /pio/ir_nec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # build the transmit and receive libraries 2 | # 3 | add_subdirectory_exclude_platforms(nec_transmit_library) 4 | add_subdirectory_exclude_platforms(nec_receive_library) 5 | 6 | # build the example program 7 | # 8 | add_subdirectory_exclude_platforms(ir_loopback) 9 | -------------------------------------------------------------------------------- /freertos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT FREERTOS_KERNEL_PATH AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH}) 2 | message("Skipping FreeRTOS examples as FREERTOS_KERNEL_PATH not defined") 3 | return() 4 | endif() 5 | 6 | include(FreeRTOS_Kernel_import.cmake) 7 | 8 | add_subdirectory(hello_freertos) 9 | -------------------------------------------------------------------------------- /pico_w/wifi/mqtt/certs/pub.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/bash 2 | 3 | if [ -z "$MQTT_SERVER" ]; then 4 | echo Define MQTT_SERVER 5 | exit 1 6 | fi 7 | 8 | mosquitto_pub -h $MQTT_SERVER --cafile $MQTT_SERVER/ca.crt --key $MQTT_SERVER/client.key --cert $MQTT_SERVER/client.crt -t "$1" -m "$2" 9 | 10 | -------------------------------------------------------------------------------- /encrypted/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET pico_mbedtls) 2 | add_subdirectory_exclude_platforms(hello_encrypted host rp2040 rp2350-riscv) 3 | else() 4 | # Assume picotool has no signing support, if no pico_mbedtls available 5 | message("Skipping encrypted example as pico_mbedtls unavailable") 6 | endif () 7 | -------------------------------------------------------------------------------- /multicore/multicore_doorbell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(multicore_doorbell 2 | multicore_doorbell.c 3 | ) 4 | target_link_libraries(multicore_doorbell 5 | pico_stdlib 6 | pico_multicore) 7 | pico_add_extra_outputs(multicore_doorbell) 8 | example_auto_set_url(multicore_doorbell) 9 | -------------------------------------------------------------------------------- /pico_w/bt/a2dp_sink_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(a2dp_sink_demo_pins INTERFACE) 2 | target_compile_definitions(a2dp_sink_demo_pins INTERFACE 3 | PICO_AUDIO_I2S_DATA_PIN=9 4 | PICO_AUDIO_I2S_CLOCK_PIN_BASE=10 5 | ) 6 | 7 | picow_bt_example(a2dp_sink_demo pico_btstack_sbc_decoder a2dp_sink_demo_pins) 8 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/httpd/content/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico httpd example 4 | 5 | 6 |

Pico httpd example

7 |

404 - Page not found

8 |

Sorry, the page you are requesting was not found on this server.

9 | 10 | 11 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/httpd/content/test.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico cgi test 4 | 5 | 6 |

Pico cgi test

7 |

8 |

Test result:

9 |

Go back

10 | 11 | 12 | -------------------------------------------------------------------------------- /system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(boot_info host host rp2040) 2 | add_subdirectory_exclude_platforms(hello_double_tap host) 3 | add_subdirectory_exclude_platforms(narrow_io_write host) 4 | add_subdirectory_exclude_platforms(unique_board_id host) 5 | add_subdirectory_exclude_platforms(rand host) 6 | -------------------------------------------------------------------------------- /pico_w/bt/hfp_hf_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(hfp_hf_demo_pins INTERFACE) 2 | target_compile_definitions(hfp_hf_demo_pins INTERFACE 3 | PICO_AUDIO_I2S_DATA_PIN=9 4 | PICO_AUDIO_I2S_CLOCK_PIN_BASE=10 5 | ) 6 | picow_bt_example(hfp_hf_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder hfp_hf_demo_pins) 7 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/test.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico cgi handler test 4 | 5 | 6 |

Pico cgi handler test

7 |

8 |

Test result:

9 |

Go back

10 | 11 | 12 | -------------------------------------------------------------------------------- /rtc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_rtc) 2 | add_subdirectory_exclude_platforms(hello_rtc) 3 | add_subdirectory_exclude_platforms(rtc_alarm) 4 | add_subdirectory_exclude_platforms(rtc_alarm_repeat) 5 | else() 6 | message("Skipping RTC examples as hardware_rtc is unavailable on this platform") 7 | endif() 8 | -------------------------------------------------------------------------------- /adc/hello_adc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_adc 2 | hello_adc.c 3 | ) 4 | 5 | target_link_libraries(hello_adc pico_stdlib hardware_adc) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(hello_adc) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(hello_adc) 12 | -------------------------------------------------------------------------------- /dma/hello_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_dma 2 | hello_dma.c 3 | ) 4 | 5 | target_link_libraries(hello_dma pico_stdlib hardware_dma) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(hello_dma) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(hello_dma) 12 | -------------------------------------------------------------------------------- /dma/sniff_crc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sniff_crc 2 | sniff_crc.c 3 | ) 4 | 5 | target_link_libraries(sniff_crc pico_stdlib hardware_dma) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(sniff_crc) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(sniff_crc) 12 | -------------------------------------------------------------------------------- /pwm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_pwm) 2 | add_subdirectory_exclude_platforms(hello_pwm) 3 | add_subdirectory_exclude_platforms(led_fade) 4 | add_subdirectory_exclude_platforms(measure_duty_cycle) 5 | else() 6 | message("Skipping PWM examples as hardware_pwm is unavailable on this platform") 7 | endif() 8 | -------------------------------------------------------------------------------- /spi/spi_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(spi_dma 2 | spi_dma.c 3 | ) 4 | 5 | target_link_libraries(spi_dma pico_stdlib hardware_spi hardware_dma) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(spi_dma) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(spi_dma) 12 | -------------------------------------------------------------------------------- /system/rand/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(rand 2 | rand.c 3 | ) 4 | target_link_libraries(rand 5 | pico_stdlib 6 | pico_rand 7 | ) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(rand) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(rand) 14 | -------------------------------------------------------------------------------- /uart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_uart) 2 | add_subdirectory_exclude_platforms(hello_uart) 3 | add_subdirectory_exclude_platforms(lcd_uart host) 4 | add_subdirectory_exclude_platforms(uart_advanced host) 5 | else() 6 | message("Skipping UART examples as hardware_uart is unavailable on this platform") 7 | endif() -------------------------------------------------------------------------------- /example_auto_set_url.cmake: -------------------------------------------------------------------------------- 1 | set(PICO_EXAMPLE_URL_BASE "https://github.com/raspberrypi/pico-examples/tree/HEAD") 2 | macro(example_auto_set_url TARGET) 3 | file(RELATIVE_PATH URL_REL_PATH "${PICO_EXAMPLES_PATH}" "${CMAKE_CURRENT_LIST_DIR}") 4 | pico_set_program_url(${TARGET} "${PICO_EXAMPLE_URL_BASE}/${URL_REL_PATH}") 5 | endmacro() -------------------------------------------------------------------------------- /pio/onewire/ow_rom.h: -------------------------------------------------------------------------------- 1 | // Generic ROM commands for 1-Wire devices 2 | // https://www.analog.com/en/technical-articles/guide-to-1wire-communication.html 3 | // 4 | #define OW_READ_ROM 0x33 5 | #define OW_MATCH_ROM 0x55 6 | #define OW_SKIP_ROM 0xCC 7 | #define OW_ALARM_SEARCH 0xEC 8 | #define OW_SEARCH_ROM 0xF0 -------------------------------------------------------------------------------- /sha/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # todo peter fix mixture of sha256 and MBED 2 | if (TARGET pico_sha256 AND TARGET pico_mbedtls) 3 | add_subdirectory_exclude_platforms(sha256) 4 | add_subdirectory_exclude_platforms(mbedtls_sha256) 5 | else() 6 | message("Skipping SHA256 examples as pico_sha256 or pico_mbedtls unavailable") 7 | endif () 8 | -------------------------------------------------------------------------------- /system/boot_info/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(boot_info 2 | boot_info.c 3 | ) 4 | target_link_libraries(boot_info 5 | pico_stdlib 6 | ) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(boot_info) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(boot_info) 13 | -------------------------------------------------------------------------------- /usb/device/dev_lowlevel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dev_lowlevel 2 | dev_lowlevel.c 3 | ) 4 | 5 | target_link_libraries(dev_lowlevel PRIVATE pico_stdlib hardware_resets hardware_irq) 6 | pico_add_extra_outputs(dev_lowlevel) 7 | 8 | # add url via pico_set_program_url 9 | example_auto_set_url(dev_lowlevel) 10 | -------------------------------------------------------------------------------- /adc/adc_console/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(adc_console 2 | adc_console.c 3 | ) 4 | 5 | target_link_libraries(adc_console pico_stdlib hardware_adc) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(adc_console) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(adc_console) 12 | 13 | -------------------------------------------------------------------------------- /otp/hello_otp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_otp 2 | hello_otp.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_otp pico_stdlib) 7 | 8 | # create map/bin/hex/uf2 file etc. 9 | pico_add_extra_outputs(hello_otp) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_otp) 13 | -------------------------------------------------------------------------------- /pio/ir_nec/nec_transmit_library/nec_transmit.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 mjcross 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "hardware/pio.h" 9 | 10 | // public API 11 | 12 | int nec_tx_init(PIO pio, uint pin); 13 | uint32_t nec_encode_frame(uint8_t address, uint8_t data); 14 | -------------------------------------------------------------------------------- /usb/host/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FAMILY rp2040) 2 | set(BOARD pico_sdk) 3 | set(TINYUSB_FAMILY_PROJECT_NAME_PREFIX "tinyusb_host_") 4 | # Hack as some host examples use $TOP in their path 5 | set(TOP ${PICO_TINYUSB_PATH}) 6 | add_subdirectory(${PICO_TINYUSB_PATH}/examples/host tinyusb_host_examples) 7 | 8 | add_subdirectory_exclude_platforms(host_cdc_msc_hid) -------------------------------------------------------------------------------- /watchdog/hello_watchdog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_watchdog 2 | hello_watchdog.c 3 | ) 4 | 5 | target_link_libraries(hello_watchdog pico_stdlib) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(hello_watchdog) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(hello_watchdog) 12 | -------------------------------------------------------------------------------- /bootloaders/encrypted/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BgUrgQQACg== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHQCAQEEIAXAdiilH8wT07TESUzWPt+BY9+NcchvYU3xbnpK+CBNoAcGBSuBBAAK 6 | oUQDQgAEYYJtMQFGW4AB94tU3u/Qir5sRcYjBYMqCa+8gxsYd9OwMS3dqWKsnVBz 7 | dyy7bFWdJzXDMb9o20xRRd57Q9xSYw== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /encrypted/hello_encrypted/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BgUrgQQACg== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHQCAQEEIAXAdiilH8wT07TESUzWPt+BY9+NcchvYU3xbnpK+CBNoAcGBSuBBAAK 6 | oUQDQgAEYYJtMQFGW4AB94tU3u/Qir5sRcYjBYMqCa+8gxsYd9OwMS3dqWKsnVBz 7 | dyy7bFWdJzXDMb9o20xRRd57Q9xSYw== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /pico_w/wifi/iperf/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/ota_update/private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BgUrgQQACg== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHQCAQEEIAXAdiilH8wT07TESUzWPt+BY9+NcchvYU3xbnpK+CBNoAcGBSuBBAAK 6 | oUQDQgAEYYJtMQFGW4AB94tU3u/Qir5sRcYjBYMqCa+8gxsYd9OwMS3dqWKsnVBz 7 | dyy7bFWdJzXDMb9o20xRRd57Q9xSYw== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /uart/hello_uart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_uart 2 | hello_uart.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_uart pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_uart) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_uart) 13 | -------------------------------------------------------------------------------- /pico_w/wifi/ntp_client/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/ota_update/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/tcp_client/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/tcp_server/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/udp_beacon/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pico_w/wifi/wifi_scan/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pio/pwm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_pwm) 2 | 3 | pico_generate_pio_header(pio_pwm ${CMAKE_CURRENT_LIST_DIR}/pwm.pio) 4 | 5 | target_sources(pio_pwm PRIVATE pwm.c) 6 | 7 | target_link_libraries(pio_pwm PRIVATE pico_stdlib hardware_pio) 8 | pico_add_extra_outputs(pio_pwm) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_pwm) -------------------------------------------------------------------------------- /timer/hello_timer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_timer 2 | hello_timer.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_timer pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_timer) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_timer) 13 | -------------------------------------------------------------------------------- /clocks/hello_gpout/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_gpout 2 | hello_gpout.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_gpout pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_gpout) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_gpout) 13 | -------------------------------------------------------------------------------- /clocks/hello_resus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_resus 2 | hello_resus.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_resus pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_resus) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_resus) 13 | -------------------------------------------------------------------------------- /pico_w/wifi/access_point/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /pio/ir_nec/nec_receive_library/nec_receive.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 mjcross 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "hardware/pio.h" 9 | 10 | // public API 11 | 12 | int nec_rx_init(PIO pio, uint pin); 13 | bool nec_decode_frame(uint32_t sm, uint8_t *p_address, uint8_t *p_data); 14 | -------------------------------------------------------------------------------- /pio/logic_analyser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_logic_analyser) 2 | 3 | target_sources(pio_logic_analyser PRIVATE logic_analyser.c) 4 | 5 | target_link_libraries(pio_logic_analyser PRIVATE pico_stdlib hardware_pio hardware_dma) 6 | pico_add_extra_outputs(pio_logic_analyser) 7 | 8 | # add url via pico_set_program_url 9 | example_auto_set_url(pio_logic_analyser) -------------------------------------------------------------------------------- /adc/joystick_display/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(joystick_display 2 | joystick_display.c 3 | ) 4 | 5 | target_link_libraries(joystick_display pico_stdlib hardware_adc) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(joystick_display) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(joystick_display) 12 | -------------------------------------------------------------------------------- /dma/control_blocks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dma_control_blocks 2 | control_blocks.c 3 | ) 4 | 5 | target_link_libraries(dma_control_blocks pico_stdlib hardware_dma) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(dma_control_blocks) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(dma_control_blocks) 12 | -------------------------------------------------------------------------------- /hello_world/serial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_serial 2 | hello_serial.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_serial pico_stdlib) 7 | 8 | # create map/bin/hex/uf2 file etc. 9 | pico_add_extra_outputs(hello_serial) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_serial) 13 | -------------------------------------------------------------------------------- /hello_world/usb/hello_usb.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | 10 | int main() { 11 | stdio_init_all(); 12 | while (true) { 13 | printf("Hello, world!\n"); 14 | sleep_ms(1000); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hello_world/serial/hello_serial.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | 10 | int main() { 11 | stdio_init_all(); 12 | while (true) { 13 | printf("Hello, world!\n"); 14 | sleep_ms(1000); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /picoboard/blinky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picoboard_blinky 2 | blinky.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(picoboard_blinky pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(picoboard_blinky) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(picoboard_blinky) 13 | -------------------------------------------------------------------------------- /picoboard/button/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picoboard_button 2 | button.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(picoboard_button pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(picoboard_button) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(picoboard_button) 13 | -------------------------------------------------------------------------------- /spi/spi_master_slave/spi_slave/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(spi_slave 2 | spi_slave.c 3 | ) 4 | 5 | # Pull in basic dependencies 6 | target_link_libraries(spi_slave pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(spi_slave) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(spi_slave) 13 | -------------------------------------------------------------------------------- /bootloaders/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory_exclude_platforms(uart host rp2040) 2 | 3 | if (TARGET pico_mbedtls) 4 | add_subdirectory_exclude_platforms(encrypted host rp2040 rp2350-riscv) 5 | else() 6 | # Assume picotool has no signing support, if no pico_mbedtls available 7 | message("Skipping encrypted bootloader example as pico_mbedtls unavailable") 8 | endif () 9 | -------------------------------------------------------------------------------- /gpio/hello_7segment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_7segment 2 | hello_7segment.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_7segment pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_7segment) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_7segment) 13 | -------------------------------------------------------------------------------- /gpio/hello_gpio_irq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_gpio_irq 2 | hello_gpio_irq.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_gpio_irq pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_gpio_irq) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_gpio_irq) 13 | -------------------------------------------------------------------------------- /pico_w/bt/standalone/server/temp_sensor.gatt: -------------------------------------------------------------------------------- 1 | PRIMARY_SERVICE, GAP_SERVICE 2 | CHARACTERISTIC, GAP_DEVICE_NAME, READ, "picow_temp" 3 | 4 | PRIMARY_SERVICE, GATT_SERVICE 5 | CHARACTERISTIC, GATT_DATABASE_HASH, READ, 6 | 7 | PRIMARY_SERVICE, ORG_BLUETOOTH_SERVICE_ENVIRONMENTAL_SENSING 8 | CHARACTERISTIC, ORG_BLUETOOTH_CHARACTERISTIC_TEMPERATURE, READ | NOTIFY | INDICATE | DYNAMIC, 9 | -------------------------------------------------------------------------------- /spi/spi_master_slave/spi_master/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(spi_master 2 | spi_master.c 3 | ) 4 | 5 | # Pull in basic dependencies 6 | target_link_libraries(spi_master pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(spi_master) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(spi_master) 13 | -------------------------------------------------------------------------------- /system/narrow_io_write/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(narrow_io_write 2 | narrow_io_write.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(narrow_io_write pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(narrow_io_write) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(narrow_io_write) 13 | -------------------------------------------------------------------------------- /clocks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_clocks) 2 | add_subdirectory_exclude_platforms(detached_clk_peri) 3 | add_subdirectory_exclude_platforms(hello_48MHz) 4 | add_subdirectory_exclude_platforms(hello_gpout) 5 | add_subdirectory_exclude_platforms(hello_resus) 6 | else() 7 | message("Skipping clocks examples as hardware_clocks is unavailable on this platform") 8 | endif() -------------------------------------------------------------------------------- /dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_dma) 2 | add_subdirectory_exclude_platforms(channel_irq) 3 | add_subdirectory_exclude_platforms(control_blocks) 4 | add_subdirectory_exclude_platforms(hello_dma) 5 | add_subdirectory_exclude_platforms(sniff_crc) 6 | else() 7 | message("Skipping DMA examples as hardware_dma is unavailable on this platform") 8 | endif() 9 | 10 | -------------------------------------------------------------------------------- /flash/program/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(flash_program 2 | flash_program.c 3 | ) 4 | 5 | target_link_libraries(flash_program 6 | pico_stdlib 7 | hardware_flash 8 | ) 9 | 10 | # create map/bin/hex file etc. 11 | pico_add_extra_outputs(flash_program) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(flash_program) 15 | -------------------------------------------------------------------------------- /cmake/build_variants/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "other.h" 10 | 11 | int main() { 12 | stdio_init_all(); 13 | do_other(); 14 | #ifdef DO_EXTRA 15 | printf("A little extra\n"); 16 | #endif 17 | return 0; 18 | } -------------------------------------------------------------------------------- /flash/cache_perfctr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(flash_cache_perfctr 2 | flash_cache_perfctr.c 3 | ) 4 | 5 | target_link_libraries(flash_cache_perfctr 6 | pico_stdlib 7 | ) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(flash_cache_perfctr) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(flash_cache_perfctr) 14 | -------------------------------------------------------------------------------- /multicore/multicore_runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(multicore_runner 2 | multicore_runner.c 3 | ) 4 | 5 | target_link_libraries(multicore_runner 6 | pico_multicore 7 | pico_stdlib) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(multicore_runner) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(multicore_runner) -------------------------------------------------------------------------------- /pwm/hello_pwm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_pwm 2 | hello_pwm.c 3 | ) 4 | 5 | # pull in common dependencies and additional pwm hardware support 6 | target_link_libraries(hello_pwm pico_stdlib hardware_pwm) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_pwm) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_pwm) 13 | -------------------------------------------------------------------------------- /rtc/hello_rtc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_rtc 2 | hello_rtc.c 3 | ) 4 | 5 | # pull in common dependencies and additional rtc hardware support 6 | target_link_libraries(hello_rtc pico_stdlib hardware_rtc) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_rtc) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_rtc) 13 | -------------------------------------------------------------------------------- /rtc/rtc_alarm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(rtc_alarm 2 | rtc_alarm.c 3 | ) 4 | 5 | # pull in common dependencies and additional rtc hardware support 6 | target_link_libraries(rtc_alarm pico_stdlib hardware_rtc) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(rtc_alarm) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(rtc_alarm) 13 | -------------------------------------------------------------------------------- /spi/spi_flash/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(spi_flash 2 | spi_flash.c 3 | ) 4 | 5 | # pull in common dependencies and additional spi hardware support 6 | target_link_libraries(spi_flash pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(spi_flash) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(spi_flash) 13 | -------------------------------------------------------------------------------- /flash/ssi_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(flash_ssi_dma 2 | flash_ssi_dma.c 3 | ) 4 | 5 | target_link_libraries(flash_ssi_dma 6 | pico_stdlib 7 | hardware_dma 8 | hardware_sync 9 | ) 10 | 11 | # create map/bin/hex file etc. 12 | pico_add_extra_outputs(flash_ssi_dma) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(flash_ssi_dma) -------------------------------------------------------------------------------- /flash/xip_stream/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(flash_xip_stream 2 | flash_xip_stream.c 3 | ) 4 | 5 | target_link_libraries(flash_xip_stream 6 | pico_stdlib 7 | hardware_dma 8 | ) 9 | 10 | # create map/bin/hex file etc. 11 | pico_add_extra_outputs(flash_xip_stream) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(flash_xip_stream) 15 | -------------------------------------------------------------------------------- /i2c/bmp280_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(bmp280_i2c 2 | bmp280_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(bmp280_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(bmp280_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(bmp280_i2c) 13 | -------------------------------------------------------------------------------- /i2c/bus_scan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(i2c_bus_scan 2 | bus_scan.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(i2c_bus_scan pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(i2c_bus_scan) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(i2c_bus_scan) 13 | -------------------------------------------------------------------------------- /i2c/lis3dh_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(lis3dh_i2c 2 | lis3dh_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(lis3dh_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(lis3dh_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(lis3dh_i2c) 13 | -------------------------------------------------------------------------------- /i2c/mcp9808_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(mcp9808_i2c 2 | mcp9808_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(mcp9808_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(mcp9808_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(mcp9808_i2c) -------------------------------------------------------------------------------- /i2c/mma8451_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(mma8451_i2c 2 | mma8451_i2c.c 3 | ) 4 | # pull in common dependencies and additional i2c hardware support 5 | target_link_libraries(mma8451_i2c pico_stdlib hardware_i2c) 6 | 7 | # create map/bin/hex file etc. 8 | pico_add_extra_outputs(mma8451_i2c) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(mma8451_i2c) 12 | -------------------------------------------------------------------------------- /pio/onewire/ds18b20.h: -------------------------------------------------------------------------------- 1 | // Function commands for d218b20 1-Wire temperature sensor 2 | // https://www.analog.com/en/products/ds18b20.html 3 | // 4 | #define DS18B20_CONVERT_T 0x44 5 | #define DS18B20_WRITE_SCRATCHPAD 0x4e 6 | #define DS18B20_READ_SCRATCHPAD 0xbe 7 | #define DS18B20_COPY_SCRATCHPAD 0x48 8 | #define DS18B20_RECALL_EE 0xb8 9 | #define DS18B20_READ_POWER_SUPPLY 0xb4 -------------------------------------------------------------------------------- /pio/uart_tx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_uart_tx) 2 | 3 | pico_generate_pio_header(pio_uart_tx ${CMAKE_CURRENT_LIST_DIR}/uart_tx.pio) 4 | 5 | target_sources(pio_uart_tx PRIVATE uart_tx.c) 6 | 7 | target_link_libraries(pio_uart_tx PRIVATE pico_stdlib hardware_pio) 8 | pico_add_extra_outputs(pio_uart_tx) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_uart_tx) 12 | -------------------------------------------------------------------------------- /spi/bme280_spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(bme280_spi 2 | bme280_spi.c 3 | ) 4 | 5 | # pull in common dependencies and additional spi hardware support 6 | target_link_libraries(bme280_spi pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(bme280_spi) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(bme280_spi) 13 | -------------------------------------------------------------------------------- /system/unique_board_id/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(unique_board_id 2 | unique_board_id.c 3 | ) 4 | 5 | target_link_libraries(unique_board_id 6 | pico_stdlib 7 | pico_unique_id 8 | ) 9 | 10 | # create map/bin/hex file etc. 11 | pico_add_extra_outputs(unique_board_id) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(unique_board_id) 15 | -------------------------------------------------------------------------------- /i2c/ht16k33_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ht16k33_i2c 2 | ht16k33_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(ht16k33_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(ht16k33_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(ht16k33_i2c) 13 | -------------------------------------------------------------------------------- /i2c/mpu6050_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(mpu6050_i2c 2 | mpu6050_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(mpu6050_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(mpu6050_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(mpu6050_i2c) 13 | -------------------------------------------------------------------------------- /i2c/pa1010d_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pa1010d_i2c 2 | pa1010d_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(pa1010d_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(pa1010d_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(pa1010d_i2c) 13 | -------------------------------------------------------------------------------- /i2c/pcf8523_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pcf8523_i2c 2 | pcf8523_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(pcf8523_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(pcf8523_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(pcf8523_i2c) 13 | -------------------------------------------------------------------------------- /i2c/ssd1306_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ssd1306_i2c 2 | ssd1306_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(ssd1306_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(ssd1306_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(ssd1306_i2c) 13 | -------------------------------------------------------------------------------- /pico_w/bt/picow_bt_example_common.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | /* 8 | * \brief Initialise BTstack example with cyw43 9 | * 10 | * \return 0 if ok 11 | */ 12 | int picow_bt_example_init(void); 13 | 14 | /* 15 | * \brief Run the BTstack example 16 | * 17 | */ 18 | void picow_bt_example_main(void); 19 | -------------------------------------------------------------------------------- /pio/addition/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_addition) 2 | 3 | pico_generate_pio_header(pio_addition ${CMAKE_CURRENT_LIST_DIR}/addition.pio) 4 | 5 | target_sources(pio_addition PRIVATE addition.c) 6 | 7 | target_link_libraries(pio_addition PRIVATE pico_stdlib hardware_pio) 8 | pico_add_extra_outputs(pio_addition) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_addition) 12 | -------------------------------------------------------------------------------- /pio/onewire/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_onewire) 2 | 3 | target_sources(pio_onewire PRIVATE onewire.c) 4 | 5 | add_subdirectory(onewire_library) 6 | 7 | target_link_libraries(pio_onewire PRIVATE 8 | pico_stdlib 9 | hardware_pio 10 | onewire_library) 11 | 12 | pico_add_extra_outputs(pio_onewire) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(pio_onewire) 16 | -------------------------------------------------------------------------------- /pwm/led_fade/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pwm_led_fade 2 | pwm_led_fade.c 3 | ) 4 | 5 | # pull in common dependencies and additional pwm hardware support 6 | target_link_libraries(pwm_led_fade pico_stdlib hardware_pwm) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(pwm_led_fade) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(pwm_led_fade) 13 | -------------------------------------------------------------------------------- /spi/mpu9250_spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(mpu9250_spi 2 | mpu9250_spi.c 3 | ) 4 | 5 | # pull in common dependencies and additional spi hardware support 6 | target_link_libraries(mpu9250_spi pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(mpu9250_spi) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(mpu9250_spi) 13 | -------------------------------------------------------------------------------- /adc/microphone_adc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(microphone_adc 2 | microphone_adc.c 3 | ) 4 | 5 | # pull in common dependencies and adc hardware support 6 | target_link_libraries(microphone_adc pico_stdlib hardware_adc) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(microphone_adc) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(microphone_adc) 13 | -------------------------------------------------------------------------------- /cmake/build_variants/other.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "other.h" 9 | 10 | void do_other() { 11 | printf("The common thing is %d\n", 12 | A_DEFINE_THAT_IS_SHARED); 13 | printf("The binary local thing is %d\n", 14 | A_DEFINE_THAT_IS_NOT_SHARED); 15 | } -------------------------------------------------------------------------------- /i2c/lcd_1602_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(lcd_1602_i2c 2 | lcd_1602_i2c.c 3 | ) 4 | 5 | # pull in common dependencies and additional i2c hardware support 6 | target_link_libraries(lcd_1602_i2c pico_stdlib hardware_i2c) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(lcd_1602_i2c) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(lcd_1602_i2c) 13 | -------------------------------------------------------------------------------- /multicore/multicore_fifo_irqs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(multicore_fifo_irqs 2 | multicore_fifo_irqs.c 3 | ) 4 | 5 | target_link_libraries(multicore_fifo_irqs 6 | pico_multicore 7 | pico_stdlib) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(multicore_fifo_irqs) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(multicore_fifo_irqs) -------------------------------------------------------------------------------- /pico_w/wifi/freertos/httpd/content/index.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico httpd example 4 | 5 | 6 |

Pico httpd example

7 |

8 |

Uptime is seconds

9 |

CGI test

10 |

Led is click here to toggle the led 11 | 12 | 13 | -------------------------------------------------------------------------------- /blink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(blink 2 | blink.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(blink pico_stdlib) 7 | 8 | if (PICO_CYW43_SUPPORTED) 9 | target_link_libraries(blink pico_cyw43_arch_none) 10 | endif() 11 | 12 | # create map/bin/hex file etc. 13 | pico_add_extra_outputs(blink) 14 | 15 | # add url via pico_set_program_url 16 | example_auto_set_url(blink) 17 | -------------------------------------------------------------------------------- /clocks/hello_48MHz/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_48MHz 2 | hello_48MHz.c 3 | ) 4 | 5 | # pull in common dependencies and additional clocks hardware support 6 | target_link_libraries(hello_48MHz pico_stdlib hardware_clocks) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(hello_48MHz) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(hello_48MHz) 13 | -------------------------------------------------------------------------------- /clocks/detached_clk_peri/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(clocks_detached_clk_peri 2 | detached_clk_peri.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(clocks_detached_clk_peri pico_stdlib) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(clocks_detached_clk_peri) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(clocks_detached_clk_peri) 13 | -------------------------------------------------------------------------------- /uart/uart_advanced/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(uart_advanced 2 | uart_advanced.c 3 | ) 4 | 5 | # pull in common dependencies and additional uart hardware support 6 | target_link_libraries(uart_advanced pico_stdlib hardware_uart) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(uart_advanced) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(uart_advanced) 13 | -------------------------------------------------------------------------------- /adc/read_vsys/power_status/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(power_status_adc INTERFACE) 2 | target_sources(power_status_adc INTERFACE 3 | ${CMAKE_CURRENT_LIST_DIR}/power_status.c 4 | ) 5 | target_include_directories(power_status_adc INTERFACE 6 | ${CMAKE_CURRENT_LIST_DIR} 7 | ) 8 | target_link_libraries(power_status_adc INTERFACE 9 | hardware_adc 10 | hardware_gpio 11 | ) 12 | -------------------------------------------------------------------------------- /bootloaders/encrypted/hello_serial.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | 10 | int main() { 11 | stdio_init_all(); 12 | while (true) { 13 | printf("Hello, world!\n"); 14 | printf("I'm an encrypted binary\n"); 15 | sleep_ms(1000); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /multicore/multicore_runner_queue/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(multicore_runner_queue 2 | multicore_runner_queue.c 3 | ) 4 | 5 | target_link_libraries(multicore_runner_queue 6 | pico_multicore 7 | pico_stdlib) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(multicore_runner_queue) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(multicore_runner_queue) -------------------------------------------------------------------------------- /blink_simple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(blink_simple 2 | blink_simple.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(blink_simple pico_stdlib) 7 | 8 | # create map/bin/hex/uf2 file etc. 9 | pico_add_extra_outputs(blink_simple) 10 | 11 | # call pico_set_program_url to set path to example on github, so users can find the source for an example via picotool 12 | example_auto_set_url(blink_simple) 13 | -------------------------------------------------------------------------------- /pio/apa102/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_apa102) 2 | 3 | pico_generate_pio_header(pio_apa102 ${CMAKE_CURRENT_LIST_DIR}/apa102.pio) 4 | 5 | target_sources(pio_apa102 PRIVATE apa102.c) 6 | 7 | target_link_libraries(pio_apa102 PRIVATE 8 | pico_stdlib 9 | hardware_pio 10 | ) 11 | 12 | pico_add_extra_outputs(pio_apa102) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(pio_apa102) 16 | -------------------------------------------------------------------------------- /rtc/rtc_alarm_repeat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(rtc_alarm_repeat 2 | rtc_alarm_repeat.c 3 | ) 4 | 5 | # pull in common dependencies and additional rtc hardware support 6 | target_link_libraries(rtc_alarm_repeat pico_stdlib hardware_rtc) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(rtc_alarm_repeat) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(rtc_alarm_repeat) 13 | -------------------------------------------------------------------------------- /spi/max7219_32x8_spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(max7219_32x8_spi 2 | max7219_32x8_spi.c 3 | ) 4 | 5 | # pull in common dependencies and additional spi hardware support 6 | target_link_libraries(max7219_32x8_spi pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(max7219_32x8_spi) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(max7219_32x8_spi) 13 | -------------------------------------------------------------------------------- /pio/st7789_lcd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_st7789_lcd) 2 | 3 | pico_generate_pio_header(pio_st7789_lcd ${CMAKE_CURRENT_LIST_DIR}/st7789_lcd.pio) 4 | 5 | target_sources(pio_st7789_lcd PRIVATE st7789_lcd.c) 6 | 7 | target_link_libraries(pio_st7789_lcd PRIVATE pico_stdlib hardware_pio hardware_interp) 8 | pico_add_extra_outputs(pio_st7789_lcd) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_st7789_lcd) 12 | -------------------------------------------------------------------------------- /universal/hello_universal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_universal 2 | hello_universal.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(hello_universal pico_stdlib) 7 | 8 | # enable usb output and uart output 9 | pico_enable_stdio_uart(hello_universal 1) 10 | pico_enable_stdio_usb(hello_universal 1) 11 | 12 | # create map/bin/hex/uf2 file etc. 13 | pico_add_extra_outputs(hello_universal) 14 | -------------------------------------------------------------------------------- /hstx/spi_lcd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hstx_spi_lcd 2 | hstx_spi_lcd.c 3 | ) 4 | 5 | target_include_directories(hstx_spi_lcd PRIVATE 6 | ${CMAKE_CURRENT_LIST_DIR}/images 7 | ) 8 | 9 | # pull in common dependencies 10 | target_link_libraries(hstx_spi_lcd 11 | pico_stdlib 12 | pico_sync 13 | ) 14 | 15 | # create map/bin/hex/uf2 file etc. 16 | pico_add_extra_outputs(hstx_spi_lcd) 17 | -------------------------------------------------------------------------------- /spi/max7219_8x7seg_spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(max7219_8x7seg_spi 2 | max7219_8x7seg_spi.c 3 | ) 4 | 5 | # pull in common dependencies and additional spi hardware support 6 | target_link_libraries(max7219_8x7seg_spi pico_stdlib hardware_spi) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(max7219_8x7seg_spi) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(max7219_8x7seg_spi) 13 | -------------------------------------------------------------------------------- /multicore/hello_multicore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_multicore 2 | multicore.c 3 | ) 4 | 5 | # Add pico_multicore which is required for multicore functionality 6 | target_link_libraries(hello_multicore 7 | pico_stdlib 8 | pico_multicore) 9 | 10 | # create map/bin/hex file etc. 11 | pico_add_extra_outputs(hello_multicore) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(hello_multicore) -------------------------------------------------------------------------------- /pico_w/bt/gatt_counter_with_wifi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME gatt_counter) 2 | picow_bt_example_target_name(${NAME}_with_wifi TARGET_NAME) 3 | 4 | picow_bt_example_poll(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_poll pico_btstack_ble) 5 | picow_bt_example_background(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_background pico_btstack_ble) 6 | picow_bt_example_freertos(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_freertos pico_btstack_ble) 7 | -------------------------------------------------------------------------------- /pio/squarewave/squarewave.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | .pio_version 0 // only requires PIO version 0 7 | 8 | .program squarewave 9 | set pindirs, 1 ; Set pin to output 10 | again: 11 | set pins, 1 [1] ; Drive pin high and then delay for one cycle 12 | set pins, 0 ; Drive pin low 13 | jmp again ; Set PC to label `again` 14 | 15 | -------------------------------------------------------------------------------- /sha/sha256/sample.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -------------------------------------------------------------------------------- /pio/ir_nec/ir_loopback/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_ir_loopback ir_loopback.c) 2 | 3 | # link the executable using the IR transmit and receive libraries 4 | # 5 | target_link_libraries(pio_ir_loopback LINK_PUBLIC 6 | pico_stdlib 7 | hardware_pio 8 | nec_transmit_library 9 | nec_receive_library 10 | ) 11 | 12 | pico_add_extra_outputs(pio_ir_loopback) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(pio_ir_loopback) 16 | -------------------------------------------------------------------------------- /pwm/measure_duty_cycle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pwm_measure_duty_cycle 2 | measure_duty_cycle.c 3 | ) 4 | 5 | # pull in common dependencies and additional pwm hardware support 6 | target_link_libraries(pwm_measure_duty_cycle pico_stdlib hardware_pwm) 7 | 8 | # create map/bin/hex file etc. 9 | pico_add_extra_outputs(pwm_measure_duty_cycle) 10 | 11 | # add url via pico_set_program_url 12 | example_auto_set_url(pwm_measure_duty_cycle) 13 | -------------------------------------------------------------------------------- /pico_w/bt/spp_streamer_with_wifi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME spp_streamer) 2 | picow_bt_example_target_name(${NAME}_with_wifi TARGET_NAME) 3 | 4 | picow_bt_example_poll(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_poll pico_btstack_classic) 5 | picow_bt_example_background(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_background pico_btstack_classic) 6 | picow_bt_example_freertos(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_freertos pico_btstack_classic) 7 | -------------------------------------------------------------------------------- /pico_w/bt/gatt_streamer_server_with_wifi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME gatt_streamer_server) 2 | picow_bt_example_target_name(${NAME}_with_wifi TARGET_NAME) 3 | 4 | picow_bt_example_poll(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_poll pico_btstack_ble) 5 | picow_bt_example_background(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_background pico_btstack_ble) 6 | picow_bt_example_freertos(${NAME} ${TARGET_NAME} picow_bt_example_cyw43_lwip_freertos pico_btstack_ble) 7 | -------------------------------------------------------------------------------- /timer/periodic_sampler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT PICO_TIME_NO_ALARM_SUPPORT) 2 | add_executable(periodic_sampler 3 | periodic_sampler.c 4 | ) 5 | 6 | # pull in common dependencies 7 | target_link_libraries(periodic_sampler pico_stdlib) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(periodic_sampler) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(periodic_sampler) 14 | endif() 15 | -------------------------------------------------------------------------------- /flash/nuke/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(flash_nuke 2 | nuke.c 3 | ) 4 | 5 | target_link_libraries(flash_nuke 6 | pico_stdlib 7 | hardware_flash 8 | ) 9 | 10 | # It doesn't make sense to run this program from flash. Always build a 11 | # RAM-only binary. 12 | pico_set_binary_type(flash_nuke no_flash) 13 | 14 | pico_add_extra_outputs(flash_nuke) 15 | 16 | # add url via pico_set_program_url 17 | example_auto_set_url(flash_nuke) 18 | 19 | -------------------------------------------------------------------------------- /dcp/hello_dcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_dcp 2 | hello_dcp.c 3 | dcp_examples.S 4 | ) 5 | 6 | # pull in common dependencies 7 | target_link_libraries(hello_dcp pico_stdlib) 8 | 9 | # we need a high-precision printf to demonstrate dotx properly 10 | pico_set_printf_implementation(hello_dcp compiler) 11 | 12 | # create map/bin/hex file etc. 13 | pico_add_extra_outputs(hello_dcp) 14 | 15 | # add url via pico_set_program_url 16 | example_auto_set_url(hello_dcp) -------------------------------------------------------------------------------- /reset/hello_reset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_resets) 2 | add_executable(hello_reset 3 | hello_reset.c 4 | ) 5 | 6 | # pull in common dependencies and additional reset hardware support 7 | target_link_libraries(hello_reset pico_stdlib hardware_resets) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(hello_reset) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(hello_reset) 14 | endif () 15 | -------------------------------------------------------------------------------- /pico_w/bt/picow_bt_example_poll.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "btstack_run_loop.h" 8 | #include "pico/stdlib.h" 9 | #include "picow_bt_example_common.h" 10 | 11 | int main() { 12 | stdio_init_all(); 13 | 14 | int res = picow_bt_example_init(); 15 | if (res){ 16 | return -1; 17 | } 18 | 19 | picow_bt_example_main(); 20 | btstack_run_loop_execute(); 21 | } 22 | -------------------------------------------------------------------------------- /pio/manchester_encoding/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_manchester_encoding) 2 | 3 | pico_generate_pio_header(pio_manchester_encoding ${CMAKE_CURRENT_LIST_DIR}/manchester_encoding.pio) 4 | 5 | target_sources(pio_manchester_encoding PRIVATE manchester_encoding.c) 6 | 7 | target_link_libraries(pio_manchester_encoding PRIVATE pico_stdlib hardware_pio) 8 | pico_add_extra_outputs(pio_manchester_encoding) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_manchester_encoding) -------------------------------------------------------------------------------- /pico_w/wifi/access_point/dnsserver/dnsserver.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #ifndef _DNSSERVER_H_ 8 | #define _DNSSERVER_H_ 9 | 10 | #include "lwip/ip_addr.h" 11 | 12 | typedef struct dns_server_t_ { 13 | struct udp_pcb *udp; 14 | ip_addr_t ip; 15 | } dns_server_t; 16 | 17 | void dns_server_init(dns_server_t *d, ip_addr_t *ip); 18 | void dns_server_deinit(dns_server_t *d); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /pio/i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_i2c_bus_scan) 2 | 3 | pico_generate_pio_header(pio_i2c_bus_scan ${CMAKE_CURRENT_LIST_DIR}/i2c.pio) 4 | 5 | target_sources(pio_i2c_bus_scan PRIVATE 6 | i2c_bus_scan.c 7 | pio_i2c.c 8 | pio_i2c.h 9 | ) 10 | 11 | target_link_libraries(pio_i2c_bus_scan PRIVATE pico_stdlib hardware_pio) 12 | pico_add_extra_outputs(pio_i2c_bus_scan) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(pio_i2c_bus_scan) 16 | 17 | -------------------------------------------------------------------------------- /interp/hello_interp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_interp) 2 | add_executable(hello_interp 3 | hello_interp.c 4 | ) 5 | 6 | # pull in common dependencies and additional interpolator hardware support 7 | target_link_libraries(hello_interp pico_stdlib hardware_interp) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(hello_interp) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(hello_interp) 14 | endif () 15 | -------------------------------------------------------------------------------- /pico_w/bt/picow_bt_example_background.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "btstack_run_loop.h" 8 | #include "pico/stdlib.h" 9 | #include "picow_bt_example_common.h" 10 | 11 | int main() { 12 | stdio_init_all(); 13 | 14 | int res = picow_bt_example_init(); 15 | if (res){ 16 | return -1; 17 | } 18 | 19 | picow_bt_example_main(); 20 | btstack_run_loop_execute(); 21 | } 22 | -------------------------------------------------------------------------------- /pio/hub75/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_hub75) 2 | 3 | pico_generate_pio_header(pio_hub75 ${CMAKE_CURRENT_LIST_DIR}/hub75.pio) 4 | 5 | target_sources(pio_hub75 PRIVATE hub75.c) 6 | 7 | target_compile_definitions(pio_hub75 PRIVATE 8 | PICO_DEFAULT_UART_TX_PIN=28 9 | PICO_DEFAULT_UART_RX_PIN=29 10 | ) 11 | 12 | target_link_libraries(pio_hub75 PRIVATE pico_stdlib hardware_pio) 13 | pico_add_extra_outputs(pio_hub75) 14 | 15 | # add url via pico_set_program_url 16 | example_auto_set_url(pio_hub75) 17 | -------------------------------------------------------------------------------- /pio/uart_dma/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_uart_dma) 2 | pico_generate_pio_header(pio_uart_dma ${CMAKE_CURRENT_LIST_DIR}/../uart_rx/uart_rx.pio) 3 | pico_generate_pio_header(pio_uart_dma ${CMAKE_CURRENT_LIST_DIR}/../uart_tx/uart_tx.pio) 4 | target_sources(pio_uart_dma PRIVATE uart_dma.c) 5 | target_link_libraries(pio_uart_dma PRIVATE 6 | pico_stdlib 7 | hardware_pio 8 | hardware_dma 9 | ) 10 | pico_add_extra_outputs(pio_uart_dma) 11 | example_auto_set_url(pio_uart_dma) 12 | -------------------------------------------------------------------------------- /timer/timer_lowlevel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (PICO_ON_DEVICE) 2 | add_executable(timer_lowlevel 3 | timer_lowlevel.c) 4 | 5 | # Disable SDK alarm support for this lowlevel example 6 | set(PICO_TIME_DEFAULT_ALARM_POOL_DISABLED 1) 7 | 8 | target_link_libraries(timer_lowlevel pico_stdlib) 9 | 10 | # create map/bin/hex file etc. 11 | pico_add_extra_outputs(timer_lowlevel) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(timer_lowlevel) 15 | endif () -------------------------------------------------------------------------------- /adc/onboard_temperature/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(onboard_temperature onboard_temperature.c) 2 | 3 | target_link_libraries(onboard_temperature pico_stdlib hardware_adc) 4 | 5 | # enable uart output, disable usb output 6 | pico_enable_stdio_uart(onboard_temperature 1) 7 | pico_enable_stdio_usb(onboard_temperature 0) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(onboard_temperature) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(onboard_temperature) 14 | 15 | -------------------------------------------------------------------------------- /adc/read_vsys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(power_status) 2 | 3 | add_executable(read_vsys 4 | read_vsys.c 5 | ) 6 | target_include_directories(read_vsys PRIVATE 7 | ${CMAKE_CURRENT_LIST_DIR} 8 | ) 9 | target_link_libraries(read_vsys 10 | pico_stdlib 11 | power_status_adc 12 | ) 13 | if (PICO_CYW43_SUPPORTED) 14 | target_link_libraries(read_vsys 15 | pico_cyw43_arch_none 16 | ) 17 | endif() 18 | 19 | pico_add_extra_outputs(read_vsys) 20 | example_auto_set_url(read_vsys) 21 | -------------------------------------------------------------------------------- /pio/clocked_input/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_clocked_input) 2 | 3 | pico_generate_pio_header(pio_clocked_input ${CMAKE_CURRENT_LIST_DIR}/clocked_input.pio) 4 | 5 | target_sources(pio_clocked_input PRIVATE clocked_input.c) 6 | 7 | target_link_libraries(pio_clocked_input PRIVATE 8 | pico_stdlib 9 | hardware_pio 10 | hardware_spi 11 | ) 12 | 13 | pico_add_extra_outputs(pio_clocked_input) 14 | 15 | # add url via pico_set_program_url 16 | example_auto_set_url(pio_clocked_input) 17 | -------------------------------------------------------------------------------- /dma/channel_irq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dma_channel_irq 2 | channel_irq.c 3 | ) 4 | 5 | pico_generate_pio_header(dma_channel_irq ${CMAKE_CURRENT_LIST_DIR}/pio_serialiser.pio) 6 | 7 | target_link_libraries(dma_channel_irq 8 | pico_stdlib 9 | hardware_dma 10 | hardware_irq 11 | hardware_pio 12 | ) 13 | 14 | # create map/bin/hex file etc. 15 | pico_add_extra_outputs(dma_channel_irq) 16 | 17 | # add url via pico_set_program_url 18 | example_auto_set_url(dma_channel_irq) 19 | -------------------------------------------------------------------------------- /pio/differential_manchester/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_differential_manchester) 2 | 3 | pico_generate_pio_header(pio_differential_manchester ${CMAKE_CURRENT_LIST_DIR}/differential_manchester.pio) 4 | 5 | target_sources(pio_differential_manchester PRIVATE differential_manchester.c) 6 | 7 | target_link_libraries(pio_differential_manchester PRIVATE pico_stdlib hardware_pio) 8 | pico_add_extra_outputs(pio_differential_manchester) 9 | 10 | # add url via pico_set_program_url 11 | example_auto_set_url(pio_differential_manchester) -------------------------------------------------------------------------------- /pico_w/wifi/freertos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT FREERTOS_KERNEL_PATH AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH}) 2 | message("Skipping Pico W FreeRTOS examples as FREERTOS_KERNEL_PATH not defined") 3 | else() 4 | include(FreeRTOS_Kernel_import.cmake) 5 | 6 | add_subdirectory_exclude_platforms(httpd) 7 | add_subdirectory_exclude_platforms(iperf) 8 | add_subdirectory_exclude_platforms(ntp_client_socket) 9 | add_subdirectory_exclude_platforms(ping) 10 | add_subdirectory_exclude_platforms(http_client) 11 | endif() 12 | -------------------------------------------------------------------------------- /uart/lcd_uart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(lcd_uart 2 | lcd_uart.c 3 | ) 4 | 5 | # pull in common dependencies and additional uart hardware support 6 | target_link_libraries(lcd_uart pico_stdlib hardware_uart) 7 | 8 | # enable usb output and uart output 9 | # modify here as required 10 | pico_enable_stdio_usb(lcd_uart 1) 11 | pico_enable_stdio_uart(lcd_uart 1) 12 | 13 | # create map/bin/hex file etc. 14 | pico_add_extra_outputs(lcd_uart) 15 | 16 | # add url via pico_set_program_url 17 | example_auto_set_url(lcd_uart) 18 | -------------------------------------------------------------------------------- /hstx/dvi_out_hstx_encoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dvi_out_hstx_encoder 2 | dvi_out_hstx_encoder.c 3 | ) 4 | 5 | target_include_directories(dvi_out_hstx_encoder PRIVATE 6 | ${CMAKE_CURRENT_LIST_DIR}/images 7 | ) 8 | 9 | # pull in common dependencies 10 | target_link_libraries(dvi_out_hstx_encoder 11 | pico_stdlib 12 | pico_multicore 13 | hardware_dma 14 | pico_sync 15 | ) 16 | 17 | # create map/bin/hex/uf2 file etc. 18 | pico_add_extra_outputs(dvi_out_hstx_encoder) 19 | -------------------------------------------------------------------------------- /spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_spi) 2 | add_subdirectory_exclude_platforms(bme280_spi) 3 | add_subdirectory_exclude_platforms(mpu9250_spi) 4 | add_subdirectory_exclude_platforms(spi_dma) 5 | add_subdirectory_exclude_platforms(spi_master_slave) 6 | add_subdirectory_exclude_platforms(spi_flash) 7 | add_subdirectory_exclude_platforms(max7219_32x8_spi) 8 | add_subdirectory_exclude_platforms(max7219_8x7seg_spi) 9 | else() 10 | message("Skipping SPI examples as hardware_spi is unavailable on this platform") 11 | endif() -------------------------------------------------------------------------------- /adc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_adc) 2 | add_subdirectory_exclude_platforms(adc_console) 3 | add_subdirectory_exclude_platforms(dma_capture) 4 | add_subdirectory_exclude_platforms(hello_adc) 5 | add_subdirectory_exclude_platforms(joystick_display) 6 | add_subdirectory_exclude_platforms(onboard_temperature) 7 | add_subdirectory_exclude_platforms(microphone_adc) 8 | add_subdirectory_exclude_platforms(read_vsys) 9 | else() 10 | message("Skipping ADC examples as hardware_adc is unavailable on this platform") 11 | endif() -------------------------------------------------------------------------------- /adc/dma_capture/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(adc_dma_capture 2 | dma_capture.c 3 | ) 4 | 5 | pico_generate_pio_header(adc_dma_capture ${CMAKE_CURRENT_LIST_DIR}/resistor_dac.pio) 6 | 7 | target_link_libraries(adc_dma_capture 8 | pico_stdlib 9 | hardware_adc 10 | hardware_dma 11 | # For the dummy output: 12 | hardware_pio 13 | pico_multicore 14 | ) 15 | 16 | # create map/bin/hex file etc. 17 | pico_add_extra_outputs(adc_dma_capture) 18 | 19 | # add url via pico_set_program_url 20 | example_auto_set_url(adc_dma_capture) 21 | -------------------------------------------------------------------------------- /status_led/color_blink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blink the colored "status" LED connected to the GPIO defined by PICO_DEFAULT_WS2812_PIN for your board 2 | add_executable(color_blink 3 | color_blink.c 4 | ) 5 | # You can define PICO_DEFAULT_WS2812_PIN yourself to add a WS2812 led to a normal GPIO 6 | #target_compile_definitions(color_blink PRIVATE 7 | # PICO_DEFAULT_WS2812_PIN=16 8 | #) 9 | target_link_libraries(color_blink 10 | pico_stdlib 11 | pico_status_led 12 | ) 13 | pico_add_extra_outputs(color_blink) 14 | example_auto_set_url(color_blink) 15 | -------------------------------------------------------------------------------- /usb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET tinyusb_device) 2 | add_subdirectory(device) 3 | else () 4 | message("Skipping TinyUSB device examples as TinyUSB is unavailable") 5 | endif () 6 | if (TARGET tinyusb_host) 7 | add_subdirectory(host) 8 | else () 9 | message("Skipping TinyUSB host examples as TinyUSB is unavailable") 10 | endif () 11 | if (TARGET tinyusb_pico_pio_usb) 12 | add_subdirectory(dual) 13 | else () 14 | message("Skipping TinyUSB dual examples, as TinyUSB hw/mcu/raspberry_pi/Pico-PIO-USB submodule unavailable") 15 | endif () 16 | -------------------------------------------------------------------------------- /flash/partition_info/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(partition_info partition_info.c uf2_family_ids.c) 2 | 3 | target_link_libraries(partition_info PRIVATE 4 | pico_stdlib 5 | pico_bootrom 6 | hardware_flash 7 | boot_uf2_headers 8 | ) 9 | 10 | # add a partition table 11 | pico_embed_pt_in_binary(partition_info ${CMAKE_CURRENT_LIST_DIR}/pt.json) 12 | 13 | # create map/bin/hex/uf2 file etc. 14 | pico_add_extra_outputs(partition_info) 15 | 16 | # add url via pico_set_program_url 17 | example_auto_set_url(partition_info) 18 | -------------------------------------------------------------------------------- /bootloaders/uart/uart-pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": [1, 0], 3 | "unpartitioned": { 4 | "families": ["absolute"], 5 | "permissions": { 6 | "secure": "rw", 7 | "nonsecure": "rw", 8 | "bootloader": "rw" 9 | } 10 | }, 11 | "partitions": [ 12 | { 13 | "start": "128K", 14 | "size": "32K", 15 | "families": ["rp2350-arm-s", "rp2350-riscv"], 16 | "permissions": { 17 | "secure": "rw", 18 | "nonsecure": "rw", 19 | "bootloader": "rw" 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /divider/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_divider) 2 | add_executable(hello_divider 3 | hello_divider.c 4 | ) 5 | 6 | # pull in common dependencies 7 | target_link_libraries(hello_divider pico_stdlib) 8 | 9 | # create map/bin/hex file etc. 10 | pico_add_extra_outputs(hello_divider) 11 | 12 | # add url via pico_set_program_url 13 | example_auto_set_url(hello_divider) 14 | else() 15 | message("Skipping divider examples as hardware_divider is unavailable on this platform") 16 | endif() 17 | -------------------------------------------------------------------------------- /pico_w/wifi/tls_client/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | #include "lwipopts_examples_common.h" 5 | 6 | /* TCP WND must be at least 16 kb to match TLS record size 7 | or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ 8 | #undef TCP_WND 9 | #define TCP_WND 16384 10 | 11 | #define LWIP_ALTCP 1 12 | #define LWIP_ALTCP_TLS 1 13 | #define LWIP_ALTCP_TLS_MBEDTLS 1 14 | 15 | #define LWIP_DEBUG 1 16 | #define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /flash/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_flash) 2 | add_subdirectory_exclude_platforms(cache_perfctr "rp2350.*") 3 | add_subdirectory_exclude_platforms(nuke) 4 | add_subdirectory_exclude_platforms(program) 5 | add_subdirectory_exclude_platforms(ssi_dma "rp2350.*") 6 | add_subdirectory_exclude_platforms(xip_stream) 7 | add_subdirectory_exclude_platforms(runtime_flash_permissions rp2040) 8 | add_subdirectory_exclude_platforms(partition_info rp2040) 9 | else() 10 | message("Skipping flash examples as hardware_flash is unavailable on this platform") 11 | endif() 12 | -------------------------------------------------------------------------------- /multicore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET pico_multicore) 2 | add_subdirectory_exclude_platforms(hello_multicore host) 3 | # currently broken on RP2350 due to both cores sharing IRQ 4 | add_subdirectory_exclude_platforms(multicore_fifo_irqs host "rp2350.*") 5 | add_subdirectory_exclude_platforms(multicore_runner host) 6 | add_subdirectory_exclude_platforms(multicore_runner_queue host) 7 | add_subdirectory_exclude_platforms(multicore_doorbell host rp2040) 8 | else() 9 | message("Skipping multicore examples as pico_multicore is unavailable on this platform") 10 | endif() 11 | -------------------------------------------------------------------------------- /pico_w/wifi/blink/picow_blink.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "pico/cyw43_arch.h" 9 | 10 | int main() { 11 | stdio_init_all(); 12 | if (cyw43_arch_init()) { 13 | printf("Wi-Fi init failed"); 14 | return -1; 15 | } 16 | while (true) { 17 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); 18 | sleep_ms(250); 19 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); 20 | sleep_ms(250); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /binary_info/blink_any/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT PICO_CYW43_SUPPORTED) 2 | message("Only building blink_any for non W boards as PICO_CYW43_SUPPORTED is not set") 3 | endif() 4 | 5 | add_executable(blink_any 6 | blink_any.c 7 | ) 8 | 9 | # pull in common dependencies 10 | target_link_libraries(blink_any pico_stdlib) 11 | 12 | if (PICO_CYW43_SUPPORTED) 13 | target_link_libraries(blink_any pico_cyw43_arch_none) 14 | endif() 15 | 16 | # create map/bin/hex file etc. 17 | pico_add_extra_outputs(blink_any) 18 | 19 | # add url via pico_set_program_url 20 | example_auto_set_url(blink_any) 21 | -------------------------------------------------------------------------------- /i2c/slave_mem_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(slave_mem_i2c 2 | slave_mem_i2c.c 3 | ) 4 | target_link_libraries(slave_mem_i2c 5 | pico_i2c_slave 6 | hardware_i2c 7 | pico_stdlib 8 | ) 9 | pico_add_extra_outputs(slave_mem_i2c) 10 | example_auto_set_url(slave_mem_i2c) 11 | 12 | add_executable(slave_mem_i2c_burst 13 | slave_mem_i2c_burst.c 14 | ) 15 | target_link_libraries(slave_mem_i2c_burst 16 | pico_i2c_slave 17 | hardware_i2c 18 | pico_stdlib 19 | ) 20 | pico_add_extra_outputs(slave_mem_i2c_burst) 21 | example_auto_set_url(slave_mem_i2c_burst) 22 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/content/index.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pico httpd example 4 | 5 | 6 |

Pico httpd example

7 |

8 |

9 |

Uptime is seconds

10 |

CGI handler test

11 |

12 |

13 | 14 | 15 |
16 |

17 | 18 | 19 | -------------------------------------------------------------------------------- /sha/mbedtls_sha256/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET hardware_sha256) 2 | return() 3 | endif() 4 | 5 | # This example uses the mbedtls SHA-256 API 6 | # mbedtls_config.h defines MBEDTLS_SHA256_ALT enabling hardware acceleration if supported 7 | add_executable(mbedtls_sha256 8 | mbedtls_sha256.c 9 | ) 10 | target_link_libraries(mbedtls_sha256 11 | pico_stdlib 12 | pico_mbedtls 13 | ) 14 | target_include_directories(mbedtls_sha256 PRIVATE 15 | ${CMAKE_CURRENT_LIST_DIR} 16 | ) 17 | pico_add_extra_outputs(mbedtls_sha256) 18 | example_auto_set_url(mbedtls_sha256) 19 | -------------------------------------------------------------------------------- /i2c/mpl3115a2_i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(mpl3115a2_i2c 2 | mpl3115a2_i2c.c 3 | ) 4 | 5 | target_include_directories(mpl3115a2_i2c PUBLIC 6 | ${CMAKE_CURRENT_SOURCE_DIR} 7 | ) 8 | 9 | target_link_libraries(mpl3115a2_i2c 10 | pico_stdlib 11 | hardware_i2c 12 | ) 13 | 14 | # pull in common dependencies and additional i2c hardware support 15 | target_link_libraries(mpl3115a2_i2c pico_stdlib hardware_i2c) 16 | 17 | # create map/bin/hex file etc. 18 | pico_add_extra_outputs(mpl3115a2_i2c) 19 | 20 | # add url via pico_set_program_url 21 | example_auto_set_url(mpl3115a2_i2c) 22 | -------------------------------------------------------------------------------- /status_led/status_blink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Blink the "status" LED either connected to the GPIO defined by PICO_DEFAULT_LED_PIN for your board 2 | # or via the WiFi chip on boards like Pico 2 or Pico 2 W 3 | 4 | add_executable(status_blink 5 | status_blink.c 6 | ) 7 | # You can define PICO_DEFAULT_LED_PIN yourself to add a led to a different GPIO 8 | #target_compile_definitions(status_blink PRIVATE 9 | # PICO_DEFAULT_LED_PIN=15 10 | #) 11 | target_link_libraries(status_blink 12 | pico_stdlib 13 | pico_status_led 14 | ) 15 | pico_add_extra_outputs(status_blink) 16 | example_auto_set_url(status_blink) 17 | -------------------------------------------------------------------------------- /pio/quadrature_encoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_quadrature_encoder) 2 | 3 | pico_generate_pio_header(pio_quadrature_encoder ${CMAKE_CURRENT_LIST_DIR}/quadrature_encoder.pio) 4 | 5 | target_sources(pio_quadrature_encoder PRIVATE quadrature_encoder.c) 6 | 7 | target_link_libraries(pio_quadrature_encoder PRIVATE 8 | pico_stdlib 9 | pico_multicore 10 | hardware_pio 11 | ) 12 | 13 | pico_enable_stdio_usb(pio_quadrature_encoder 1) 14 | 15 | pico_add_extra_outputs(pio_quadrature_encoder) 16 | 17 | # add url via pico_set_program_url 18 | example_auto_set_url(pio_quadrature_encoder) 19 | -------------------------------------------------------------------------------- /flash/runtime_flash_permissions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(runtime_flash_permissions 2 | runtime_flash_permissions.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(runtime_flash_permissions pico_stdlib) 7 | 8 | # not necessary for the example functionality, but shows you how you would add a partition table 9 | pico_embed_pt_in_binary(runtime_flash_permissions ${CMAKE_CURRENT_LIST_DIR}/pt.json) 10 | 11 | # create map/bin/hex/uf2 file etc. 12 | pico_add_extra_outputs(runtime_flash_permissions) 13 | 14 | # add url via pico_set_program_url 15 | example_auto_set_url(runtime_flash_permissions) 16 | -------------------------------------------------------------------------------- /usb/device/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FAMILY rp2040) 2 | set(BOARD pico_sdk) 3 | set(TINYUSB_FAMILY_PROJECT_NAME_PREFIX "tinyusb_dev_") 4 | # Provide an LWIP path for net_lwip_webserver in case the module does not exist in tinyusb 5 | set(TINYUSB_LWIP_PATH ${PICO_LWIP_PATH}) 6 | # Some examples use this, and we need to set this here due to a bug in the TinyUSB CMake config 7 | set(TOP ${PICO_TINYUSB_PATH}) 8 | add_subdirectory(${PICO_TINYUSB_PATH}/examples/device tinyusb_device_examples) 9 | add_subdirectory_exclude_platforms(dev_hid_composite) 10 | add_subdirectory_exclude_platforms(dev_lowlevel) 11 | add_subdirectory_exclude_platforms(dev_multi_cdc) 12 | -------------------------------------------------------------------------------- /pico_w/bt/config/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #if !NO_SYS 11 | #define TCPIP_THREAD_STACKSIZE 1024 12 | #define DEFAULT_THREAD_STACKSIZE 1024 13 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 14 | #define TCPIP_MBOX_SIZE 8 15 | #define LWIP_TIMEVAL_PRIVATE 0 16 | 17 | // not necessary, can be done either way 18 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /pio/pio_blink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_blink) 2 | 3 | # by default the header is generated into the build dir 4 | pico_generate_pio_header(pio_blink ${CMAKE_CURRENT_LIST_DIR}/blink.pio) 5 | # however, alternatively you can choose to generate it somewhere else (in this case in the source tree for check in) 6 | #pico_generate_pio_header(pio_blink ${CMAKE_CURRENT_LIST_DIR}/blink.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}) 7 | 8 | target_sources(pio_blink PRIVATE blink.c) 9 | 10 | target_link_libraries(pio_blink PRIVATE pico_stdlib hardware_pio) 11 | pico_add_extra_outputs(pio_blink) 12 | 13 | # add url via pico_set_program_url 14 | example_auto_set_url(pio_blink) -------------------------------------------------------------------------------- /flash/partition_info/uf2_family_ids.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "pico/stdlib.h" 8 | #include "boot/picobin.h" 9 | #include "boot/uf2.h" 10 | 11 | 12 | #define PARTITION_EXTRA_FAMILY_ID_MAX 3 13 | 14 | typedef struct { 15 | size_t count; 16 | char **items; 17 | } uf2_family_ids_t; 18 | 19 | 20 | uf2_family_ids_t *uf2_family_ids_new(uint32_t flags); 21 | char *uf2_family_ids_join(const uf2_family_ids_t *ids, const char *sep); 22 | void uf2_family_ids_free(uf2_family_ids_t *ids); 23 | 24 | void uf2_family_ids_add_extra_family_id(uf2_family_ids_t *ids, uint32_t family_id); 25 | -------------------------------------------------------------------------------- /pio/hello_pio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_pio) 2 | 3 | pico_generate_pio_header(hello_pio ${CMAKE_CURRENT_LIST_DIR}/hello.pio) 4 | 5 | target_sources(hello_pio PRIVATE hello.c) 6 | 7 | target_link_libraries(hello_pio PRIVATE 8 | pico_stdlib 9 | hardware_pio 10 | ) 11 | 12 | # Pass cmake -DHELLO_PIO_LED_PIN=x, where x is the pin you want to use 13 | if(HELLO_PIO_LED_PIN) 14 | target_compile_definitions(hello_pio PRIVATE 15 | HELLO_PIO_LED_PIN=${HELLO_PIO_LED_PIN} 16 | ) 17 | endif() 18 | 19 | pico_add_extra_outputs(hello_pio) 20 | 21 | # add url via pico_set_program_url 22 | example_auto_set_url(hello_pio) 23 | -------------------------------------------------------------------------------- /ide/vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // These settings tweaks to the cmake plugin will ensure 3 | // that you debug using cortex-debug instead of trying to launch 4 | // a Pico binary on the host 5 | "cmake.statusbar.advanced": { 6 | "debug": { 7 | "visibility": "hidden" 8 | }, 9 | "launch": { 10 | "visibility": "hidden" 11 | }, 12 | "build": { 13 | "visibility": "hidden" 14 | }, 15 | "buildTarget": { 16 | "visibility": "hidden" 17 | } 18 | }, 19 | "cmake.buildBeforeRun": true, 20 | "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" 21 | } -------------------------------------------------------------------------------- /pio/spi/pio_spi.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | #ifndef _PIO_SPI_H 7 | #define _PIO_SPI_H 8 | 9 | #include "hardware/pio.h" 10 | #include "spi.pio.h" 11 | 12 | typedef struct pio_spi_inst { 13 | PIO pio; 14 | uint sm; 15 | uint cs_pin; 16 | } pio_spi_inst_t; 17 | 18 | void pio_spi_write8_blocking(const pio_spi_inst_t *spi, const uint8_t *src, size_t len); 19 | 20 | void pio_spi_read8_blocking(const pio_spi_inst_t *spi, uint8_t *dst, size_t len); 21 | 22 | void pio_spi_write8_read8_blocking(const pio_spi_inst_t *spi, uint8_t *src, uint8_t *dst, size_t len); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /pio/onewire/onewire_library/onewire_library.h: -------------------------------------------------------------------------------- 1 | #ifndef _ONEWIRE_LIBRARY_H 2 | #define _ONEWIRE_LIBRARY_H 3 | 4 | #include "hardware/pio.h" 5 | #include "hardware/clocks.h" // for clock_get_hz() in generated header 6 | #include "onewire_library.pio.h" // generated by pioasm 7 | 8 | typedef struct { 9 | PIO pio; 10 | uint sm; 11 | uint jmp_reset; 12 | int offset; 13 | int gpio; 14 | } OW; 15 | 16 | bool ow_init (OW *ow, PIO pio, uint offset, uint gpio); 17 | void ow_send (OW *ow, uint data); 18 | uint8_t ow_read (OW *ow); 19 | bool ow_reset (OW *ow); 20 | int ow_romsearch (OW *ow, uint64_t *romcodes, int maxdevs, uint command); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /pio/squarewave/squarewave_fast.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | ; Note that if you modify squarewave.c to include this program, you'll also 8 | ; need to set the wrap registers yourself. This would be handled for you by 9 | ; squarewave_program_get_default_config(). 10 | .pio_version 0 // only requires PIO version 0 11 | 12 | .program squarewave_fast 13 | ; Like squarewave_wrap, but remove the delay cycles so we can run twice as fast. 14 | set pindirs, 1 ; Set pin to output 15 | .wrap_target 16 | set pins, 1 ; Drive pin high 17 | set pins, 0 ; Drive pin low 18 | .wrap 19 | 20 | -------------------------------------------------------------------------------- /hello_world/usb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET tinyusb_device) 2 | add_executable(hello_usb 3 | hello_usb.c 4 | ) 5 | 6 | # pull in common dependencies 7 | target_link_libraries(hello_usb pico_stdlib) 8 | 9 | # enable usb output, disable uart output 10 | pico_enable_stdio_usb(hello_usb 1) 11 | pico_enable_stdio_uart(hello_usb 0) 12 | 13 | # create map/bin/hex/uf2 file etc. 14 | pico_add_extra_outputs(hello_usb) 15 | 16 | # add url via pico_set_program_url 17 | example_auto_set_url(hello_usb) 18 | elseif(PICO_ON_DEVICE) 19 | message("Skipping hello_usb because TinyUSB submodule is not initialized in the SDK") 20 | endif() 21 | -------------------------------------------------------------------------------- /pio/onewire/onewire_library/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(onewire_library INTERFACE) 2 | target_sources(onewire_library INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/onewire_library.c) 3 | 4 | # invoke pio_asm to assemble the state machine programs 5 | # 6 | pico_generate_pio_header(onewire_library ${CMAKE_CURRENT_LIST_DIR}/onewire_library.pio) 7 | 8 | target_link_libraries(onewire_library INTERFACE 9 | pico_stdlib 10 | hardware_pio 11 | ) 12 | 13 | # add the `binary` directory so that the generated headers are included in the project 14 | # 15 | target_include_directories(onewire_library INTERFACE 16 | ${CMAKE_CURRENT_SOURCE_DIR} 17 | ${CMAKE_CURRENT_BINARY_DIR} 18 | ) 19 | -------------------------------------------------------------------------------- /status_led/status_blink/status_blink.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2025 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "pico/status_led.h" 9 | 10 | #ifndef LED_DELAY_MS 11 | #define LED_DELAY_MS 250 12 | #endif 13 | 14 | int main() { 15 | bool rc = status_led_init(); 16 | hard_assert(rc); 17 | while (true) { 18 | status_led_set_state(true); 19 | sleep_ms(LED_DELAY_MS); 20 | assert(status_led_get_state()); 21 | status_led_set_state(false); 22 | sleep_ms(LED_DELAY_MS); 23 | assert(!status_led_get_state()); 24 | } 25 | status_led_deinit(); 26 | } 27 | -------------------------------------------------------------------------------- /i2c/ssd1306_i2c/raspberry26x32.h: -------------------------------------------------------------------------------- 1 | #define IMG_WIDTH 26 2 | #define IMG_HEIGHT 32 3 | 4 | static uint8_t raspberry26x32[] = { 0x0, 0x0, 0xe, 0x7e, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7e, 0x1e, 0x0, 0x0, 0x0, 0x80, 0xe0, 0xf8, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf8, 0xe0, 0x80, 0x0, 0x0, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1e, 0x0, 0x0, 0x0, 0x3, 0x7, 0xf, 0x1f, 0x1f, 0x3f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0xf, 0x7, 0x3, 0x0, 0x0}; 5 | -------------------------------------------------------------------------------- /pio/ir_nec/nec_receive_library/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nec_receive_library INTERFACE) 2 | 3 | target_sources(nec_receive_library INTERFACE 4 | ${CMAKE_CURRENT_LIST_DIR}/nec_receive.c) 5 | 6 | # invoke pio_asm to assemble the state machine program 7 | # 8 | pico_generate_pio_header(nec_receive_library ${CMAKE_CURRENT_LIST_DIR}/nec_receive.pio) 9 | 10 | target_link_libraries(nec_receive_library INTERFACE 11 | pico_stdlib 12 | hardware_pio 13 | ) 14 | 15 | # add the `binary` directory so that the generated headers are included in the project 16 | # 17 | target_include_directories (nec_receive_library INTERFACE 18 | ${CMAKE_CURRENT_SOURCE_DIR} 19 | ${CMAKE_CURRENT_BINARY_DIR} 20 | ) 21 | -------------------------------------------------------------------------------- /binary_info/hello_anything/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET tinyusb_device) 2 | add_executable(hello_anything 3 | hello_anything.c 4 | ) 5 | 6 | # pull in common dependencies 7 | target_link_libraries(hello_anything pico_stdlib) 8 | 9 | # enable usb and uart output 10 | pico_enable_stdio_usb(hello_anything 1) 11 | pico_enable_stdio_uart(hello_anything 1) 12 | 13 | # create map/bin/hex/uf2 file etc. 14 | pico_add_extra_outputs(hello_anything) 15 | 16 | # add url via pico_set_program_url 17 | example_auto_set_url(hello_anything) 18 | elseif(PICO_ON_DEVICE) 19 | message("Skipping hello_anything because TinyUSB submodule is not initialized in the SDK") 20 | endif() 21 | -------------------------------------------------------------------------------- /system/hello_double_tap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(hello_double_tap 2 | hello_double_tap.c 3 | ) 4 | 5 | # Double tap reset into bootrom is injected by linking with the 6 | # pico_bootsel_via_double_reset library 7 | target_link_libraries(hello_double_tap 8 | pico_stdlib 9 | pico_bootsel_via_double_reset 10 | ) 11 | 12 | # Entering the bootloader in this way also lets us specify a GPIO to be used 13 | # as a bootloader activity LED: 14 | target_compile_definitions(hello_double_tap PRIVATE 15 | PICO_BOOTSEL_VIA_DOUBLE_RESET_ACTIVITY_LED=25 16 | ) 17 | 18 | pico_add_extra_outputs(hello_double_tap) 19 | 20 | # add url via pico_set_program_url 21 | example_auto_set_url(hello_double_tap) 22 | -------------------------------------------------------------------------------- /i2c/mpl3115a2_i2c/mpl3115a2_i2c.h: -------------------------------------------------------------------------------- 1 | // mpl3115a2.h 2 | #ifndef _MPL3115A2_H 3 | #define _MPL3115A2_H 4 | 5 | #include "pico/stdlib.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | struct mpl3115a2_data_t { 12 | // Q8.4 fixed point 13 | float temperature; 14 | // Q16.4 fixed-point 15 | float altitude; 16 | }; 17 | 18 | void mpl3115a2_init(void); 19 | void mpl3115a2_read_fifo(volatile uint8_t* fifo_buf); 20 | void mpl3115a2_convert_fifo_batch(uint8_t start, volatile uint8_t* buf, struct mpl3115a2_data_t* data); 21 | 22 | // Add NEW prototypes 23 | void mpl3115a2_set_sealevel_pressure(float hPa); 24 | float mpl3115a2_get_sealevel_pressure(void); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // _MPL3115A2_H -------------------------------------------------------------------------------- /pico_w/wifi/freertos/iperf/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #if !NO_SYS 11 | #define TCPIP_THREAD_STACKSIZE 1024 12 | #define DEFAULT_THREAD_STACKSIZE 1024 13 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 14 | #define TCPIP_MBOX_SIZE 8 15 | #define LWIP_TIMEVAL_PRIVATE 0 16 | 17 | // not necessary, can be done either way 18 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 19 | 20 | // ping_thread sets socket receive timeout, so enable this feature 21 | #define LWIP_SO_RCVTIMEO 1 22 | #endif 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/ping/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #if !NO_SYS 11 | #define TCPIP_THREAD_STACKSIZE 1024 12 | #define DEFAULT_THREAD_STACKSIZE 2048 13 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 14 | #define TCPIP_MBOX_SIZE 8 15 | #define LWIP_TIMEVAL_PRIVATE 0 16 | 17 | // not necessary, can be done either way 18 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 19 | 20 | // ping_thread sets socket receive timeout, so enable this feature 21 | #define LWIP_SO_RCVTIMEO 1 22 | #endif 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /pio/squarewave/squarewave_wrap.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | ; Note that if you modify squarewave.c to include this program, you'll also 8 | ; need to set the wrap registers yourself. This would be handled for you by 9 | ; squarewave_program_get_default_config(). 10 | .pio_version 0 // only requires PIO version 0 11 | 12 | .program squarewave_wrap 13 | ; Like squarewave, but use the state machine's .wrap hardware instead of an 14 | ; explicit jmp. This is a free (0-cycle) unconditional jump. 15 | 16 | set pindirs, 1 ; Set pin to output 17 | .wrap_target 18 | set pins, 1 [1] ; Drive pin high and then delay for one cycle 19 | set pins, 0 [1] ; Drive pin low and then delay for one cycle 20 | .wrap 21 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/ntp_client_socket/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #if !NO_SYS 11 | #define TCPIP_THREAD_STACKSIZE 1024 12 | #define DEFAULT_THREAD_STACKSIZE 1024 13 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 14 | #define DEFAULT_UDP_RECVMBOX_SIZE 8 15 | #define DEFAULT_TCP_RECVMBOX_SIZE 8 16 | #define TCPIP_MBOX_SIZE 8 17 | #define LWIP_TIMEVAL_PRIVATE 0 18 | 19 | // not necessary, can be done either way 20 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 21 | 22 | #define LWIP_SO_RCVTIMEO 1 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /pico_w/bt/standalone/server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Standalone example that reads from the on board temperature sensor and sends notifications via BLE 2 | # Flashes slowly each second to show it's running 3 | add_executable(picow_ble_temp_sensor 4 | server.c 5 | ) 6 | target_link_libraries(picow_ble_temp_sensor 7 | pico_stdlib 8 | pico_btstack_ble 9 | pico_btstack_cyw43 10 | pico_cyw43_arch_none 11 | hardware_adc 12 | ) 13 | target_include_directories(picow_ble_temp_sensor PRIVATE 14 | ${CMAKE_CURRENT_LIST_DIR} 15 | ${CMAKE_CURRENT_LIST_DIR}/.. # For our common btstack config 16 | ) 17 | pico_btstack_make_gatt_header(picow_ble_temp_sensor PRIVATE "${CMAKE_CURRENT_LIST_DIR}/temp_sensor.gatt") 18 | 19 | pico_add_extra_outputs(picow_ble_temp_sensor) 20 | example_auto_set_url(picow_ble_temp_sensor) 21 | -------------------------------------------------------------------------------- /pio/ir_nec/nec_transmit_library/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nec_transmit_library INTERFACE) 2 | 3 | target_sources(nec_transmit_library INTERFACE 4 | ${CMAKE_CURRENT_LIST_DIR}/nec_transmit.c) 5 | 6 | # invoke pio_asm to assemble the PIO state machine programs 7 | # 8 | pico_generate_pio_header(nec_transmit_library ${CMAKE_CURRENT_LIST_DIR}/nec_carrier_burst.pio) 9 | pico_generate_pio_header(nec_transmit_library ${CMAKE_CURRENT_LIST_DIR}/nec_carrier_control.pio) 10 | 11 | target_link_libraries(nec_transmit_library INTERFACE 12 | pico_stdlib 13 | hardware_pio 14 | ) 15 | 16 | # add the `binary` directory so that the generated headers are included in the project 17 | # 18 | target_include_directories (nec_transmit_library INTERFACE 19 | ${CMAKE_CURRENT_SOURCE_DIR} 20 | ${CMAKE_CURRENT_BINARY_DIR} 21 | ) 22 | -------------------------------------------------------------------------------- /reset/hello_reset/hello_reset.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/resets.h" 10 | 11 | /// \tag::hello_reset[] 12 | int main() { 13 | stdio_init_all(); 14 | 15 | printf("Hello, reset!\n"); 16 | 17 | // Put the PWM block into reset 18 | reset_block_num(RESET_PWM); 19 | 20 | // And bring it out 21 | unreset_block_num_wait_blocking(RESET_PWM); 22 | 23 | // Put the PWM and ADC block into reset 24 | reset_block_mask((1u << RESET_PWM) | (1u << RESET_ADC)); 25 | 26 | // Wait for both to come out of reset 27 | unreset_block_mask_wait_blocking((1u << RESET_PWM) | (1u << RESET_ADC)); 28 | 29 | return 0; 30 | } 31 | /// \end::hello_reset[] 32 | -------------------------------------------------------------------------------- /clocks/hello_gpout/hello_gpout.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/clocks.h" 10 | 11 | 12 | int main() { 13 | stdio_init_all(); 14 | printf("Hello gpout\n"); 15 | 16 | // Output clk_sys / 10 to gpio 21, etc... 17 | clock_gpio_init(21, CLOCKS_CLK_GPOUT0_CTRL_AUXSRC_VALUE_CLK_SYS, 10); 18 | clock_gpio_init(23, CLOCKS_CLK_GPOUT1_CTRL_AUXSRC_VALUE_CLK_USB, 10); 19 | clock_gpio_init(24, CLOCKS_CLK_GPOUT2_CTRL_AUXSRC_VALUE_CLK_ADC, 10); 20 | #if PICO_RP2040 21 | clock_gpio_init(25, CLOCKS_CLK_GPOUT3_CTRL_AUXSRC_VALUE_CLK_RTC, 10); 22 | #else 23 | clock_gpio_init(25, CLOCKS_CLK_GPOUT3_CTRL_AUXSRC_VALUE_CLK_PERI, 10); 24 | #endif 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /pio/quadrature_encoder_substep/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_quadrature_encoder_substep) 2 | 3 | pico_generate_pio_header(pio_quadrature_encoder_substep ${CMAKE_CURRENT_LIST_DIR}/quadrature_encoder_substep.pio) 4 | 5 | target_sources(pio_quadrature_encoder_substep PRIVATE quadrature_encoder_substep.c) 6 | 7 | target_link_libraries(pio_quadrature_encoder_substep PRIVATE 8 | pico_stdlib 9 | pico_multicore 10 | hardware_pio 11 | hardware_pwm 12 | hardware_watchdog 13 | ) 14 | 15 | target_compile_definitions(pio_quadrature_encoder_substep PRIVATE PICO_STDIO_USB_DEFAULT_CRLF=0) 16 | pico_enable_stdio_usb(pio_quadrature_encoder_substep 1) 17 | 18 | pico_add_extra_outputs(pio_quadrature_encoder_substep) 19 | 20 | # add url via pico_set_program_url 21 | example_auto_set_url(pio_quadrature_encoder_substep) 22 | -------------------------------------------------------------------------------- /pico_w/bt/pan_lwip_http_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(pan_lwip_dhserver INTERFACE) 2 | target_sources(pan_lwip_dhserver INTERFACE 3 | ${BTSTACK_3RD_PARTY_PATH}/lwip/dhcp-server/dhserver.c 4 | ) 5 | target_include_directories(pan_lwip_dhserver INTERFACE 6 | ${BTSTACK_3RD_PARTY_PATH}/lwip/dhcp-server 7 | ) 8 | 9 | picow_bt_example_target_name(pan_lwip_http_server TARGET_NAME) 10 | 11 | picow_bt_example_poll(pan_lwip_http_server ${TARGET_NAME} picow_bt_example_btstack_lwip_poll pan_lwip_dhserver pico_lwip_http pico_btstack_classic) 12 | picow_bt_example_background(pan_lwip_http_server ${TARGET_NAME} picow_bt_example_btstack_lwip_background pan_lwip_dhserver pico_lwip_http pico_btstack_classic) 13 | picow_bt_example_freertos(pan_lwip_http_server ${TARGET_NAME} picow_bt_example_btstack_lwip_freertos pan_lwip_dhserver pico_lwip_http pico_btstack_classic) 14 | -------------------------------------------------------------------------------- /bootloaders/encrypted/enc-pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": [1, 0], 3 | "unpartitioned": { 4 | "families": ["absolute"], 5 | "permissions": { 6 | "secure": "rw", 7 | "nonsecure": "rw", 8 | "bootloader": "rw" 9 | } 10 | }, 11 | "partitions": [ 12 | { 13 | "name": "A", 14 | "id": 0, 15 | "start": "64K", 16 | "size": "448K", 17 | "families": ["rp2350-arm-s"], 18 | "permissions": { 19 | "secure": "rw", 20 | "nonsecure": "rw", 21 | "bootloader": "rw" 22 | } 23 | }, 24 | { 25 | "name": "B", 26 | "id": 1, 27 | "size": "448K", 28 | "families": ["rp2350-arm-s"], 29 | "permissions": { 30 | "secure": "rw", 31 | "nonsecure": "rw", 32 | "bootloader": "rw" 33 | }, 34 | "link": ["a", 0] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /pio/spi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_spi_flash) 2 | 3 | pico_generate_pio_header(pio_spi_flash ${CMAKE_CURRENT_LIST_DIR}/spi.pio) 4 | 5 | target_sources(pio_spi_flash PRIVATE 6 | spi_flash.c 7 | pio_spi.c 8 | pio_spi.h 9 | ) 10 | 11 | target_link_libraries(pio_spi_flash PRIVATE pico_stdlib hardware_pio) 12 | pico_add_extra_outputs(pio_spi_flash) 13 | 14 | example_auto_set_url(pio_spi_flash) 15 | 16 | add_executable(pio_spi_loopback) 17 | 18 | pico_generate_pio_header(pio_spi_loopback ${CMAKE_CURRENT_LIST_DIR}/spi.pio) 19 | 20 | target_sources(pio_spi_loopback PRIVATE 21 | spi_loopback.c 22 | pio_spi.c 23 | pio_spi.h 24 | ) 25 | 26 | target_link_libraries(pio_spi_loopback PRIVATE pico_stdlib hardware_pio) 27 | pico_add_extra_outputs(pio_spi_loopback) 28 | 29 | example_auto_set_url(pio_spi_loopback) 30 | -------------------------------------------------------------------------------- /i2c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_i2c) 2 | add_subdirectory_exclude_platforms(bmp280_i2c) 3 | add_subdirectory_exclude_platforms(bus_scan) 4 | add_subdirectory_exclude_platforms(lcd_1602_i2c) 5 | add_subdirectory_exclude_platforms(lis3dh_i2c) 6 | add_subdirectory_exclude_platforms(mcp9808_i2c) 7 | add_subdirectory_exclude_platforms(mma8451_i2c) 8 | add_subdirectory_exclude_platforms(mpl3115a2_i2c) 9 | add_subdirectory_exclude_platforms(mpu6050_i2c) 10 | add_subdirectory_exclude_platforms(ssd1306_i2c) 11 | add_subdirectory_exclude_platforms(pa1010d_i2c) 12 | add_subdirectory_exclude_platforms(pcf8523_i2c) 13 | add_subdirectory_exclude_platforms(ht16k33_i2c) 14 | add_subdirectory_exclude_platforms(slave_mem_i2c) 15 | else() 16 | message("Skipping I2C examples as hardware_i2c is unavailable on this platform") 17 | endif() 18 | -------------------------------------------------------------------------------- /adc/hello_adc/hello_adc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/gpio.h" 10 | #include "hardware/adc.h" 11 | 12 | int main() { 13 | stdio_init_all(); 14 | printf("ADC Example, measuring GPIO26\n"); 15 | 16 | adc_init(); 17 | 18 | // Make sure GPIO is high-impedance, no pullups etc 19 | adc_gpio_init(26); 20 | // Select ADC input 0 (GPIO26) 21 | adc_select_input(0); 22 | 23 | while (1) { 24 | // 12-bit conversion, assume max value == ADC_VREF == 3.3 V 25 | const float conversion_factor = 3.3f / (1 << 12); 26 | uint16_t result = adc_read(); 27 | printf("Raw value: 0x%03x, voltage: %f V\n", result, result * conversion_factor); 28 | sleep_ms(500); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /usb/device/dev_multi_cdc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | add_executable(dev_multi_cdc) 4 | 5 | target_sources(dev_multi_cdc PUBLIC 6 | ${CMAKE_CURRENT_LIST_DIR}/main.c 7 | ${CMAKE_CURRENT_LIST_DIR}/usb_descriptors.c 8 | ) 9 | 10 | # Make sure TinyUSB can find tusb_config.h 11 | target_include_directories(dev_multi_cdc PUBLIC 12 | ${CMAKE_CURRENT_LIST_DIR}) 13 | 14 | # In addition to pico_stdlib required for common PicoSDK functionality, add dependency on tinyusb_device 15 | # for TinyUSB device support and tinyusb_board for the additional board support library used by the example 16 | target_link_libraries(dev_multi_cdc PUBLIC pico_stdlib pico_unique_id tinyusb_device tinyusb_board) 17 | 18 | pico_enable_stdio_usb(dev_multi_cdc 1) 19 | pico_add_extra_outputs(dev_multi_cdc) 20 | 21 | # add url via pico_set_program_url 22 | example_auto_set_url(dev_multi_cdc) 23 | -------------------------------------------------------------------------------- /dma/channel_irq/pio_serialiser.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | .program pio_serialiser 8 | 9 | ; Just serialise a stream of bits. Take 32 bits from each FIFO record. LSB-first. 10 | 11 | .wrap_target 12 | out pins, 1 13 | .wrap 14 | 15 | % c-sdk { 16 | static inline void pio_serialiser_program_init(PIO pio, uint sm, uint offset, uint data_pin, float clk_div) { 17 | pio_gpio_init(pio, data_pin); 18 | pio_sm_set_consecutive_pindirs(pio, sm, data_pin, 1, true); 19 | pio_sm_config c = pio_serialiser_program_get_default_config(offset); 20 | sm_config_set_out_pins(&c, data_pin, 1); 21 | sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); 22 | sm_config_set_clkdiv(&c, clk_div); 23 | sm_config_set_out_shift(&c, true, true, 32); 24 | pio_sm_init(pio, sm, offset, &c); 25 | pio_sm_set_enabled(pio, sm, true); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /pico_w/bt/standalone/client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Standalone example that connects to picow_ble_temp_sensor and reads the temperature 2 | # Flahes once quickly each second when it's running but not connected to another device 3 | # Flashes twice quickly each second when connected to another device and reading it's temperature 4 | add_executable(picow_ble_temp_reader 5 | client.c 6 | ) 7 | target_link_libraries(picow_ble_temp_reader 8 | pico_stdlib 9 | pico_btstack_ble 10 | pico_btstack_cyw43 11 | pico_cyw43_arch_none 12 | hardware_adc 13 | ) 14 | target_include_directories(picow_ble_temp_reader PRIVATE 15 | ${CMAKE_CURRENT_LIST_DIR} 16 | ${CMAKE_CURRENT_LIST_DIR}/.. # For our common btstack config 17 | ) 18 | target_compile_definitions(picow_ble_temp_reader PRIVATE 19 | RUNNING_AS_CLIENT=1 20 | ) 21 | 22 | pico_add_extra_outputs(picow_ble_temp_reader) 23 | example_auto_set_url(picow_ble_temp_reader) 24 | -------------------------------------------------------------------------------- /ide/vscode/launch-remote-openocd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Pico Debug", 6 | "type":"cortex-debug", 7 | "cwd": "${workspaceRoot}", 8 | "executable": "${command:cmake.launchTargetPath}", 9 | "request": "launch", 10 | "servertype": "external", 11 | // This may need to be "arm-none-eabi-gdb" for older builds 12 | "gdbPath" : "gdb-multiarch", 13 | // Connect to an already running OpenOCD instance 14 | "gdbTarget": "your-openocd:3333", 15 | "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", 16 | "runToEntryPoint": "main", 17 | // Work around for stopping at main on restart 18 | "postRestartCommands": [ 19 | "break main", 20 | "continue" 21 | ] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | // The following is needed to test mDns 11 | #define LWIP_MDNS_RESPONDER 1 12 | #define LWIP_IGMP 1 13 | #define LWIP_NUM_NETIF_CLIENT_DATA 1 14 | #define MDNS_RESP_USENETIF_EXTCALLBACK 1 15 | #define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 3) 16 | #define MEMP_NUM_TCP_PCB 12 17 | 18 | // Enable some httpd features 19 | #define LWIP_HTTPD_CGI 1 20 | #define LWIP_HTTPD_SSI 1 21 | #define LWIP_HTTPD_SSI_MULTIPART 1 22 | #define LWIP_HTTPD_SUPPORT_POST 1 23 | #define LWIP_HTTPD_SSI_INCLUDE_TAG 0 24 | 25 | // Generated file containing html data 26 | #define HTTPD_FSDATA_FILE "pico_fsdata.inc" 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /pico_w/wifi/wifi_scan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_wifi_scan_background 2 | picow_wifi_scan.c 3 | ) 4 | target_include_directories(picow_wifi_scan_background PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR} 6 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 7 | ) 8 | target_link_libraries(picow_wifi_scan_background 9 | pico_cyw43_arch_lwip_threadsafe_background 10 | pico_stdlib 11 | ) 12 | 13 | pico_add_extra_outputs(picow_wifi_scan_background) 14 | 15 | add_executable(picow_wifi_scan_poll 16 | picow_wifi_scan.c 17 | ) 18 | target_include_directories(picow_wifi_scan_poll PRIVATE 19 | ${CMAKE_CURRENT_LIST_DIR} 20 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 21 | ) 22 | target_link_libraries(picow_wifi_scan_poll 23 | pico_cyw43_arch_lwip_poll 24 | pico_stdlib 25 | ) 26 | pico_add_extra_outputs(picow_wifi_scan_poll) 27 | 28 | -------------------------------------------------------------------------------- /pio/uart_rx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(pio_uart_rx) 2 | 3 | pico_generate_pio_header(pio_uart_rx ${CMAKE_CURRENT_LIST_DIR}/uart_rx.pio) 4 | 5 | target_sources(pio_uart_rx PRIVATE uart_rx.c) 6 | 7 | target_link_libraries(pio_uart_rx PRIVATE 8 | pico_stdlib 9 | pico_multicore 10 | hardware_pio 11 | ) 12 | 13 | pico_add_extra_outputs(pio_uart_rx) 14 | 15 | # add url via pico_set_program_url 16 | example_auto_set_url(pio_uart_rx) 17 | 18 | # Similar to above but uses an interrupt for RX 19 | add_executable(pio_uart_rx_intr) 20 | pico_generate_pio_header(pio_uart_rx_intr ${CMAKE_CURRENT_LIST_DIR}/uart_rx.pio) 21 | target_sources(pio_uart_rx_intr PRIVATE uart_rx_intr.c) 22 | target_link_libraries(pio_uart_rx_intr PRIVATE 23 | pico_stdlib 24 | pico_multicore 25 | hardware_pio 26 | pico_async_context_threadsafe_background 27 | ) 28 | pico_add_extra_outputs(pio_uart_rx_intr) 29 | example_auto_set_url(pio_uart_rx_intr) 30 | -------------------------------------------------------------------------------- /usb/host/host_cdc_msc_hid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | add_executable(host_cdc_msc_hid) 4 | 5 | # Example source 6 | target_sources(host_cdc_msc_hid PUBLIC 7 | ${CMAKE_CURRENT_LIST_DIR}/hid_app.c 8 | ${CMAKE_CURRENT_LIST_DIR}/main.c 9 | ${CMAKE_CURRENT_LIST_DIR}/msc_app.c 10 | ${CMAKE_CURRENT_LIST_DIR}/cdc_app.c 11 | ) 12 | 13 | # Make sure TinyUSB can find tusb_config.h 14 | target_include_directories(host_cdc_msc_hid PUBLIC 15 | ${CMAKE_CURRENT_LIST_DIR}) 16 | 17 | # In addition to pico_stdlib required for common PicoSDK functionality, add dependency on tinyusb_host 18 | # for TinyUSB device support and tinyusb_board for the additional board support library used by the example 19 | target_link_libraries(host_cdc_msc_hid PUBLIC pico_stdlib tinyusb_host tinyusb_board) 20 | 21 | pico_add_extra_outputs(host_cdc_msc_hid) 22 | 23 | # add url via pico_set_program_url 24 | example_auto_set_url(host_cdc_msc_hid) 25 | -------------------------------------------------------------------------------- /system/hello_double_tap/hello_double_tap.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | 9 | // This is a regular old LED blinking example, however it is linked with the 10 | // `pico_bootsel_via_double_reset` library, so resetting the board twice 11 | // quickly will enter the USB bootloader. This is useful for boards which have 12 | // a reset button but no BOOTSEL, as long as you remember to always link the 13 | // `pico_bootsel_via_double_reset` library! 14 | 15 | int main() { 16 | #ifdef PICO_DEFAULT_LED_PIN 17 | const uint LED_PIN = PICO_DEFAULT_LED_PIN; 18 | gpio_init(LED_PIN); 19 | gpio_set_dir(LED_PIN, GPIO_OUT); 20 | while (true) { 21 | gpio_put(LED_PIN, 1); 22 | sleep_ms(250); 23 | gpio_put(LED_PIN, 0); 24 | sleep_ms(250); 25 | } 26 | #else 27 | while (true) { 28 | sleep_ms(250); 29 | } 30 | #endif 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/pr-check.yml: -------------------------------------------------------------------------------- 1 | name: Make sure PRs target the develop branch 2 | 3 | on: 4 | pull_request_target: 5 | 6 | # By default, pull_request_target gets write permissions to the repo - this prevents that 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | check-branch: 12 | if: github.event.pull_request.base.ref == 'master' 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Add comment 16 | uses: actions/github-script@v7 17 | with: 18 | script: | 19 | github.rest.issues.createComment({ 20 | issue_number: context.issue.number, 21 | owner: context.repo.owner, 22 | repo: context.repo.repo, 23 | body: 'Please do not submit against `master`, use `develop` instead' 24 | }) 25 | - name: Throw error 26 | run: | 27 | echo "::error title=wrong-branch::Please do not submit against 'master', use 'develop' instead" 28 | exit 1 29 | -------------------------------------------------------------------------------- /adc/read_vsys/power_status/power_status.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2023 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #ifndef POWER_STATUS_H 8 | #define POWER_STATUS_H 9 | 10 | /*! 11 | * \brief Get power source 12 | * 13 | * Returns whether battery powered 14 | * \note On boards that support Wi-Fi you must have called cyw43_arch_init first 15 | * 16 | * \param battery_powered True if powered by battery, False if powered by USB or another means 17 | * \return Zero if the battery status can be determined, an error code otherwise \see pico_error_codes 18 | */ 19 | 20 | int power_source(bool *battery_powered); 21 | 22 | /*! 23 | * \brief Get system voltage 24 | * 25 | * Returns the system voltage 26 | * \note Must have called adc_init 27 | * 28 | * \param voltage Calculated voltage 29 | * \return Zero if the voltage can be determined, an error code otherwise \see pico_error_codes 30 | */ 31 | int power_voltage(float *voltage); 32 | 33 | #endif -------------------------------------------------------------------------------- /pico_w/wifi/http_client/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | /* TCP WND must be at least 16 kb to match TLS record size 11 | or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ 12 | #undef TCP_WND 13 | #define TCP_WND 16384 14 | 15 | #define LWIP_ALTCP 1 16 | 17 | // If you don't want to use TLS (just a http request) you can avoid linking to mbedtls and remove the following 18 | #define LWIP_ALTCP_TLS 1 19 | #define LWIP_ALTCP_TLS_MBEDTLS 1 20 | 21 | // Note bug in lwip with LWIP_ALTCP and LWIP_DEBUG 22 | // https://savannah.nongnu.org/bugs/index.php?62159 23 | //#define LWIP_DEBUG 1 24 | #undef LWIP_DEBUG 25 | #define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /ide/vscode/launch-raspberrypi-swd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Pico Debug", 6 | "cwd": "${workspaceRoot}", 7 | "executable": "${command:cmake.launchTargetPath}", 8 | "request": "launch", 9 | "type": "cortex-debug", 10 | "servertype": "openocd", 11 | // This may need to be "arm-none-eabi-gdb" for some previous builds 12 | "gdbPath" : "gdb-multiarch", 13 | "device": "RP2040", 14 | "configFiles": [ 15 | "interface/raspberrypi-swd.cfg", 16 | "target/rp2040.cfg" 17 | ], 18 | "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", 19 | "runToEntryPoint": "main", 20 | // Work around for stopping at main on restart 21 | "postRestartCommands": [ 22 | "break main", 23 | "continue" 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /watchdog/hello_watchdog/hello_watchdog.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/watchdog.h" 10 | 11 | int main() { 12 | stdio_init_all(); 13 | 14 | if (watchdog_enable_caused_reboot()) { 15 | printf("Rebooted by Watchdog!\n"); 16 | return 0; 17 | } else { 18 | printf("Clean boot\n"); 19 | } 20 | 21 | // Enable the watchdog, requiring the watchdog to be updated every 100ms or the chip will reboot 22 | // second arg is pause on debug which means the watchdog will pause when stepping through code 23 | watchdog_enable(100, 1); 24 | 25 | for (uint i = 0; i < 5; i++) { 26 | printf("Updating watchdog %d\n", i); 27 | watchdog_update(); 28 | } 29 | 30 | // Wait in an infinite loop and don't update the watchdog so it reboots us 31 | printf("Waiting to be rebooted by watchdog\n"); 32 | while(1); 33 | } 34 | -------------------------------------------------------------------------------- /pio/addition/addition.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "pico/stdlib.h" 11 | #include "hardware/pio.h" 12 | #include "addition.pio.h" 13 | 14 | // Pop quiz: how many additions does the processor do when calling this function 15 | uint32_t do_addition(PIO pio, uint sm, uint32_t a, uint32_t b) { 16 | pio_sm_put_blocking(pio, sm, a); 17 | pio_sm_put_blocking(pio, sm, b); 18 | return pio_sm_get_blocking(pio, sm); 19 | } 20 | 21 | int main() { 22 | stdio_init_all(); 23 | 24 | PIO pio = pio0; 25 | uint sm = 0; 26 | uint offset = pio_add_program(pio, &addition_program); 27 | addition_program_init(pio, sm, offset); 28 | 29 | printf("Doing some random additions:\n"); 30 | for (int i = 0; i < 10; ++i) { 31 | uint a = rand() % 100; 32 | uint b = rand() % 100; 33 | printf("%u + %u = %u\n", a, b, do_addition(pio, sm, a, b)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /usb/device/dev_multi_cdc/tusb_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2023 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #ifndef _TUSB_CONFIG_H_ 8 | #define _TUSB_CONFIG_H_ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define CFG_TUD_ENABLED (1) 15 | 16 | // Legacy RHPORT configuration 17 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_FULL_SPEED) 18 | #ifndef BOARD_TUD_RHPORT 19 | #define BOARD_TUD_RHPORT (0) 20 | #endif 21 | // end legacy RHPORT 22 | 23 | //------------------------ 24 | // DEVICE CONFIGURATION // 25 | //------------------------ 26 | 27 | // Enable 2 CDC classes 28 | #define CFG_TUD_CDC (2) 29 | // Set CDC FIFO buffer sizes 30 | #define CFG_TUD_CDC_RX_BUFSIZE (64) 31 | #define CFG_TUD_CDC_TX_BUFSIZE (64) 32 | #define CFG_TUD_CDC_EP_BUFSIZE (64) 33 | 34 | #ifndef CFG_TUD_ENDPOINT0_SIZE 35 | #define CFG_TUD_ENDPOINT0_SIZE (64) 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _TUSB_CONFIG_H_ */ 43 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/ntp_client_socket/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_freertos_ntp_client_socket 2 | picow_freertos_ntp_client_socket.c 3 | ) 4 | target_compile_definitions(picow_freertos_ntp_client_socket PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | NO_SYS=0 # don't want NO_SYS (generally this would be in your lwipopts.h) 8 | LWIP_SOCKET=1 # we need the socket API (generally this would be in your lwipopts.h) 9 | ) 10 | target_include_directories(picow_freertos_ntp_client_socket PRIVATE 11 | ${CMAKE_CURRENT_LIST_DIR} 12 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common FreeRTOSConfig 13 | ${CMAKE_CURRENT_LIST_DIR}/../.. # for our common lwipopts 14 | ) 15 | target_link_libraries(picow_freertos_ntp_client_socket 16 | pico_cyw43_arch_lwip_sys_freertos 17 | pico_stdlib 18 | FreeRTOS-Kernel-Heap4 # FreeRTOS kernel and dynamic heap 19 | ) 20 | pico_add_extra_outputs(picow_freertos_ntp_client_socket) 21 | -------------------------------------------------------------------------------- /pio/i2c/pio_i2c.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | #ifndef _PIO_I2C_H 7 | #define _PIO_I2C_H 8 | 9 | #include "i2c.pio.h" 10 | 11 | // ---------------------------------------------------------------------------- 12 | // Low-level functions 13 | 14 | void pio_i2c_start(PIO pio, uint sm); 15 | void pio_i2c_stop(PIO pio, uint sm); 16 | void pio_i2c_repstart(PIO pio, uint sm); 17 | 18 | bool pio_i2c_check_error(PIO pio, uint sm); 19 | void pio_i2c_resume_after_error(PIO pio, uint sm); 20 | 21 | // If I2C is ok, block and push data. Otherwise fall straight through. 22 | void pio_i2c_put_or_err(PIO pio, uint sm, uint16_t data); 23 | uint8_t pio_i2c_get(PIO pio, uint sm); 24 | 25 | // ---------------------------------------------------------------------------- 26 | // Transaction-level functions 27 | 28 | int pio_i2c_write_blocking(PIO pio, uint sm, uint8_t addr, uint8_t *txbuf, uint len); 29 | int pio_i2c_read_blocking(PIO pio, uint sm, uint8_t addr, uint8_t *rxbuf, uint len); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /pico_w/wifi/mqtt/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Need more memory for TLS 5 | #ifdef MQTT_CERT_INC 6 | #define MEM_SIZE 8000 7 | #endif 8 | 9 | // Generally you would define your own explicit list of lwIP options 10 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 11 | // 12 | // This example uses a common include to avoid repetition 13 | #include "lwipopts_examples_common.h" 14 | 15 | #define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL+1) 16 | 17 | #ifdef MQTT_CERT_INC 18 | #define LWIP_ALTCP 1 19 | #define LWIP_ALTCP_TLS 1 20 | #define LWIP_ALTCP_TLS_MBEDTLS 1 21 | #ifndef NDEBUG 22 | #define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON 23 | #endif 24 | /* TCP WND must be at least 16 kb to match TLS record size 25 | or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ 26 | #undef TCP_WND 27 | #define TCP_WND 16384 28 | #endif // MQTT_CERT_INC 29 | 30 | // This defaults to 4 31 | #define MQTT_REQ_MAX_IN_FLIGHT 5 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /pio/addition/addition.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | .pio_version 0 // only requires PIO version 0 7 | .program addition 8 | 9 | ; Pop two 32 bit integers from the TX FIFO, add them together, and push the 10 | ; result to the TX FIFO. Autopush/pull should be disabled as we're using 11 | ; explicit push and pull instructions. 12 | ; 13 | ; This program uses the two's complement identity x + y == ~(~x - y) 14 | 15 | pull 16 | mov x, ~osr 17 | pull 18 | mov y, osr 19 | jmp test ; this loop is equivalent to the following C code: 20 | incr: ; while (y--) 21 | jmp x-- test ; x--; 22 | test: ; This has the effect of subtracting y from x, eventually. 23 | jmp y-- incr 24 | mov isr, ~x 25 | push 26 | 27 | % c-sdk { 28 | static inline void addition_program_init(PIO pio, uint sm, uint offset) { 29 | pio_sm_config c = addition_program_get_default_config(offset); 30 | pio_sm_init(pio, sm, offset, &c); 31 | pio_sm_set_enabled(pio, sm, true); 32 | } 33 | %} 34 | -------------------------------------------------------------------------------- /system/unique_board_id/unique_board_id.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | 9 | #include "pico/stdlib.h" 10 | #include "pico/unique_id.h" 11 | 12 | // RP2040 does not have a unique on-board ID, but this is a standard feature 13 | // on the NOR flash it boots from. There is a 1:1 association between RP2040 14 | // and the flash, so this can be used to get a 64 bit globally unique board ID 15 | // for an RP2040-based board, including Pico. 16 | // 17 | // The pico_unique_id library retrieves this unique identifier during boot and 18 | // stores it in memory, where it can be accessed at any time without 19 | // disturbing the flash XIP hardware. 20 | 21 | int main() { 22 | stdio_init_all(); 23 | 24 | pico_unique_board_id_t board_id; 25 | pico_get_unique_board_id(&board_id); 26 | 27 | printf("Unique identifier:"); 28 | for (int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; ++i) { 29 | printf(" %02x", board_id.id[i]); 30 | } 31 | printf("\n"); 32 | } 33 | -------------------------------------------------------------------------------- /usb/device/dev_hid_composite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | add_executable(dev_hid_composite) 4 | 5 | target_sources(dev_hid_composite PUBLIC 6 | ${CMAKE_CURRENT_LIST_DIR}/main.c 7 | ${CMAKE_CURRENT_LIST_DIR}/usb_descriptors.c 8 | ) 9 | 10 | # Make sure TinyUSB can find tusb_config.h 11 | target_include_directories(dev_hid_composite PUBLIC 12 | ${CMAKE_CURRENT_LIST_DIR}) 13 | 14 | # In addition to pico_stdlib required for common PicoSDK functionality, add dependency on tinyusb_device 15 | # for TinyUSB device support and tinyusb_board for the additional board support library used by the example 16 | target_link_libraries(dev_hid_composite PUBLIC pico_stdlib pico_unique_id tinyusb_device tinyusb_board) 17 | 18 | # Uncomment this line to enable fix for Errata RP2040-E5 (the fix requires use of GPIO 15) 19 | #target_compile_definitions(dev_hid_composite PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1) 20 | 21 | pico_add_extra_outputs(dev_hid_composite) 22 | 23 | # add url via pico_set_program_url 24 | example_auto_set_url(dev_hid_composite) 25 | -------------------------------------------------------------------------------- /ide/vscode/launch-probe-swd.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Pico Debug", 6 | "cwd": "${workspaceRoot}", 7 | "executable": "${command:cmake.launchTargetPath}", 8 | "request": "launch", 9 | "type": "cortex-debug", 10 | "servertype": "openocd", 11 | // This may need to be "arm-none-eabi-gdb" for some previous builds 12 | "gdbPath" : "gdb-multiarch", 13 | "device": "RP2040", 14 | "configFiles": [ 15 | // This may need to be "interface/picoprobe.cfg" for some previous builds 16 | "interface/cmsis-dap.cfg", 17 | "target/rp2040.cfg" 18 | ], 19 | "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", 20 | "runToEntryPoint": "main", 21 | // Work around for stopping at main on restart 22 | "postRestartCommands": [ 23 | "break main", 24 | "continue" 25 | ] 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /pio/pio_blink/blink.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | ; SET pin 0 should be mapped to your LED GPIO 8 | 9 | .pio_version 0 // only requires PIO version 0 10 | 11 | .program blink 12 | pull block 13 | out y, 32 14 | .wrap_target 15 | mov x, y 16 | set pins, 1 ; Turn LED on 17 | lp1: 18 | jmp x-- lp1 ; Delay for (x + 1) cycles, x is a 32 bit number 19 | mov x, y 20 | set pins, 0 ; Turn LED off 21 | lp2: 22 | jmp x-- lp2 ; Delay for the same number of cycles again 23 | .wrap ; Blink forever! 24 | 25 | 26 | % c-sdk { 27 | // this is a raw helper function for use by the user which sets up the GPIO output, and configures the SM to output on a particular pin 28 | 29 | void blink_program_init(PIO pio, uint sm, uint offset, uint pin) { 30 | pio_gpio_init(pio, pin); 31 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 32 | pio_sm_config c = blink_program_get_default_config(offset); 33 | sm_config_set_set_pins(&c, pin, 1); 34 | pio_sm_init(pio, sm, offset, &c); 35 | } 36 | %} 37 | -------------------------------------------------------------------------------- /pico_w/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w 4 | if (NOT TARGET pico_cyw43_arch) 5 | message("Skipping Pico W examples as support is not available") 6 | else() 7 | 8 | if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) 9 | set(WIFI_SSID $ENV{WIFI_SSID}) 10 | message("Using WIFI_SSID from environment ('${WIFI_SSID}')") 11 | endif() 12 | 13 | if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) 14 | set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) 15 | message("Using WIFI_PASSWORD from environment") 16 | endif() 17 | 18 | set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") 19 | set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") 20 | 21 | add_subdirectory(wifi) 22 | if (NOT TARGET pico_btstack_base) 23 | message("Skipping Pico W Bluetooth examples as support is not available") 24 | else() 25 | add_subdirectory(bt) 26 | endif() 27 | endif() 28 | endif() 29 | -------------------------------------------------------------------------------- /flash/partition_info/pt.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": [1, 0], 3 | "unpartitioned": { 4 | "families": ["absolute"], 5 | "permissions": { 6 | "secure": "rw", 7 | "nonsecure": "rw", 8 | "bootloader": "rw" 9 | } 10 | }, 11 | "partitions": [ 12 | { 13 | "name": "Firmware", 14 | "id": 1, 15 | "start": 0, 16 | "size": "512K", 17 | "families": ["rp2350-arm-ns", "rp2350-arm-s", "rp2350-riscv", "0x12345678"], 18 | "permissions": { 19 | "secure": "rw", 20 | "nonsecure": "rw", 21 | "bootloader": "rw" 22 | } 23 | }, 24 | { 25 | "name": "Data", 26 | "id": 2, 27 | "size": "512K", 28 | "families": ["data"], 29 | "permissions": { 30 | "secure": "rw", 31 | "nonsecure": "rw", 32 | "bootloader": "rw" 33 | } 34 | }, 35 | { 36 | "name": "Read only Data", 37 | "id": 3, 38 | "size": "512K", 39 | "families": ["data"], 40 | "permissions": { 41 | "secure": "r", 42 | "nonsecure": "r", 43 | "bootloader": "r" 44 | } 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /pico_w/wifi/blink/picow_blink_fast_clock.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2024 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "pico/cyw43_arch.h" 9 | #include "pico/cyw43_driver.h" 10 | #include "hardware/clocks.h" 11 | 12 | int main() { 13 | // Increase sys clock. We have slowed down the cyw43 pio to compensate using CYW43_PIO_CLOCK_DIV_INT=4 CYW43_PIO_CLOCK_DIV_FRAC=0 in the cmake file 14 | // By default the pio used to communicate with cyw43 runs with a clock divisor of 2 15 | // if you modify the clock you will have to compensate for this 16 | // As an alternative you could specify CYW43_PIO_CLOCK_DIV_DYNAMIC=1 in your cmake file and call cyw43_set_pio_clock_divisor(4, 0) 17 | set_sys_clock_khz(266000, true); 18 | 19 | stdio_init_all(); 20 | if (cyw43_arch_init()) { 21 | printf("Wi-Fi init failed"); 22 | return -1; 23 | } 24 | while (true) { 25 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); 26 | sleep_ms(250); 27 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); 28 | sleep_ms(250); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/httpd/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | // The following is needed to test mDns 11 | #define LWIP_MDNS_RESPONDER 1 12 | #define LWIP_IGMP 1 13 | #define LWIP_NUM_NETIF_CLIENT_DATA 1 14 | #define MDNS_RESP_USENETIF_EXTCALLBACK 1 15 | #define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 3) 16 | #define MEMP_NUM_TCP_PCB 12 17 | 18 | // Enable cgi and ssi 19 | #define LWIP_HTTPD_CGI 1 20 | #define LWIP_HTTPD_SSI 1 21 | #define LWIP_HTTPD_SSI_MULTIPART 1 22 | 23 | #if !NO_SYS 24 | #define TCPIP_THREAD_STACKSIZE 2048 // mDNS needs more stack 25 | #define DEFAULT_THREAD_STACKSIZE 1024 26 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 27 | #define TCPIP_MBOX_SIZE 8 28 | #define LWIP_TIMEVAL_PRIVATE 0 29 | 30 | // not necessary, can be done either way 31 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 32 | #endif 33 | 34 | #define HTTPD_FSDATA_FILE "pico_fsdata.inc" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /pwm/hello_pwm/hello_pwm.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | // Output PWM signals on pins 0 and 1 8 | 9 | #include "pico/stdlib.h" 10 | #include "hardware/pwm.h" 11 | 12 | int main() { 13 | /// \tag::setup_pwm[] 14 | 15 | // Tell GPIO 0 and 1 they are allocated to the PWM 16 | gpio_set_function(0, GPIO_FUNC_PWM); 17 | gpio_set_function(1, GPIO_FUNC_PWM); 18 | 19 | // Find out which PWM slice is connected to GPIO 0 (it's slice 0) 20 | uint slice_num = pwm_gpio_to_slice_num(0); 21 | 22 | // Set period of 4 cycles (0 to 3 inclusive) 23 | pwm_set_wrap(slice_num, 3); 24 | // Set channel A output high for one cycle before dropping 25 | pwm_set_chan_level(slice_num, PWM_CHAN_A, 1); 26 | // Set initial B output high for three cycles before dropping 27 | pwm_set_chan_level(slice_num, PWM_CHAN_B, 3); 28 | // Set the PWM running 29 | pwm_set_enabled(slice_num, true); 30 | /// \end::setup_pwm[] 31 | 32 | // Note we could also use pwm_set_gpio_level(gpio, x) which looks up the 33 | // correct slice and channel for a given GPIO. 34 | } 35 | -------------------------------------------------------------------------------- /bootloaders/uart/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(uart_boot 2 | uart_boot.c 3 | ) 4 | 5 | # pull in common dependencies 6 | target_link_libraries(uart_boot pico_stdlib hardware_flash) 7 | 8 | # add partition table 9 | pico_embed_pt_in_binary(uart_boot ${CMAKE_CURRENT_LIST_DIR}/uart-pt.json) 10 | 11 | # create absolute UF2, as it's a bootloader so shouldn't go in a partition 12 | pico_set_uf2_family(uart_boot "absolute") 13 | 14 | # create map/bin/hex file etc. 15 | pico_add_extra_outputs(uart_boot) 16 | 17 | # add url via pico_set_program_url 18 | example_auto_set_url(uart_boot) 19 | 20 | 21 | # Create separate binary to be loaded onto other device 22 | add_executable(uart_binary 23 | uart_binary.c 24 | ) 25 | 26 | # pull in common dependencies 27 | target_link_libraries(uart_binary pico_stdlib) 28 | 29 | pico_set_binary_type(uart_binary no_flash) 30 | 31 | # package uf2 in flash 32 | pico_package_uf2_output(uart_binary) 33 | 34 | # create map/bin/hex/uf2 file etc. 35 | pico_add_extra_outputs(uart_binary) 36 | 37 | # call pico_set_program_url to set path to example on github, so users can find the source for an example via picotool 38 | example_auto_set_url(uart_binary) 39 | -------------------------------------------------------------------------------- /usb/host/host_cdc_msc_hid/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018, hathach (tinyusb.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /multicore/hello_multicore/multicore.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "pico/multicore.h" 10 | 11 | #define FLAG_VALUE 123 12 | 13 | void core1_entry() { 14 | 15 | multicore_fifo_push_blocking(FLAG_VALUE); 16 | 17 | uint32_t g = multicore_fifo_pop_blocking(); 18 | 19 | if (g != FLAG_VALUE) 20 | printf("Hmm, that's not right on core 1!\n"); 21 | else 22 | printf("Its all gone well on core 1!"); 23 | 24 | while (1) 25 | tight_loop_contents(); 26 | } 27 | 28 | int main() { 29 | stdio_init_all(); 30 | printf("Hello, multicore!\n"); 31 | 32 | /// \tag::setup_multicore[] 33 | 34 | multicore_launch_core1(core1_entry); 35 | 36 | // Wait for it to start up 37 | 38 | uint32_t g = multicore_fifo_pop_blocking(); 39 | 40 | if (g != FLAG_VALUE) 41 | printf("Hmm, that's not right on core 0!\n"); 42 | else { 43 | multicore_fifo_push_blocking(FLAG_VALUE); 44 | printf("It's all gone well on core 0!"); 45 | } 46 | 47 | /// \end::setup_multicore[] 48 | } 49 | -------------------------------------------------------------------------------- /pico_w/wifi/access_point/dhcpserver/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2022 Damien P. George 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /pio/hello_pio/hello.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | .pio_version 0 // only requires PIO version 0 7 | 8 | .program hello 9 | 10 | ; Repeatedly get one word of data from the TX FIFO, stalling when the FIFO is 11 | ; empty. Write the least significant bit to the OUT pin group. 12 | 13 | loop: 14 | pull 15 | out pins, 1 16 | jmp loop 17 | 18 | % c-sdk { 19 | static inline void hello_program_init(PIO pio, uint sm, uint offset, uint pin) { 20 | pio_sm_config c = hello_program_get_default_config(offset); 21 | 22 | // Map the state machine's OUT pin group to one pin, namely the `pin` 23 | // parameter to this function. 24 | sm_config_set_out_pins(&c, pin, 1); 25 | // Set this pin's GPIO function (connect PIO to the pad) 26 | pio_gpio_init(pio, pin); 27 | // Set the pin direction to output at the PIO 28 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 29 | 30 | // Load our configuration, and jump to the start of the program 31 | pio_sm_init(pio, sm, offset, &c); 32 | // Set the state machine running 33 | pio_sm_set_enabled(pio, sm, true); 34 | } 35 | %} 36 | -------------------------------------------------------------------------------- /usb/device/dev_hid_composite/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018, hathach (tinyusb.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /blink_simple/blink_simple.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | 9 | #ifndef LED_DELAY_MS 10 | #define LED_DELAY_MS 250 11 | #endif 12 | 13 | #ifndef PICO_DEFAULT_LED_PIN 14 | #warning blink_simple example requires a board with a regular LED 15 | #endif 16 | 17 | // Initialize the GPIO for the LED 18 | void pico_led_init(void) { 19 | #ifdef PICO_DEFAULT_LED_PIN 20 | // A device like Pico that uses a GPIO for the LED will define PICO_DEFAULT_LED_PIN 21 | // so we can use normal GPIO functionality to turn the led on and off 22 | gpio_init(PICO_DEFAULT_LED_PIN); 23 | gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); 24 | #endif 25 | } 26 | 27 | // Turn the LED on or off 28 | void pico_set_led(bool led_on) { 29 | #if defined(PICO_DEFAULT_LED_PIN) 30 | // Just set the GPIO on or off 31 | gpio_put(PICO_DEFAULT_LED_PIN, led_on); 32 | #endif 33 | } 34 | 35 | int main() { 36 | pico_led_init(); 37 | while (true) { 38 | pico_set_led(true); 39 | sleep_ms(LED_DELAY_MS); 40 | pico_set_led(false); 41 | sleep_ms(LED_DELAY_MS); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pico_w/wifi/blink/picow_blink_slow_clock.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2024 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "pico/cyw43_arch.h" 9 | #include "pico/cyw43_driver.h" 10 | #include "hardware/clocks.h" 11 | 12 | int main() { 13 | // Slow the sys clock down and speed up the cyw43 pio to compensate 14 | // By default the pio used to communicate with cyw43 runs with a clock divisor of 2 15 | // if you modify the clock you will have to compensate for this 16 | // As an alternative you could specify CYW43_PIO_CLOCK_DIV_INT=x CYW43_PIO_CLOCK_DIV_FRAC=y in your cmake file 17 | // To call cyw43_set_pio_clock_divisor you have to add CYW43_PIO_CLOCK_DIV_DYNAMIC=1 to your cmake file 18 | set_sys_clock_khz(18000, true); 19 | cyw43_set_pio_clock_divisor(1, 0); 20 | 21 | stdio_init_all(); 22 | if (cyw43_arch_init()) { 23 | printf("Wi-Fi init failed"); 24 | return -1; 25 | } 26 | while (true) { 27 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); 28 | sleep_ms(250); 29 | cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); 30 | sleep_ms(250); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pio/pwm/pwm.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | ; Side-set pin 0 is used for PWM output 8 | .pio_version 0 // only requires PIO version 0 9 | 10 | .program pwm 11 | .side_set 1 opt 12 | 13 | pull noblock side 0 ; Pull from FIFO to OSR if available, else copy X to OSR. 14 | mov x, osr ; Copy most-recently-pulled value back to scratch X 15 | mov y, isr ; ISR contains PWM period. Y used as counter. 16 | countloop: 17 | jmp x!=y noset ; Set pin high if X == Y, keep the two paths length matched 18 | jmp skip side 1 19 | noset: 20 | nop ; Single dummy cycle to keep the two paths the same length 21 | skip: 22 | jmp y-- countloop ; Loop until Y hits 0, then pull a fresh PWM value from FIFO 23 | 24 | % c-sdk { 25 | static inline void pwm_program_init(PIO pio, uint sm, uint offset, uint pin) { 26 | pio_gpio_init(pio, pin); 27 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 28 | pio_sm_config c = pwm_program_get_default_config(offset); 29 | sm_config_set_sideset_pins(&c, pin); 30 | pio_sm_init(pio, sm, offset, &c); 31 | } 32 | %} 33 | -------------------------------------------------------------------------------- /pico_w/wifi/freertos/http_client/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef _LWIPOPTS_H 2 | #define _LWIPOPTS_H 3 | 4 | // Generally you would define your own explicit list of lwIP options 5 | // (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) 6 | // 7 | // This example uses a common include to avoid repetition 8 | #include "lwipopts_examples_common.h" 9 | 10 | #if !NO_SYS 11 | #define TCPIP_THREAD_STACKSIZE 1024 12 | #define DEFAULT_THREAD_STACKSIZE 1024 13 | #define DEFAULT_RAW_RECVMBOX_SIZE 8 14 | #define TCPIP_MBOX_SIZE 8 15 | #define LWIP_TIMEVAL_PRIVATE 0 16 | 17 | // not necessary, can be done either way 18 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 1 19 | 20 | // ping_thread sets socket receive timeout, so enable this feature 21 | #define LWIP_SO_RCVTIMEO 1 22 | #endif 23 | 24 | #define LWIP_ALTCP 1 25 | 26 | // If you don't want to use TLS (just a http request) you can avoid linking to mbedtls and remove the following 27 | #define LWIP_ALTCP_TLS 1 28 | #define LWIP_ALTCP_TLS_MBEDTLS 1 29 | 30 | // Note bug in lwip with LWIP_ALTCP and LWIP_DEBUG 31 | // https://savannah.nongnu.org/bugs/index.php?62159 32 | //#define LWIP_DEBUG 1 33 | #undef LWIP_DEBUG 34 | #define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /status_led/color_blink/color_blink.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2025 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include "pico/status_led.h" 9 | 10 | #if !PICO_COLORED_STATUS_LED_AVAILABLE 11 | #warning The color_blink example requires a board with a WS2812 LED 12 | #endif 13 | 14 | #ifndef LED_DELAY_MS 15 | #define LED_DELAY_MS 250 16 | #endif 17 | 18 | int main() { 19 | bool rc = status_led_init(); 20 | hard_assert(rc); 21 | hard_assert(colored_status_led_supported()); // This assert fails if your board does not have WS2812 support 22 | uint32_t count = 0; 23 | while (true) { 24 | // flash red then green then blue 25 | uint32_t color = PICO_COLORED_STATUS_LED_COLOR_FROM_RGB(count % 3 == 0 ? 0xaa : 0, count % 3 == 1 ? 0xaa : 0, count % 3 == 2 ? 0xaa : 0); 26 | colored_status_led_set_on_with_color(color); 27 | count++; 28 | sleep_ms(LED_DELAY_MS); 29 | assert(colored_status_led_get_state()); 30 | colored_status_led_set_state(false); 31 | sleep_ms(LED_DELAY_MS); 32 | assert(!colored_status_led_get_state()); 33 | } 34 | status_led_deinit(); 35 | } 36 | -------------------------------------------------------------------------------- /pio/ws2812/generated/ws2812.py: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------- # 2 | # This file is autogenerated by pioasm; do not edit! # 3 | # -------------------------------------------------- # 4 | 5 | import rp2 6 | from machine import Pin 7 | # ------ # 8 | # ws2812 # 9 | # ------ # 10 | 11 | ws2812_T1 = 3 12 | ws2812_T2 = 3 13 | ws2812_T3 = 4 14 | 15 | @rp2.asm_pio(sideset_init=pico.PIO.OUT_HIGH, out_init=pico.PIO.OUT_HIGH, out_shiftdir=1) 16 | def ws2812(): 17 | wrap_target() 18 | label("0") 19 | out(x, 1) .side(0) [3] # 0 20 | jmp(not_x, "3") .side(1) [2] # 1 21 | jmp("0") .side(1) [2] # 2 22 | label("3") 23 | nop() .side(0) [2] # 3 24 | wrap() 25 | 26 | 27 | 28 | # --------------- # 29 | # ws2812_parallel # 30 | # --------------- # 31 | 32 | ws2812_parallel_T1 = 3 33 | ws2812_parallel_T2 = 3 34 | ws2812_parallel_T3 = 4 35 | 36 | @rp2.asm_pio() 37 | def ws2812_parallel(): 38 | wrap_target() 39 | out(x, 32) # 0 40 | mov(pins, invert(null)) [2] # 1 41 | mov(pins, x) [2] # 2 42 | mov(pins, null) [2] # 3 43 | wrap() 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /pio/hub75/Readme.md: -------------------------------------------------------------------------------- 1 | HUB75E Pinout: 2 | 3 | ``` 4 | /-----\ 5 | R0 | o o | G0 6 | B0 | o o | GND 7 | R1 | o o | G1 8 | B1 \ o o | E 9 | A / o o | B 10 | C | o o | D 11 | CLK | o o | STB 12 | OEn | o o | GND 13 | \-----/ 14 | ``` 15 | 16 | Wiring: 17 | 18 | ``` 19 | Must be contiguous, in order: 20 | R0 - GPIO0 21 | G0 - GPIO1 22 | B0 - GPIO2 23 | R1 - GPIO3 24 | G1 - GPIO4 25 | B1 - GPIO5 26 | 27 | Must be contiguous, somewhat ok to change order: 28 | A - GPIO6 29 | B - GPIO7 30 | C - GPIO8 31 | D - GPIO9 32 | E - GPIO10 33 | 34 | Can be anywhere: 35 | CLK - GPIO11 36 | 37 | Must be contiguous, in order: 38 | STB - GPIO12 39 | OEn - GPIO13 40 | ``` 41 | 42 | This is a 1/32nd scan panel. The inputs A, B, C, D, E select one of 32 rows, starting at the top and working down (assuming the first pixel to be shifted is the one on the left of the screen, even though this is the "far end" of the shift register). R0, B0, G0 contain pixel data for the upper half of the screen. R1, G1, B1 contain pixel data for the lower half of the screen, which is scanned simultaneously with the upper half. 43 | 44 | Image credit for mountains_128x64.png: Paul Gilmore, found on [this wikimedia page](https://commons.wikimedia.org/wiki/File:Mountain_lake_dam.jpg) 45 | 46 | -------------------------------------------------------------------------------- /pico_w/wifi/ntp_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_ntp_client_background 2 | picow_ntp_client.c 3 | ) 4 | target_compile_definitions(picow_ntp_client_background PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | ) 8 | target_include_directories(picow_ntp_client_background PRIVATE 9 | ${CMAKE_CURRENT_LIST_DIR} 10 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 11 | ) 12 | target_link_libraries(picow_ntp_client_background 13 | pico_cyw43_arch_lwip_threadsafe_background 14 | pico_stdlib 15 | ) 16 | 17 | pico_add_extra_outputs(picow_ntp_client_background) 18 | 19 | add_executable(picow_ntp_client_poll 20 | picow_ntp_client.c 21 | ) 22 | target_compile_definitions(picow_ntp_client_poll PRIVATE 23 | WIFI_SSID=\"${WIFI_SSID}\" 24 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 25 | ) 26 | target_include_directories(picow_ntp_client_poll PRIVATE 27 | ${CMAKE_CURRENT_LIST_DIR} 28 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 29 | ) 30 | target_link_libraries(picow_ntp_client_poll 31 | pico_cyw43_arch_lwip_poll 32 | pico_stdlib 33 | ) 34 | pico_add_extra_outputs(picow_ntp_client_poll) 35 | 36 | -------------------------------------------------------------------------------- /pico_w/wifi/udp_beacon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_udp_beacon_background 2 | picow_udp_beacon.c 3 | ) 4 | target_compile_definitions(picow_udp_beacon_background PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | ) 8 | target_include_directories(picow_udp_beacon_background PRIVATE 9 | ${CMAKE_CURRENT_LIST_DIR} 10 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 11 | ) 12 | target_link_libraries(picow_udp_beacon_background 13 | pico_cyw43_arch_lwip_threadsafe_background 14 | pico_stdlib 15 | ) 16 | 17 | pico_add_extra_outputs(picow_udp_beacon_background) 18 | 19 | add_executable(picow_udp_beacon_poll 20 | picow_udp_beacon.c 21 | ) 22 | target_compile_definitions(picow_udp_beacon_poll PRIVATE 23 | WIFI_SSID=\"${WIFI_SSID}\" 24 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 25 | ) 26 | target_include_directories(picow_udp_beacon_poll PRIVATE 27 | ${CMAKE_CURRENT_LIST_DIR} 28 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 29 | ) 30 | target_link_libraries(picow_udp_beacon_poll 31 | pico_cyw43_arch_lwip_poll 32 | pico_stdlib 33 | ) 34 | pico_add_extra_outputs(picow_udp_beacon_poll) 35 | -------------------------------------------------------------------------------- /pio/i2c/i2c_bus_scan.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pico/stdlib.h" 4 | #include "pio_i2c.h" 5 | 6 | #define PIN_SDA 2 7 | #define PIN_SCL 3 8 | 9 | bool reserved_addr(uint8_t addr) { 10 | return (addr & 0x78) == 0 || (addr & 0x78) == 0x78; 11 | } 12 | 13 | int main() { 14 | stdio_init_all(); 15 | 16 | PIO pio = pio0; 17 | uint sm = 0; 18 | uint offset = pio_add_program(pio, &i2c_program); 19 | i2c_program_init(pio, sm, offset, PIN_SDA, PIN_SCL); 20 | 21 | printf("\nPIO I2C Bus Scan\n"); 22 | printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n"); 23 | 24 | for (int addr = 0; addr < (1 << 7); ++addr) { 25 | if (addr % 16 == 0) { 26 | printf("%02x ", addr); 27 | } 28 | // Perform a 0-byte read from the probe address. The read function 29 | // returns a negative result NAK'd any time other than the last data 30 | // byte. Skip over reserved addresses. 31 | int result; 32 | if (reserved_addr(addr)) 33 | result = -1; 34 | else 35 | result = pio_i2c_read_blocking(pio, sm, addr, NULL, 0); 36 | 37 | printf(result < 0 ? "." : "@"); 38 | printf(addr % 16 == 15 ? "\n" : " "); 39 | } 40 | printf("Done.\n"); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /adc/joystick_display/joystick_display.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/adc.h" 10 | 11 | int main() { 12 | stdio_init_all(); 13 | adc_init(); 14 | // Make sure GPIO is high-impedance, no pullups etc 15 | adc_gpio_init(26); 16 | adc_gpio_init(27); 17 | 18 | while (1) { 19 | adc_select_input(0); 20 | uint adc_x_raw = adc_read(); 21 | adc_select_input(1); 22 | uint adc_y_raw = adc_read(); 23 | 24 | // Display the joystick position something like this: 25 | // X: [ o ] Y: [ o ] 26 | const uint bar_width = 40; 27 | const uint adc_max = (1 << 12) - 1; 28 | uint bar_x_pos = adc_x_raw * bar_width / adc_max; 29 | uint bar_y_pos = adc_y_raw * bar_width / adc_max; 30 | printf("\rX: ["); 31 | for (uint i = 0; i < bar_width; ++i) 32 | putchar( i == bar_x_pos ? 'o' : ' '); 33 | printf("] Y: ["); 34 | for (uint i = 0; i < bar_width; ++i) 35 | putchar( i == bar_y_pos ? 'o' : ' '); 36 | printf("]"); 37 | sleep_ms(50); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pico_w/wifi/tcp_server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_tcpip_server_background 2 | picow_tcp_server.c 3 | ) 4 | target_compile_definitions(picow_tcpip_server_background PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | ) 8 | target_include_directories(picow_tcpip_server_background PRIVATE 9 | ${CMAKE_CURRENT_LIST_DIR} 10 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 11 | ) 12 | target_link_libraries(picow_tcpip_server_background 13 | pico_cyw43_arch_lwip_threadsafe_background 14 | pico_stdlib 15 | ) 16 | 17 | pico_add_extra_outputs(picow_tcpip_server_background) 18 | 19 | add_executable(picow_tcpip_server_poll 20 | picow_tcp_server.c 21 | ) 22 | target_compile_definitions(picow_tcpip_server_poll PRIVATE 23 | WIFI_SSID=\"${WIFI_SSID}\" 24 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 25 | ) 26 | target_include_directories(picow_tcpip_server_poll PRIVATE 27 | ${CMAKE_CURRENT_LIST_DIR} 28 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 29 | ) 30 | target_link_libraries(picow_tcpip_server_poll 31 | pico_cyw43_arch_lwip_poll 32 | pico_stdlib 33 | ) 34 | pico_add_extra_outputs(picow_tcpip_server_poll) 35 | -------------------------------------------------------------------------------- /usb/device/dev_lowlevel/dev_lowlevel_loopback.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # 4 | # Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 5 | # 6 | # SPDX-License-Identifier: BSD-3-Clause 7 | # 8 | 9 | # sudo pip3 install pyusb 10 | 11 | import usb.core 12 | import usb.util 13 | 14 | # find our device 15 | dev = usb.core.find(idVendor=0x0000, idProduct=0x0001) 16 | 17 | # was it found? 18 | if dev is None: 19 | raise ValueError('Device not found') 20 | 21 | # get an endpoint instance 22 | cfg = dev.get_active_configuration() 23 | intf = cfg[(0, 0)] 24 | 25 | outep = usb.util.find_descriptor( 26 | intf, 27 | # match the first OUT endpoint 28 | custom_match= \ 29 | lambda e: \ 30 | usb.util.endpoint_direction(e.bEndpointAddress) == \ 31 | usb.util.ENDPOINT_OUT) 32 | 33 | inep = usb.util.find_descriptor( 34 | intf, 35 | # match the first IN endpoint 36 | custom_match= \ 37 | lambda e: \ 38 | usb.util.endpoint_direction(e.bEndpointAddress) == \ 39 | usb.util.ENDPOINT_IN) 40 | 41 | assert inep is not None 42 | assert outep is not None 43 | 44 | test_string = "Hello World!" 45 | outep.write(test_string) 46 | from_device = inep.read(len(test_string)) 47 | 48 | print("Device Says: {}".format(''.join([chr(x) for x in from_device]))) 49 | -------------------------------------------------------------------------------- /clocks/hello_resus/hello_resus.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "pico/stdlib.h" 9 | #include "hardware/clocks.h" 10 | #include "hardware/pll.h" 11 | 12 | volatile bool seen_resus; 13 | 14 | void resus_callback(void) { 15 | // Reconfigure PLL sys back to the default state of 1500 / 6 / 2 = 125MHz 16 | pll_init(pll_sys, 1, 1500 * MHZ, 6, 2); 17 | 18 | // CLK SYS = PLL SYS (125MHz) / 1 = 125MHz 19 | clock_configure(clk_sys, 20 | CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, 21 | CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, 22 | 125 * MHZ, 23 | 125 * MHZ); 24 | 25 | // Reconfigure uart as clocks have changed 26 | stdio_init_all(); 27 | printf("Resus event fired\n"); 28 | 29 | // Wait for uart output to finish 30 | uart_default_tx_wait_blocking(); 31 | 32 | seen_resus = true; 33 | } 34 | 35 | int main() { 36 | stdio_init_all(); 37 | printf("Hello resus\n"); 38 | 39 | seen_resus = false; 40 | 41 | clocks_enable_resus(&resus_callback); 42 | // Break PLL sys 43 | pll_deinit(pll_sys); 44 | 45 | while(!seen_resus); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /pico_w/wifi/ota_update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_ota_update 2 | picow_ota_update.c 3 | ) 4 | target_compile_definitions(picow_ota_update PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | PICO_CRT0_IMAGE_TYPE_TBYB=1 8 | ) 9 | target_include_directories(picow_ota_update PRIVATE 10 | ${CMAKE_CURRENT_LIST_DIR} 11 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 12 | ) 13 | target_link_libraries(picow_ota_update 14 | pico_cyw43_arch_lwip_threadsafe_background 15 | pico_stdlib 16 | pico_sha256 17 | boot_uf2_headers 18 | ) 19 | 20 | pico_use_wifi_firmware_partition(picow_ota_update) 21 | 22 | pico_hash_binary(picow_ota_update) 23 | pico_sign_binary(picow_ota_update ${CMAKE_CURRENT_LIST_DIR}/private.pem) 24 | 25 | # By default this example requires a partition table in flash, and will 26 | # update the partition that is not currently in use. To use it without 27 | # a partition table in flash, uncomment the following lines to make it 28 | # a no_flash binary, so it can update the currently running program. 29 | 30 | # pico_set_binary_type(picow_ota_update no_flash) 31 | # pico_package_uf2_output(picow_ota_update 0x10000000) 32 | 33 | pico_add_extra_outputs(picow_ota_update) 34 | -------------------------------------------------------------------------------- /adc/dma_capture/resistor_dac.pio: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 3 | ; 4 | ; SPDX-License-Identifier: BSD-3-Clause 5 | ; 6 | 7 | .program resistor_dac_5bit 8 | 9 | ; Drive one of the 5-bit resistor DACs on the VGA reference board. (this isn't 10 | ; a good way to do VGA -- just want a nice sawtooth for the ADC example!) 11 | 12 | out pins, 5 13 | 14 | 15 | 16 | % c-sdk { 17 | #include "hardware/clocks.h" 18 | static inline void resistor_dac_5bit_program_init(PIO pio, uint sm, uint offset, 19 | uint sample_rate_hz, uint pin_base) { 20 | 21 | pio_sm_set_pins_with_mask(pio, sm, 0, 0x1fu << pin_base); 22 | pio_sm_set_pindirs_with_mask(pio, sm, ~0u, 0x1fu << pin_base); 23 | for (int i = 0; i < 5; ++i) 24 | pio_gpio_init(pio, pin_base + i); 25 | 26 | pio_sm_config c = resistor_dac_5bit_program_get_default_config(offset); 27 | sm_config_set_out_pins(&c, pin_base, 5); 28 | // Shift to right, autopull threshold 5 29 | sm_config_set_out_shift(&c, true, true, 5); 30 | // Deeper FIFO as we're not doing any RX 31 | sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); 32 | float div = (float)clock_get_hz(clk_sys) / sample_rate_hz; 33 | sm_config_set_clkdiv(&c, div); 34 | 35 | pio_sm_init(pio, sm, offset, &c); 36 | pio_sm_set_enabled(pio, sm, true); 37 | } 38 | %} 39 | -------------------------------------------------------------------------------- /pico_w/wifi/httpd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | add_executable(picow_httpd_background 4 | pico_httpd.c 5 | ) 6 | target_compile_definitions(picow_httpd_background PRIVATE 7 | WIFI_SSID=\"${WIFI_SSID}\" 8 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 9 | ) 10 | target_include_directories(picow_httpd_background PRIVATE 11 | ${CMAKE_CURRENT_LIST_DIR} 12 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 13 | ${PICO_LWIP_CONTRIB_PATH}/apps/httpd 14 | ) 15 | target_link_libraries(picow_httpd_background PRIVATE 16 | pico_cyw43_arch_lwip_threadsafe_background 17 | pico_lwip_http 18 | pico_lwip_mdns 19 | pico_httpd_content 20 | pico_stdlib 21 | ) 22 | pico_add_extra_outputs(picow_httpd_background) 23 | 24 | pico_add_library(pico_httpd_content NOFLAG) 25 | pico_set_lwip_httpd_content(pico_httpd_content INTERFACE 26 | ${CMAKE_CURRENT_LIST_DIR}/content/404.html 27 | ${CMAKE_CURRENT_LIST_DIR}/content/index.shtml 28 | ${CMAKE_CURRENT_LIST_DIR}/content/test.shtml 29 | ${CMAKE_CURRENT_LIST_DIR}/content/ledpass.shtml 30 | ${CMAKE_CURRENT_LIST_DIR}/content/ledfail.shtml 31 | ${CMAKE_CURRENT_LIST_DIR}/content/img/rpi.png.gz 32 | ) 33 | -------------------------------------------------------------------------------- /pico_w/wifi/iperf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(picow_iperf_server_background 2 | picow_iperf.c 3 | ) 4 | target_compile_definitions(picow_iperf_server_background PRIVATE 5 | WIFI_SSID=\"${WIFI_SSID}\" 6 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 7 | ) 8 | target_include_directories(picow_iperf_server_background PRIVATE 9 | ${CMAKE_CURRENT_LIST_DIR} 10 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 11 | ) 12 | target_link_libraries(picow_iperf_server_background 13 | pico_cyw43_arch_lwip_threadsafe_background 14 | pico_stdlib 15 | pico_lwip_iperf 16 | ) 17 | pico_add_extra_outputs(picow_iperf_server_background) 18 | 19 | add_executable(picow_iperf_server_poll 20 | picow_iperf.c 21 | ) 22 | target_compile_definitions(picow_iperf_server_poll PRIVATE 23 | WIFI_SSID=\"${WIFI_SSID}\" 24 | WIFI_PASSWORD=\"${WIFI_PASSWORD}\" 25 | ) 26 | target_include_directories(picow_iperf_server_poll PRIVATE 27 | ${CMAKE_CURRENT_LIST_DIR} 28 | ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts 29 | ) 30 | target_link_libraries(picow_iperf_server_poll 31 | pico_cyw43_arch_lwip_poll 32 | pico_stdlib 33 | pico_lwip_iperf 34 | ) 35 | pico_add_extra_outputs(picow_iperf_server_poll) 36 | 37 | -------------------------------------------------------------------------------- /pio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (TARGET hardware_pio) 2 | add_subdirectory_exclude_platforms(addition) 3 | add_subdirectory_exclude_platforms(apa102) 4 | add_subdirectory_exclude_platforms(clocked_input) 5 | add_subdirectory_exclude_platforms(differential_manchester) 6 | add_subdirectory_exclude_platforms(hello_pio) 7 | add_subdirectory_exclude_platforms(hub75) 8 | add_subdirectory_exclude_platforms(i2c) 9 | add_subdirectory_exclude_platforms(ir_nec) 10 | add_subdirectory_exclude_platforms(logic_analyser) 11 | add_subdirectory_exclude_platforms(manchester_encoding) 12 | add_subdirectory_exclude_platforms(onewire) 13 | add_subdirectory_exclude_platforms(pio_blink) 14 | add_subdirectory_exclude_platforms(pwm) 15 | add_subdirectory_exclude_platforms(quadrature_encoder) 16 | add_subdirectory_exclude_platforms(quadrature_encoder_substep) 17 | add_subdirectory_exclude_platforms(spi) 18 | add_subdirectory_exclude_platforms(squarewave) 19 | add_subdirectory_exclude_platforms(st7789_lcd) 20 | add_subdirectory_exclude_platforms(uart_dma) 21 | add_subdirectory_exclude_platforms(uart_rx) 22 | add_subdirectory_exclude_platforms(uart_tx) 23 | add_subdirectory_exclude_platforms(ws2812) 24 | else() 25 | message("Skipping PIO examples as hardware_pio is unavailable on this platform") 26 | endif() 27 | -------------------------------------------------------------------------------- /pio/squarewave/generated/squarewave.pio.h: -------------------------------------------------------------------------------- 1 | // -------------------------------------------------- // 2 | // This file is autogenerated by pioasm; do not edit! // 3 | // -------------------------------------------------- // 4 | 5 | #pragma once 6 | 7 | #if !PICO_NO_HARDWARE 8 | #include "hardware/pio.h" 9 | #endif 10 | 11 | // ---------- // 12 | // squarewave // 13 | // ---------- // 14 | 15 | #define squarewave_wrap_target 0 16 | #define squarewave_wrap 3 17 | #define squarewave_pio_version 0 18 | 19 | static const uint16_t squarewave_program_instructions[] = { 20 | // .wrap_target 21 | 0xe081, // 0: set pindirs, 1 22 | 0xe101, // 1: set pins, 1 [1] 23 | 0xe000, // 2: set pins, 0 24 | 0x0001, // 3: jmp 1 25 | // .wrap 26 | }; 27 | 28 | #if !PICO_NO_HARDWARE 29 | static const struct pio_program squarewave_program = { 30 | .instructions = squarewave_program_instructions, 31 | .length = 4, 32 | .origin = -1, 33 | .pio_version = squarewave_pio_version, 34 | #if PICO_PIO_VERSION > 0 35 | .used_gpio_ranges = 0x0 36 | #endif 37 | }; 38 | 39 | static inline pio_sm_config squarewave_program_get_default_config(uint offset) { 40 | pio_sm_config c = pio_get_default_sm_config(); 41 | sm_config_set_wrap(&c, offset + squarewave_wrap_target, offset + squarewave_wrap); 42 | return c; 43 | } 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /rtc/hello_rtc/hello_rtc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include 8 | #include "hardware/rtc.h" 9 | #include "pico/stdlib.h" 10 | #include "pico/util/datetime.h" 11 | 12 | /// \tag::hello_rtc_main[] 13 | int main() { 14 | stdio_init_all(); 15 | printf("Hello RTC!\n"); 16 | 17 | char datetime_buf[256]; 18 | char *datetime_str = &datetime_buf[0]; 19 | 20 | // Start on Friday 5th of June 2020 15:45:00 21 | datetime_t t = { 22 | .year = 2020, 23 | .month = 06, 24 | .day = 05, 25 | .dotw = 5, // 0 is Sunday, so 5 is Friday 26 | .hour = 15, 27 | .min = 45, 28 | .sec = 00 29 | }; 30 | 31 | // Start the RTC 32 | rtc_init(); 33 | rtc_set_datetime(&t); 34 | 35 | // clk_sys is >2000x faster than clk_rtc, so datetime is not updated immediately when rtc_get_datetime() is called. 36 | // The delay is up to 3 RTC clock cycles (which is 64us with the default clock settings) 37 | sleep_us(64); 38 | 39 | // Print the time 40 | while (true) { 41 | rtc_get_datetime(&t); 42 | datetime_to_str(datetime_str, sizeof(datetime_buf), &t); 43 | printf("\r%s ", datetime_str); 44 | sleep_ms(100); 45 | } 46 | } 47 | /// \end::hello_rtc_main[] 48 | -------------------------------------------------------------------------------- /i2c/pcf8523_i2c/README.adoc: -------------------------------------------------------------------------------- 1 | = Attaching a PCF8523 Real Time Clock via I2C 2 | 3 | This example code shows how to interface the Raspberry Pi Pico to the PCF8523 Real Time Clock 4 | 5 | This example allows you to initialise the current time and date and then displays it every half-second. Additionally it lets you set an alarm for a particular time and date and raises an alert accordingly. More information about the module is available at https://learn.adafruit.com/adafruit-pcf8523-real-time-clock. 6 | 7 | == Wiring information 8 | 9 | Wiring up the device requires 4 jumpers, to connect VDD, GND, SDA and SCL. The example here uses I2C port 0, which is assigned to GPIO 4 (SDA) and 5 (SCL) in software. Power is supplied from the 5V pin. 10 | 11 | [[pcf8523_i2c_wiring]] 12 | [pdfwidth=75%] 13 | .Wiring Diagram for PCF8523. 14 | image::pc8523_i2c.png[] 15 | 16 | == List of Files 17 | 18 | CMakeLists.txt:: CMake file to incorporate the example in to the examples build tree. 19 | pcf8523_i2c.c:: The example code. 20 | 21 | == Bill of Materials 22 | 23 | .A list of materials required for the example 24 | [[pcf8523-bom-table]] 25 | [cols=3] 26 | |=== 27 | | *Item* | *Quantity* | Details 28 | | Breadboard | 1 | generic part 29 | | Raspberry Pi Pico | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico/ 30 | | PCF8523 board| 1 | https://www.adafruit.com/product/3295 31 | | M/M Jumper wires | 4 | generic part 32 | |=== 33 | 34 | --------------------------------------------------------------------------------