[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70FSKV3A23YM8F4KH9TASP5":3,"skill-same:01M70FSKV3A23YM8F4KH9TASP5":132},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":59,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M70FSKV3A23YM8F4KH9TASP5","rp2350-c-cpp",null,"Expert RP2350 C\u002FC++ development with Pico SDK, covering CMake configuration, peripheral drivers (GPIO, SPI, I2C, PWM, UART), hardware optimization, FreeRTOS integration, and bare-metal programming. Use when developing C\u002FC++ firmware for RP2350\u002FRP2040 boards, implementing hardware drivers, optimizing performance, or building real-time embedded applications.","shengdabai\u002FTony-Claude-Code-Skills","shengdabai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F116417419?v=4","01M70F6D2WY5PQV5A92BKYJQEW","Tony Sheng","01M70F6D3GAAAYZ5H4CC1G8VXM",3,"MIT","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"rp2350 c cpp","cpp","expert","when","bare","for","implementing","with","optimizing performance","c++","time","performance","use","programming","applications","real-time","firmware","Optimization","development","cmake","2026-11-10 10:12:30",false,"---\nname: rp2350-c-cpp\ndescription: Expert RP2350 C\u002FC++ development with Pico SDK, covering CMake configuration, peripheral drivers (GPIO, SPI, I2C, PWM, UART), hardware optimization, FreeRTOS integration, and bare-metal programming. Use when developing C\u002FC++ firmware for RP2350\u002FRP2040 boards, implementing hardware drivers, optimizing performance, or building real-time embedded applications.\n---\n\n# RP2350 C\u002FC++ Development with Pico SDK\n\n## Overview\n\nThis skill provides comprehensive guidance for developing high-performance embedded applications on RP2350 and RP2040 hardware using C\u002FC++ and the official Raspberry Pi Pico SDK. It covers project setup, CMake configuration, peripheral programming, memory optimization, multicore development, and FreeRTOS integration.\n\n## When to Use This Skill\n\nUse this skill when:\n\n- Developing C\u002FC++ firmware for RP2350 or RP2040 boards\n- Setting up Pico SDK projects with CMake\n- Implementing hardware drivers (GPIO, SPI, I2C, PWM, UART, ADC)\n- Writing interrupt service routines and DMA transfers\n- Building multicore applications utilizing both ARM cores\n- Integrating FreeRTOS for real-time task management\n- Optimizing memory usage and execution speed\n- Implementing USB device or host functionality\n- Working with PIO (Programmable I\u002FO) for custom protocols\n- Debugging with picoprobe or SWD interfaces\n- Porting applications from RP2040 to RP2350\n\n## Hardware Context\n\n### RP2350 Features\n\n- **Processor**: Dual ARM Cortex-M33 @ 150MHz (or dual RISC-V Hazard3 @ 150MHz)\n- **Memory**: 520KB SRAM, up to 16MB external flash\n- **Security**: ARM TrustZone-M, secure boot, signed firmware\n- **Peripherals**:\n  - 30 multifunction GPIO pins\n  - 2× UART, 2× SPI, 2× I2C\n  - 12-bit ADC with up to 5 channels\n  - 24× PWM channels\n  - 12× PIO state machines\n  - USB 1.1 host\u002Fdevice\n  - DMA controller with 12 channels\n- **Power**: 1.8-3.6V operation, sleep modes down to 180µA\n\n### RP2040 Features (for comparison)\n\n- **Processor**: Dual ARM Cortex-M0+ @ 133MHz\n- **Memory**: 264KB SRAM, up to 16MB external flash\n- **Peripherals**: Similar to RP2350 but without TrustZone and with lower performance\n\n## Core Capabilities\n\n### 1. Project Setup with CMake\n\nUse `assets\u002Fproject_template\u002F` for a complete CMake-based project structure.\n\n**Key Components:**\n- `CMakeLists.txt` - Main build configuration\n- `pico_sdk_import.cmake` - SDK integration\n- `.vscode\u002F` - VSCode configuration for debugging\n- `src\u002F` - Source code directory\n\n**Quick Start:**\n```bash\n# Copy template\ncp -r assets\u002Fproject_template\u002F my_project\ncd my_project\n\n# Configure environment\nexport PICO_SDK_PATH=\u002Fpath\u002Fto\u002Fpico-sdk\n\n# Build\nmkdir build && cd build\ncmake ..\nmake -j4\n```\n\n**CMakeLists.txt Structure:**\n```cmake\ncmake_minimum_required(VERSION 3.13)\n\n# Include SDK\ninclude(pico_sdk_import.cmake)\n\nproject(my_project C CXX ASM)\nset(CMAKE_C_STANDARD 11)\nset(CMAKE_CXX_STANDARD 17)\n\n# Initialize SDK\npico_sdk_init()\n\n# Add executable\nadd_executable(my_project\n    src\u002Fmain.c\n    src\u002Fperipheral_init.c\n)\n\n# Link libraries\ntarget_link_libraries(my_project\n    pico_stdlib\n    hardware_spi\n    hardware_i2c\n    hardware_pwm\n    hardware_adc\n)\n\n# Enable USB output, disable UART\npico_enable_stdio_usb(my_project 1)\npico_enable_stdio_uart(my_project 0)\n\n# Create map\u002Fbin\u002Fhex\u002Fuf2 files\npico_add_extra_outputs(my_project)\n```\n\nRefer to `references\u002Fcmake_configuration.md` for advanced CMake patterns including multicore builds, FreeRTOS integration, and custom linker scripts.\n\n### 2. GPIO and Basic I\u002FO\n\n**Initialization:**\n```c\n#include \"pico\u002Fstdlib.h\"\n\n\u002F\u002F Configure GPIO as output\nconst uint LED_PIN = 25;\ngpio_init(LED_PIN);\ngpio_set_dir(LED_PIN, GPIO_OUT);\n\n\u002F\u002F Configure GPIO as input with pull-up\nconst uint BUTTON_PIN = 15;\ngpio_init(BUTTON_PIN);\ngpio_set_dir(BUTTON_PIN, GPIO_IN);\ngpio_pull_up(BUTTON_PIN);\n```\n\n**Interrupt Handling:**\n```c\nvoid gpio_callback(uint gpio, uint32_t events) {\n    if (gpio == BUTTON_PIN && (events & GPIO_IRQ_EDGE_FALL)) {\n        \u002F\u002F Button pressed\n        gpio_put(LED_PIN, !gpio_get(LED_PIN));\n    }\n}\n\nint main() {\n    stdio_init_all();\n\n    gpio_init(LED_PIN);\n    gpio_set_dir(LED_PIN, GPIO_OUT);\n\n    gpio_init(BUTTON_PIN);\n    gpio_set_dir(BUTTON_PIN, GPIO_IN);\n    gpio_pull_up(BUTTON_PIN);\n\n    \u002F\u002F Enable interrupt\n    gpio_set_irq_enabled_with_callback(\n        BUTTON_PIN,\n        GPIO_IRQ_EDGE_FALL,\n        true,\n        &gpio_callback\n    );\n\n    while (1) {\n        tight_loop_contents();\n    }\n}\n```\n\n### 3. SPI Communication\n\n**Standard SPI Setup:**\n```c\n#include \"hardware\u002Fspi.h\"\n\n#define SPI_PORT spi0\n#define PIN_MISO 16\n#define PIN_CS   17\n#define PIN_SCK  18\n#define PIN_MOSI 19\n\nvoid spi_init_device() {\n    \u002F\u002F Initialize SPI at 10 MHz\n    spi_init(SPI_PORT, 10 * 1000 * 1000);\n\n    \u002F\u002F Configure GPIO for SPI\n    gpio_set_function(PIN_MISO, GPIO_FUNC_SPI);\n    gpio_set_function(PIN_SCK,  GPIO_FUNC_SPI);\n    gpio_set_function(PIN_MOSI, GPIO_FUNC_SPI);\n\n    \u002F\u002F Initialize CS pin as GPIO output\n    gpio_init(PIN_CS);\n    gpio_set_dir(PIN_CS, GPIO_OUT);\n    gpio_put(PIN_CS, 1);  \u002F\u002F CS high (inactive)\n}\n\nuint8_t spi_read_register(uint8_t reg) {\n    uint8_t data;\n    gpio_put(PIN_CS, 0);  \u002F\u002F CS low\n    spi_write_blocking(SPI_PORT, &reg, 1);\n    spi_read_blocking(SPI_PORT, 0, &data, 1);\n    gpio_put(PIN_CS, 1);  \u002F\u002F CS high\n    return data;\n}\n\nvoid spi_write_register(uint8_t reg, uint8_t value) {\n    uint8_t buf[2] = {reg, value};\n    gpio_put(PIN_CS, 0);\n    spi_write_blocking(SPI_PORT, buf, 2);\n    gpio_put(PIN_CS, 1);\n}\n```\n\n**DMA-Based SPI Transfer:**\n```c\n#include \"hardware\u002Fdma.h\"\n\nvoid spi_dma_transfer(uint8_t *tx_buf, uint8_t *rx_buf, size_t len) {\n    int dma_tx = dma_claim_unused_channel(true);\n    int dma_rx = dma_claim_unused_channel(true);\n\n    \u002F\u002F Configure TX DMA\n    dma_channel_config c_tx = dma_channel_get_default_config(dma_tx);\n    channel_config_set_transfer_data_size(&c_tx, DMA_SIZE_8);\n    channel_config_set_dreq(&c_tx, spi_get_dreq(SPI_PORT, true));\n\n    dma_channel_configure(\n        dma_tx, &c_tx,\n        &spi_get_hw(SPI_PORT)->dr,  \u002F\u002F dst\n        tx_buf,                      \u002F\u002F src\n        len,                         \u002F\u002F transfer count\n        false                        \u002F\u002F don't start yet\n    );\n\n    \u002F\u002F Configure RX DMA\n    dma_channel_config c_rx = dma_channel_get_default_config(dma_rx);\n    channel_config_set_transfer_data_size(&c_rx, DMA_SIZE_8);\n    channel_config_set_dreq(&c_rx, spi_get_dreq(SPI_PORT, false));\n    channel_config_set_read_increment(&c_rx, false);\n    channel_config_set_write_increment(&c_rx, true);\n\n    dma_channel_configure(\n        dma_rx, &c_rx,\n        rx_buf,                      \u002F\u002F dst\n        &spi_get_hw(SPI_PORT)->dr,  \u002F\u002F src\n        len,                         \u002F\u002F transfer count\n        false                        \u002F\u002F don't start yet\n    );\n\n    \u002F\u002F Start both channels\n    gpio_put(PIN_CS, 0);\n    dma_start_channel_mask((1u \u003C\u003C dma_tx) | (1u \u003C\u003C dma_rx));\n\n    \u002F\u002F Wait for completion\n    dma_channel_wait_for_finish_blocking(dma_rx);\n    gpio_put(PIN_CS, 1);\n\n    \u002F\u002F Release channels\n    dma_channel_unclaim(dma_tx);\n    dma_channel_unclaim(dma_rx);\n}\n```\n\n### 4. I2C Communication\n\n**I2C Setup and Operations:**\n```c\n#include \"hardware\u002Fi2c.h\"\n\n#define I2C_PORT i2c0\n#define I2C_SDA 4\n#define I2C_SCL 5\n#define I2C_FREQ 400000  \u002F\u002F 400 kHz\n\nvoid i2c_init_device() {\n    \u002F\u002F Initialize I2C at 400 kHz\n    i2c_init(I2C_PORT, I2C_FREQ);\n\n    \u002F\u002F Configure GPIO for I2C\n    gpio_set_function(I2C_SDA, GPIO_FUNC_I2C);\n    gpio_set_function(I2C_SCL, GPIO_FUNC_I2C);\n    gpio_pull_up(I2C_SDA);\n    gpio_pull_up(I2C_SCL);\n}\n\n\u002F\u002F Read single byte\nuint8_t i2c_read_byte(uint8_t addr, uint8_t reg) {\n    uint8_t data;\n    i2c_write_blocking(I2C_PORT, addr, &reg, 1, true);\n    i2c_read_blocking(I2C_PORT, addr, &data, 1, false);\n    return data;\n}\n\n\u002F\u002F Write single byte\nvoid i2c_write_byte(uint8_t addr, uint8_t reg, uint8_t value) {\n    uint8_t buf[2] = {reg, value};\n    i2c_write_blocking(I2C_PORT, addr, buf, 2, false);\n}\n\n\u002F\u002F Read multiple bytes\nint i2c_read_bytes(uint8_t addr, uint8_t reg, uint8_t *buf, size_t len) {\n    i2c_write_blocking(I2C_PORT, addr, &reg, 1, true);\n    return i2c_read_blocking(I2C_PORT, addr, buf, len, false);\n}\n\n\u002F\u002F I2C scanner\nvoid i2c_scan() {\n    printf(\"\\nI2C Bus Scan\\n\");\n    printf(\"   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\\n\");\n\n    for (int addr = 0; addr \u003C (1 \u003C\u003C 7); ++addr) {\n        if (addr % 16 == 0) {\n            printf(\"%02x \", addr);\n        }\n\n        int ret;\n        uint8_t rxdata;\n        ret = i2c_read_blocking(I2C_PORT, addr, &rxdata, 1, false);\n\n        printf(ret \u003C 0 ? \".\" : \"@\");\n        printf(addr % 16 == 15 ? \"\\n\" : \"  \");\n    }\n}\n```\n\n### 5. PWM for LED\u002FMotor Control\n\n**PWM Configuration:**\n```c\n#include \"hardware\u002Fpwm.h\"\n\nvoid pwm_init_pin(uint gpio, uint freq_hz, float duty_cycle) {\n    \u002F\u002F Configure GPIO for PWM\n    gpio_set_function(gpio, GPIO_FUNC_PWM);\n\n    \u002F\u002F Find PWM slice\n    uint slice_num = pwm_gpio_to_slice_num(gpio);\n\n    \u002F\u002F Calculate divider and wrap for desired frequency\n    uint32_t clock_freq = 125000000;  \u002F\u002F 125 MHz\n    uint32_t divider = clock_freq \u002F (freq_hz * 65536);\n    if (divider \u003C 1) divider = 1;\n\n    uint32_t wrap = (clock_freq \u002F (freq_hz * divider)) - 1;\n\n    \u002F\u002F Configure PWM\n    pwm_set_clkdiv(slice_num, divider);\n    pwm_set_wrap(slice_num, wrap);\n\n    \u002F\u002F Set duty cycle\n    uint16_t level = (uint16_t)(wrap * duty_cycle);\n    pwm_set_gpio_level(gpio, level);\n\n    \u002F\u002F Enable PWM\n    pwm_set_enabled(slice_num, true);\n}\n\n\u002F\u002F Example: RGB LED control\nvoid rgb_led_init(uint pin_r, uint pin_g, uint pin_b) {\n    pwm_init_pin(pin_r, 1000, 0.0);  \u002F\u002F 1 kHz, 0% duty\n    pwm_init_pin(pin_g, 1000, 0.0);\n    pwm_init_pin(pin_b, 1000, 0.0);\n}\n\nvoid rgb_led_set_color(uint pin_r, uint pin_g, uint pin_b,\n                       float r, float g, float b) {\n    uint slice_r = pwm_gpio_to_slice_num(pin_r);\n    uint slice_g = pwm_gpio_to_slice_num(pin_g);\n    uint slice_b = pwm_gpio_to_slice_num(pin_b);\n\n    uint16_t wrap = pwm_get_wrap(slice_r);\n\n    pwm_set_gpio_level(pin_r, (uint16_t)(wrap * r));\n    pwm_set_gpio_level(pin_g, (uint16_t)(wrap * g));\n    pwm_set_gpio_level(pin_b, (uint16_t)(wrap * b));\n}\n```\n\n### 6. ADC (Analog-to-Digital Converter)\n\n**ADC Reading:**\n```c\n#include \"hardware\u002Fadc.h\"\n\nvoid adc_init_all() {\n    adc_init();\n\n    \u002F\u002F Make sure GPIO is high-impedance, no pullups etc\n    adc_gpio_init(26);  \u002F\u002F ADC0\n    adc_gpio_init(27);  \u002F\u002F ADC1\n    adc_gpio_init(28);  \u002F\u002F ADC2\n}\n\nuint16_t adc_read_channel(uint channel) {\n    adc_select_input(channel);\n    return adc_read();\n}\n\nfloat adc_read_voltage(uint channel) {\n    adc_select_input(channel);\n    uint16_t raw = adc_read();\n    \u002F\u002F Convert to voltage (3.3V reference, 12-bit ADC)\n    return raw * 3.3f \u002F 4096.0f;\n}\n\n\u002F\u002F Read internal temperature sensor\nfloat read_onboard_temperature() {\n    adc_select_input(4);  \u002F\u002F Temperature sensor on ADC4\n    uint16_t raw = adc_read();\n\n    \u002F\u002F Convert to temperature (from RP2040 datasheet)\n    const float conversion = 3.3f \u002F 4096.0f;\n    float voltage = raw * conversion;\n    float temp_c = 27.0f - (voltage - 0.706f) \u002F 0.001721f;\n\n    return temp_c;\n}\n```\n\n### 7. Multicore Programming\n\n**Core1 Launch:**\n```c\n#include \"pico\u002Fmulticore.h\"\n\nvoid core1_entry() {\n    while (1) {\n        \u002F\u002F Core 1 work here\n        printf(\"Running on core 1\\n\");\n        sleep_ms(1000);\n    }\n}\n\nint main() {\n    stdio_init_all();\n\n    printf(\"Starting core 1\\n\");\n    multicore_launch_core1(core1_entry);\n\n    while (1) {\n        \u002F\u002F Core 0 work here\n        printf(\"Running on core 0\\n\");\n        sleep_ms(1000);\n    }\n}\n```\n\n**Intercore Communication:**\n```c\n#include \"pico\u002Fmulticore.h\"\n\n\u002F\u002F Core 0 to Core 1 FIFO\nvoid core0_send_to_core1(uint32_t data) {\n    multicore_fifo_push_blocking(data);\n}\n\n\u002F\u002F Core 1 receives from Core 0\nuint32_t core1_receive_from_core0() {\n    return multicore_fifo_pop_blocking();\n}\n\n\u002F\u002F Example: Core 1 worker\nvoid core1_worker() {\n    while (1) {\n        uint32_t cmd = multicore_fifo_pop_blocking();\n\n        switch (cmd) {\n            case 1:\n                \u002F\u002F Process command 1\n                break;\n            case 2:\n                \u002F\u002F Process command 2\n                break;\n        }\n\n        \u002F\u002F Send result back to Core 0\n        multicore_fifo_push_blocking(42);\n    }\n}\n```\n\n### 8. USB Device Implementation\n\n**USB Serial (CDC):**\nAlready enabled with `pico_enable_stdio_usb()` in CMakeLists.txt.\n\n**Custom USB Device:**\n```c\n#include \"tusb.h\"\n\n\u002F\u002F USB HID Keyboard example\nvoid send_key_press(uint8_t keycode) {\n    if (tud_hid_ready()) {\n        uint8_t report[8] = {0};\n        report[2] = keycode;  \u002F\u002F Keycode\n        tud_hid_keyboard_report(0, 0, report);\n\n        \u002F\u002F Release key\n        sleep_ms(10);\n        tud_hid_keyboard_report(0, 0, NULL);\n    }\n}\n```\n\nRefer to `references\u002Fpico_sdk_reference.md` for comprehensive USB API documentation including HID, MSC, and CDC examples.\n\n## Development Workflow\n\n### Step 1: Environment Setup\n\n**Install Dependencies:**\n```bash\n# Linux\u002FRaspberry Pi\nsudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi \\\n                 build-essential libstdc++-arm-none-eabi-newlib\n\n# macOS\nbrew install cmake\nbrew install --cask gcc-arm-embedded\n```\n\n**Clone Pico SDK:**\n```bash\ncd ~\ngit clone https:\u002F\u002Fgithub.com\u002Fraspberrypi\u002Fpico-sdk.git\ncd pico-sdk\ngit submodule update --init\nexport PICO_SDK_PATH=$(pwd)\n```\n\n### Step 2: Create Project from Template\n\nUse the provided project template:\n```bash\ncp -r assets\u002Fproject_template\u002F my_project\ncd my_project\n```\n\nEdit `CMakeLists.txt` to configure your project name and dependencies.\n\n### Step 3: Build\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake -j4\n```\n\nOutput files:\n- `my_project.elf` - ELF executable\n- `my_project.bin` - Binary image\n- `my_project.uf2` - USB bootloader format\n- `my_project.hex` - Intel HEX format\n\n### Step 4: Flash Firmware\n\n**Method 1: USB Bootloader (BOOTSEL mode)**\n```bash\n# 1. Hold BOOTSEL button while plugging in USB\n# 2. Copy UF2 file to mounted drive\ncp my_project.uf2 \u002Fmedia\u002F$USER\u002FRPI-RP2\u002F\n```\n\n**Method 2: Using Picoprobe\u002FSWD**\n```bash\n# Using OpenOCD with picoprobe\nopenocd -f interface\u002Fcmsis-dap.cfg \\\n        -f target\u002Frp2040.cfg \\\n        -c \"program my_project.elf verify reset exit\"\n```\n\n**Method 3: Using Flash Script**\nUse `scripts\u002Fflash.sh` for automated flashing:\n```bash\n.\u002Fscripts\u002Fflash.sh build\u002Fmy_project.uf2\n```\n\n### Step 5: Debug\n\n**Serial Debug Output:**\n```c\n#include \"pico\u002Fstdlib.h\"\n\nint main() {\n    stdio_init_all();\n\n    while (!tud_cdc_connected()) {\n        sleep_ms(100);\n    }\n\n    printf(\"Debug: System initialized\\n\");\n    \u002F\u002F Your code here\n}\n```\n\n**GDB Debugging with Picoprobe:**\n```bash\n# Terminal 1: Start OpenOCD\nopenocd -f interface\u002Fcmsis-dap.cfg -f target\u002Frp2040.cfg\n\n# Terminal 2: Start GDB\ngdb-multiarch my_project.elf\n(gdb) target remote localhost:3333\n(gdb) load\n(gdb) break main\n(gdb) continue\n```\n\nRefer to `.vscode\u002Flaunch.json` in the project template for VSCode debugging configuration.\n\n## Common Patterns\n\n### Pattern: Non-Blocking Timer\n\n```c\n#include \"pico\u002Ftime.h\"\n\ntypedef struct {\n    absolute_time_t last_trigger;\n    uint32_t interval_ms;\n} timer_t;\n\nvoid timer_init(timer_t *timer, uint32_t interval_ms) {\n    timer->interval_ms = interval_ms;\n    timer->last_trigger = get_absolute_time();\n}\n\nbool timer_expired(timer_t *timer) {\n    absolute_time_t now = get_absolute_time();\n    int64_t elapsed = absolute_time_diff_us(timer->last_trigger, now);\n\n    if (elapsed >= timer->interval_ms * 1000) {\n        timer->last_trigger = now;\n        return true;\n    }\n    return false;\n}\n\n\u002F\u002F Usage\nint main() {\n    timer_t blink_timer;\n    timer_init(&blink_timer, 500);  \u002F\u002F 500ms interval\n\n    while (1) {\n        if (timer_expired(&blink_timer)) {\n            gpio_xor_mask(1 \u003C\u003C LED_PIN);\n        }\n\n        \u002F\u002F Other non-blocking work\n        tight_loop_contents();\n    }\n}\n```\n\n### Pattern: State Machine\n\n```c\ntypedef enum {\n    STATE_IDLE,\n    STATE_RUNNING,\n    STATE_PAUSED,\n    STATE_COMPLETED\n} app_state_t;\n\ntypedef struct {\n    app_state_t state;\n    uint32_t counter;\n    bool button_pressed;\n} app_context_t;\n\nvoid state_machine_update(app_context_t *ctx) {\n    switch (ctx->state) {\n        case STATE_IDLE:\n            if (ctx->button_pressed) {\n                ctx->state = STATE_RUNNING;\n                ctx->counter = 0;\n            }\n            break;\n\n        case STATE_RUNNING:\n            ctx->counter++;\n            if (ctx->button_pressed) {\n                ctx->state = STATE_PAUSED;\n            }\n            if (ctx->counter >= 1000) {\n                ctx->state = STATE_COMPLETED;\n            }\n            break;\n\n        case STATE_PAUSED:\n            if (ctx->button_pressed) {\n                ctx->state = STATE_RUNNING;\n            }\n            break;\n\n        case STATE_COMPLETED:\n            \u002F\u002F Reset on button press\n            if (ctx->button_pressed) {\n                ctx->state = STATE_IDLE;\n            }\n            break;\n    }\n\n    ctx->button_pressed = false;\n}\n```\n\n### Pattern: Circular Buffer (Ring Buffer)\n\n```c\ntypedef struct {\n    uint8_t *buffer;\n    size_t size;\n    size_t head;\n    size_t tail;\n    size_t count;\n} ring_buffer_t;\n\nvoid ring_buffer_init(ring_buffer_t *rb, uint8_t *buffer, size_t size) {\n    rb->buffer = buffer;\n    rb->size = size;\n    rb->head = 0;\n    rb->tail = 0;\n    rb->count = 0;\n}\n\nbool ring_buffer_push(ring_buffer_t *rb, uint8_t data) {\n    if (rb->count >= rb->size) {\n        return false;  \u002F\u002F Buffer full\n    }\n\n    rb->buffer[rb->head] = data;\n    rb->head = (rb->head + 1) % rb->size;\n    rb->count++;\n    return true;\n}\n\nbool ring_buffer_pop(ring_buffer_t *rb, uint8_t *data) {\n    if (rb->count == 0) {\n        return false;  \u002F\u002F Buffer empty\n    }\n\n    *data = rb->buffer[rb->tail];\n    rb->tail = (rb->tail + 1) % rb->size;\n    rb->count--;\n    return true;\n}\n```\n\n## Performance Optimization\n\n### Memory Management\n\n**Stack Size Configuration:**\nIn `CMakeLists.txt`:\n```cmake\n# Increase stack size if needed\ntarget_compile_definitions(my_project PRIVATE\n    PICO_STACK_SIZE=0x2000  # 8KB stack\n    PICO_CORE1_STACK_SIZE=0x2000\n)\n```\n\n**Static vs Dynamic Allocation:**\n```c\n\u002F\u002F Prefer static allocation on embedded systems\nstatic uint8_t buffer[1024];\n\n\u002F\u002F Avoid malloc\u002Ffree if possible\n\u002F\u002F If needed, consider custom allocator\n```\n\n**Memory-Mapped I\u002FO:**\n```c\n#include \"hardware\u002Fregs\u002Faddressmap.h\"\n\n\u002F\u002F Direct register access (faster than SDK functions)\n#define GPIO_OUT_REG ((volatile uint32_t*)(SIO_BASE + 0x10))\n#define GPIO_OUT_SET ((volatile uint32_t*)(SIO_BASE + 0x14))\n#define GPIO_OUT_CLR ((volatile uint32_t*)(SIO_BASE + 0x18))\n#define GPIO_OUT_XOR ((volatile uint32_t*)(SIO_BASE + 0x1C))\n\n\u002F\u002F Fast GPIO toggle\n*GPIO_OUT_XOR = (1 \u003C\u003C LED_PIN);\n```\n\n### Code Optimization\n\n**Compiler Flags in CMakeLists.txt:**\n```cmake\n# Optimization level\ntarget_compile_options(my_project PRIVATE\n    -O3                    # Maximum optimization\n    -flto                  # Link-time optimization\n    -ffunction-sections    # Each function in own section\n    -fdata-sections        # Each data item in own section\n)\n\ntarget_link_options(my_project PRIVATE\n    -Wl,--gc-sections      # Remove unused sections\n)\n```\n\n**Inline Functions:**\n```c\nstatic inline void fast_gpio_toggle(uint gpio) {\n    sio_hw->gpio_togl = 1u \u003C\u003C gpio;\n}\n```\n\n**Use Hardware Features:**\n- DMA for large data transfers\n- PIO for bit-banging protocols\n- Hardware interpolators for calculations\n\n### Interrupt Optimization\n\n```c\n\u002F\u002F Keep ISRs short and fast\nvoid __isr __time_critical_func(gpio_isr)() {\n    \u002F\u002F Clear interrupt\n    gpio_acknowledge_irq(BUTTON_PIN, GPIO_IRQ_EDGE_FALL);\n\n    \u002F\u002F Set flag for main loop\n    volatile bool button_flag = true;\n\n    \u002F\u002F Don't call printf or blocking functions in ISR\n}\n```\n\n## Troubleshooting\n\n### Build Issues\n\n**SDK Not Found:**\n```bash\nexport PICO_SDK_PATH=\u002Fpath\u002Fto\u002Fpico-sdk\n```\n\n**Undefined Reference Errors:**\nAdd missing libraries in `CMakeLists.txt`:\n```cmake\ntarget_link_libraries(my_project\n    pico_stdlib\n    hardware_spi    # Add this\n    hardware_i2c    # Add this\n)\n```\n\n### Flashing Issues\n\n**Device Not Recognized:**\n1. Check USB cable (data capable, not charge-only)\n2. Verify BOOTSEL button held during power-on\n3. Check `lsusb` for RP2040 device (ID 2e8a:0003)\n\n**Permission Denied (Linux):**\n```bash\nsudo usermod -a -G dialout $USER\n# Log out and back in\n```\n\n### Runtime Issues\n\n**Crash on Startup:**\n- Check stack size (increase if needed)\n- Verify all peripherals initialized before use\n- Check for buffer overflows\n\n**GPIO Not Working:**\n- Verify pin numbers match board pinout\n- Check if pin already used by another peripheral\n- Ensure `gpio_init()` called before use\n\n**SPI\u002FI2C No Response:**\n- Verify wiring and pull-up resistors\n- Check clock frequencies\n- Use oscilloscope to verify signals\n- Try `i2c_scan()` to detect devices\n\n### Memory Issues\n\n**Out of RAM:**\n```c\n\u002F\u002F Check memory usage\nextern char __StackLimit, __bss_end__;\nprintf(\"Heap end: %p\\n\", &__bss_end__);\nprintf(\"Stack limit: %p\\n\", &__StackLimit);\n```\n\n**Reduce Memory Usage:**\n- Use smaller buffers\n- Move large arrays to flash: `const uint8_t data[] = {...};`\n- Optimize struct packing\n- Use bit fields for flags\n\n## Resources\n\nThis skill includes:\n\n### scripts\u002F\nBuild and deployment automation:\n- `build.sh` - Automated build script with error handling\n- `flash.sh` - Automated firmware flashing (supports BOOTSEL and picoprobe)\n- `monitor.sh` - Serial monitor for debugging output\n\n### references\u002F\nComprehensive technical documentation:\n- `pico_sdk_reference.md` - Complete Pico SDK API reference and examples\n- `cmake_configuration.md` - Advanced CMake patterns and build configurations\n- `hardware_interfaces.md` - Detailed hardware peripheral programming guide\n- `freertos_integration.md` - FreeRTOS setup and real-time task patterns\n\n### assets\u002F\nReady-to-use project templates and boilerplate:\n- `project_template\u002F` - Complete CMake project structure with examples\n  - `CMakeLists.txt` - Configured build system\n  - `pico_sdk_import.cmake` - SDK integration\n  - `.vscode\u002F` - VSCode debugging configuration\n  - `src\u002Fmain.c` - Minimal example application\n\nAll scripts and templates are production-ready and can be used directly or customized for specific applications.\n","# RP2350 C\u002FC++ Development with Pico SDK\n\n## Overview\n\nThis skill provides comprehensive guidance for developing high-performance embedded applications on RP2350 and RP2040 hardware using C\u002FC++ and the official Raspberry Pi Pico SDK. It covers project setup, CMake configuration, peripheral programming, memory optimization, multicore development, and FreeRTOS integration.\n\n## When to Use This Skill\n\nUse this skill when:\n\n- Developing C\u002FC++ firmware for RP2350 or RP2040 boards\n- Setting up Pico SDK projects with CMake\n- Implementing hardware drivers (GPIO, SPI, I2C, PWM, UART, ADC)\n- Writing interrupt service routines and DMA transfers\n- Building multicore applications utilizing both ARM cores\n- Integrating FreeRTOS for real-time task management\n- Optimizing memory usage and execution speed\n- Implementing USB device or host functionality\n- Working with PIO (Programmable I\u002FO) for custom protocols\n- Debugging with picoprobe or SWD interfaces\n- Porting applications from RP2040 to RP2350\n\n## Hardware Context\n\n### RP2350 Features\n\n- **Processor**: Dual ARM Cortex-M33 @ 150MHz (or dual RISC-V Hazard3 @ 150MHz)\n- **Memory**: 520KB SRAM, up to 16MB external flash\n- **Security**: ARM TrustZone-M, secure boot, signed firmware\n- **Peripherals**:\n  - 30 multifunction GPIO pins\n  - 2× UART, 2× SPI, 2× I2C\n  - 12-bit ADC with up to 5 channels\n  - 24× PWM channels\n  - 12× PIO state machines\n  - USB 1.1 host\u002Fdevice\n  - DMA controller with 12 channels\n- **Power**: 1.8-3.6V operation, sleep modes down to 180µA\n\n### RP2040 Features (for comparison)\n\n- **Processor**: Dual ARM Cortex-M0+ @ 133MHz\n- **Memory**: 264KB SRAM, up to 16MB external flash\n- **Peripherals**: Similar to RP2350 but without TrustZone and with lower performance\n\n## Core Capabilities\n\n### 1. Project Setup with CMake\n\nUse `assets\u002Fproject_template\u002F` for a complete CMake-based project structure.\n\n**Key Components:**\n- `CMakeLists.txt` - Main build configuration\n- `pico_sdk_import.cmake` - SDK integration\n- `.vscode\u002F` - VSCode configuration for debugging\n- `src\u002F` - Source code directory\n\n**Quick Start:**\n```bash\n# Copy template\ncp -r assets\u002Fproject_template\u002F my_project\ncd my_project\n\n# Configure environment\nexport PICO_SDK_PATH=\u002Fpath\u002Fto\u002Fpico-sdk\n\n# Build\nmkdir build && cd build\ncmake ..\nmake -j4\n```\n\n**CMakeLists.txt Structure:**\n```cmake\ncmake_minimum_required(VERSION 3.13)\n\n# Include SDK\ninclude(pico_sdk_import.cmake)\n\nproject(my_project C CXX ASM)\nset(CMAKE_C_STANDARD 11)\nset(CMAKE_CXX_STANDARD 17)\n\n# Initialize SDK\npico_sdk_init()\n\n# Add executable\nadd_executable(my_project\n    src\u002Fmain.c\n    src\u002Fperipheral_init.c\n)\n\n# Link libraries\ntarget_link_libraries(my_project\n    pico_stdlib\n    hardware_spi\n    hardware_i2c\n    hardware_pwm\n    hardware_adc\n)\n\n# Enable USB output, disable UART\npico_enable_stdio_usb(my_project 1)\npico_enable_stdio_uart(my_project 0)\n\n# Create map\u002Fbin\u002Fhex\u002Fuf2 files\npico_add_extra_outputs(my_project)\n```\n\nRefer to `references\u002Fcmake_configuration.md` for advanced CMake patterns including multicore builds, FreeRTOS integration, and custom linker scripts.\n\n### 2. GPIO and Basic I\u002FO\n\n**Initialization:**\n```c\n#include \"pico\u002Fstdlib.h\"\n\n\u002F\u002F Configure GPIO as output\nconst uint LED_PIN = 25;\ngpio_init(LED_PIN);\ngpio_set_dir(LED_PIN, GPIO_OUT);\n\n\u002F\u002F Configure GPIO as input with pull-up\nconst uint BUTTON_PIN = 15;\ngpio_init(BUTTON_PIN);\ngpio_set_dir(BUTTON_PIN, GPIO_IN);\ngpio_pull_up(BUTTON_PIN);\n```\n\n**Interrupt Handling:**\n```c\nvoid gpio_callback(uint gpio, uint32_t events) {\n    if (gpio == BUTTON_PIN && (events & GPIO_IRQ_EDGE_FALL)) {\n        \u002F\u002F Button pressed\n        gpio_put(LED_PIN, !gpio_get(LED_PIN));\n    }\n}\n\nint main() {\n    stdio_init_all();\n\n    gpio_init(LED_PIN);\n    gpio_set_dir(LED_PIN, GPIO_OUT);\n\n    gpio_init(BUTTON_PIN);\n    gpio_set_dir(BUTTON_PIN, GPIO_IN);\n    gpio_pull_up(BUTTON_PIN);\n\n    \u002F\u002F Enable interrupt\n    gpio_set_irq_enabled_with_callback(\n        BUTTON_PIN,\n        GPIO_IRQ_EDGE_FALL,\n        true,\n        &gpio_callback\n    );\n\n    while (1) {\n        tight_loop_contents();\n    }\n}\n```\n\n### 3. SPI Communication\n\n**Standard SPI Setup:**\n```c\n#include \"hardware\u002Fspi.h\"\n\n#define SPI_PORT spi0\n#define PIN_MISO 16\n#define PIN_CS   17\n#define PIN_SCK  18\n#define PIN_MOSI 19\n\nvoid spi_init_device() {\n    \u002F\u002F Initialize SPI at 10 MHz\n    spi_init(SPI_PORT, 10 * 1000 * 1000);\n\n    \u002F\u002F Configure GPIO for SPI\n    gpio_set_function(PIN_MISO, GPIO_FUNC_SPI);\n    gpio_set_function(PIN_SCK,  GPIO_FUNC_SPI);\n    gpio_set_function(PIN_MOSI, GPIO_FUNC_SPI);\n\n    \u002F\u002F Initialize CS pin as GPIO output\n    gpio_init(PIN_CS);\n    gpio_set_dir(PIN_CS, GPIO_OUT);\n    gpio_put(PIN_CS, 1);  \u002F\u002F CS high (inactive)\n}\n\nuint8_t spi_read_register(uint8_t reg) {\n    uint8_t data;\n    gpio_put(PIN_CS, 0);  \u002F\u002F CS low\n    spi_write_blocking(SPI_PORT, &reg, 1);\n    spi_read_blocking(SPI_PORT, 0, &data, 1);\n    gpio_put(PIN_CS, 1);  \u002F\u002F CS high\n    return data;\n}\n\nvoid spi_write_register(uint8_t reg, uint8_t value) {\n    uint8_t buf[2] = {reg, value};\n    gpio_put(PIN_CS, 0);\n    spi_write_blocking(SPI_PORT, buf, 2);\n    gpio_put(PIN_CS, 1);\n}\n```\n\n**DMA-Based SPI Transfer:**\n```c\n#include \"hardware\u002Fdma.h\"\n\nvoid spi_dma_transfer(uint8_t *tx_buf, uint8_t *rx_buf, size_t len) {\n    int dma_tx = dma_claim_unused_channel(true);\n    int dma_rx = dma_claim_unused_channel(true);\n\n    \u002F\u002F Configure TX DMA\n    dma_channel_config c_tx = dma_channel_get_default_config(dma_tx);\n    channel_config_set_transfer_data_size(&c_tx, DMA_SIZE_8);\n    channel_config_set_dreq(&c_tx, spi_get_dreq(SPI_PORT, true));\n\n    dma_channel_configure(\n        dma_tx, &c_tx,\n        &spi_get_hw(SPI_PORT)->dr,  \u002F\u002F dst\n        tx_buf,                      \u002F\u002F src\n        len,                         \u002F\u002F transfer count\n        false                        \u002F\u002F don't start yet\n    );\n\n    \u002F\u002F Configure RX DMA\n    dma_channel_config c_rx = dma_channel_get_default_config(dma_rx);\n    channel_config_set_transfer_data_size(&c_rx, DMA_SIZE_8);\n    channel_config_set_dreq(&c_rx, spi_get_dreq(SPI_PORT, false));\n    channel_config_set_read_increment(&c_rx, false);\n    channel_config_set_write_increment(&c_rx, true);\n\n    dma_channel_configure(\n        dma_rx, &c_rx,\n        rx_buf,                      \u002F\u002F dst\n        &spi_get_hw(SPI_PORT)->dr,  \u002F\u002F src\n        len,                         \u002F\u002F transfer count\n        false                        \u002F\u002F don't start yet\n    );\n\n    \u002F\u002F Start both channels\n    gpio_put(PIN_CS, 0);\n    dma_start_channel_mask((1u \u003C\u003C dma_tx) | (1u \u003C\u003C dma_rx));\n\n    \u002F\u002F Wait for completion\n    dma_channel_wait_for_finish_blocking(dma_rx);\n    gpio_put(PIN_CS, 1);\n\n    \u002F\u002F Release channels\n    dma_channel_unclaim(dma_tx);\n    dma_channel_unclaim(dma_rx);\n}\n```\n\n### 4. I2C Communication\n\n**I2C Setup and Operations:**\n```c\n#include \"hardware\u002Fi2c.h\"\n\n#define I2C_PORT i2c0\n#define I2C_SDA 4\n#define I2C_SCL 5\n#define I2C_FREQ 400000  \u002F\u002F 400 kHz\n\nvoid i2c_init_device() {\n    \u002F\u002F Initialize I2C at 400 kHz\n    i2c_init(I2C_PORT, I2C_FREQ);\n\n    \u002F\u002F Configure GPIO for I2C\n    gpio_set_function(I2C_SDA, GPIO_FUNC_I2C);\n    gpio_set_function(I2C_SCL, GPIO_FUNC_I2C);\n    gpio_pull_up(I2C_SDA);\n    gpio_pull_up(I2C_SCL);\n}\n\n\u002F\u002F Read single byte\nuint8_t i2c_read_byte(uint8_t addr, uint8_t reg) {\n    uint8_t data;\n    i2c_write_blocking(I2C_PORT, addr, &reg, 1, true);\n    i2c_read_blocking(I2C_PORT, addr, &data, 1, false);\n    return data;\n}\n\n\u002F\u002F Write single byte\nvoid i2c_write_byte(uint8_t addr, uint8_t reg, uint8_t value) {\n    uint8_t buf[2] = {reg, value};\n    i2c_write_blocking(I2C_PORT, addr, buf, 2, false);\n}\n\n\u002F\u002F Read multiple bytes\nint i2c_read_bytes(uint8_t addr, uint8_t reg, uint8_t *buf, size_t len) {\n    i2c_write_blocking(I2C_PORT, addr, &reg, 1, true);\n    return i2c_read_blocking(I2C_PORT, addr, buf, len, false);\n}\n\n\u002F\u002F I2C scanner\nvoid i2c_scan() {\n    printf(\"\\nI2C Bus Scan\\n\");\n    printf(\"   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\\n\");\n\n    for (int addr = 0; addr \u003C (1 \u003C\u003C 7); ++addr) {\n        if (addr % 16 == 0) {\n            printf(\"%02x \", addr);\n        }\n\n        int ret;\n        uint8_t rxdata;\n        ret = i2c_read_blocking(I2C_PORT, addr, &rxdata, 1, false);\n\n        printf(ret \u003C 0 ? \".\" : \"@\");\n        printf(addr % 16 == 15 ? \"\\n\" : \"  \");\n    }\n}\n```\n\n### 5. PWM for LED\u002FMotor Control\n\n**PWM Configuration:**\n```c\n#include \"hardware\u002Fpwm.h\"\n\nvoid pwm_init_pin(uint gpio, uint freq_hz, float duty_cycle) {\n    \u002F\u002F Configure GPIO for PWM\n    gpio_set_function(gpio, GPIO_FUNC_PWM);\n\n    \u002F\u002F Find PWM slice\n    uint slice_num = pwm_gpio_to_slice_num(gpio);\n\n    \u002F\u002F Calculate divider and wrap for desired frequency\n    uint32_t clock_freq = 125000000;  \u002F\u002F 125 MHz\n    uint32_t divider = clock_freq \u002F (freq_hz * 65536);\n    if (divider \u003C 1) divider = 1;\n\n    uint32_t wrap = (clock_freq \u002F (freq_hz * divider)) - 1;\n\n    \u002F\u002F Configure PWM\n    pwm_set_clkdiv(slice_num, divider);\n    pwm_set_wrap(slice_num, wrap);\n\n    \u002F\u002F Set duty cycle\n    uint16_t level = (uint16_t)(wrap * duty_cycle);\n    pwm_set_gpio_level(gpio, level);\n\n    \u002F\u002F Enable PWM\n    pwm_set_enabled(slice_num, true);\n}\n\n\u002F\u002F Example: RGB LED control\nvoid rgb_led_init(uint pin_r, uint pin_g, uint pin_b) {\n    pwm_init_pin(pin_r, 1000, 0.0);  \u002F\u002F 1 kHz, 0% duty\n    pwm_init_pin(pin_g, 1000, 0.0);\n    pwm_init_pin(pin_b, 1000, 0.0);\n}\n\nvoid rgb_led_set_color(uint pin_r, uint pin_g, uint pin_b,\n                       float r, float g, float b) {\n    uint slice_r = pwm_gpio_to_slice_num(pin_r);\n    uint slice_g = pwm_gpio_to_slice_num(pin_g);\n    uint slice_b = pwm_gpio_to_slice_num(pin_b);\n\n    uint16_t wrap = pwm_get_wrap(slice_r);\n\n    pwm_set_gpio_level(pin_r, (uint16_t)(wrap * r));\n    pwm_set_gpio_level(pin_g, (uint16_t)(wrap * g));\n    pwm_set_gpio_level(pin_b, (uint16_t)(wrap * b));\n}\n```\n\n### 6. ADC (Analog-to-Digital Converter)\n\n**ADC Reading:**\n```c\n#include \"hardware\u002Fadc.h\"\n\nvoid adc_init_all() {\n    adc_init();\n\n    \u002F\u002F Make sure GPIO is high-impedance, no pullups etc\n    adc_gpio_init(26);  \u002F\u002F ADC0\n    adc_gpio_init(27);  \u002F\u002F ADC1\n    adc_gpio_init(28);  \u002F\u002F ADC2\n}\n\nuint16_t adc_read_channel(uint channel) {\n    adc_select_input(channel);\n    return adc_read();\n}\n\nfloat adc_read_voltage(uint channel) {\n    adc_select_input(channel);\n    uint16_t raw = adc_read();\n    \u002F\u002F Convert to voltage (3.3V reference, 12-bit ADC)\n    return raw * 3.3f \u002F 4096.0f;\n}\n\n\u002F\u002F Read internal temperature sensor\nfloat read_onboard_temperature() {\n    adc_select_input(4);  \u002F\u002F Temperature sensor on ADC4\n    uint16_t raw = adc_read();\n\n    \u002F\u002F Convert to temperature (from RP2040 datasheet)\n    const float conversion = 3.3f \u002F 4096.0f;\n    float voltage = raw * conversion;\n    float temp_c = 27.0f - (voltage - 0.706f) \u002F 0.001721f;\n\n    return temp_c;\n}\n```\n\n### 7. Multicore Programming\n\n**Core1 Launch:**\n```c\n#include \"pico\u002Fmulticore.h\"\n\nvoid core1_entry() {\n    while (1) {\n        \u002F\u002F Core 1 work here\n        printf(\"Running on core 1\\n\");\n        sleep_ms(1000);\n    }\n}\n\nint main() {\n    stdio_init_all();\n\n    printf(\"Starting core 1\\n\");\n    multicore_launch_core1(core1_entry);\n\n    while (1) {\n        \u002F\u002F Core 0 work here\n        printf(\"Running on core 0\\n\");\n        sleep_ms(1000);\n    }\n}\n```\n\n**Intercore Communication:**\n```c\n#include \"pico\u002Fmulticore.h\"\n\n\u002F\u002F Core 0 to Core 1 FIFO\nvoid core0_send_to_core1(uint32_t data) {\n    multicore_fifo_push_blocking(data);\n}\n\n\u002F\u002F Core 1 receives from Core 0\nuint32_t core1_receive_from_core0() {\n    return multicore_fifo_pop_blocking();\n}\n\n\u002F\u002F Example: Core 1 worker\nvoid core1_worker() {\n    while (1) {\n        uint32_t cmd = multicore_fifo_pop_blocking();\n\n        switch (cmd) {\n            case 1:\n                \u002F\u002F Process command 1\n                break;\n            case 2:\n                \u002F\u002F Process command 2\n                break;\n        }\n\n        \u002F\u002F Send result back to Core 0\n        multicore_fifo_push_blocking(42);\n    }\n}\n```\n\n### 8. USB Device Implementation\n\n**USB Serial (CDC):**\nAlready enabled with `pico_enable_stdio_usb()` in CMakeLists.txt.\n\n**Custom USB Device:**\n```c\n#include \"tusb.h\"\n\n\u002F\u002F USB HID Keyboard example\nvoid send_key_press(uint8_t keycode) {\n    if (tud_hid_ready()) {\n        uint8_t report[8] = {0};\n        report[2] = keycode;  \u002F\u002F Keycode\n        tud_hid_keyboard_report(0, 0, report);\n\n        \u002F\u002F Release key\n        sleep_ms(10);\n        tud_hid_keyboard_report(0, 0, NULL);\n    }\n}\n```\n\nRefer to `references\u002Fpico_sdk_reference.md` for comprehensive USB API documentation including HID, MSC, and CDC examples.\n\n## Development Workflow\n\n### Step 1: Environment Setup\n\n**Install Dependencies:**\n```bash\n# Linux\u002FRaspberry Pi\nsudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi \\\n                 build-essential libstdc++-arm-none-eabi-newlib\n\n# macOS\nbrew install cmake\nbrew install --cask gcc-arm-embedded\n```\n\n**Clone Pico SDK:**\n```bash\ncd ~\ngit clone https:\u002F\u002Fgithub.com\u002Fraspberrypi\u002Fpico-sdk.git\ncd pico-sdk\ngit submodule update --init\nexport PICO_SDK_PATH=$(pwd)\n```\n\n### Step 2: Create Project from Template\n\nUse the provided project template:\n```bash\ncp -r assets\u002Fproject_template\u002F my_project\ncd my_project\n```\n\nEdit `CMakeLists.txt` to configure your project name and dependencies.\n\n### Step 3: Build\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake -j4\n```\n\nOutput files:\n- `my_project.elf` - ELF executable\n- `my_project.bin` - Binary image\n- `my_project.uf2` - USB bootloader format\n- `my_project.hex` - Intel HEX format\n\n### Step 4: Flash Firmware\n\n**Method 1: USB Bootloader (BOOTSEL mode)**\n```bash\n# 1. Hold BOOTSEL button while plugging in USB\n# 2. Copy UF2 file to mounted drive\ncp my_project.uf2 \u002Fmedia\u002F$USER\u002FRPI-RP2\u002F\n```\n\n**Method 2: Using Picoprobe\u002FSWD**\n```bash\n# Using OpenOCD with picoprobe\nopenocd -f interface\u002Fcmsis-dap.cfg \\\n        -f target\u002Frp2040.cfg \\\n        -c \"program my_project.elf verify reset exit\"\n```\n\n**Method 3: Using Flash Script**\nUse `scripts\u002Fflash.sh` for automated flashing:\n```bash\n.\u002Fscripts\u002Fflash.sh build\u002Fmy_project.uf2\n```\n\n### Step 5: Debug\n\n**Serial Debug Output:**\n```c\n#include \"pico\u002Fstdlib.h\"\n\nint main() {\n    stdio_init_all();\n\n    while (!tud_cdc_connected()) {\n        sleep_ms(100);\n    }\n\n    printf(\"Debug: System initialized\\n\");\n    \u002F\u002F Your code here\n}\n```\n\n**GDB Debugging with Picoprobe:**\n```bash\n# Terminal 1: Start OpenOCD\nopenocd -f interface\u002Fcmsis-dap.cfg -f target\u002Frp2040.cfg\n\n# Terminal 2: Start GDB\ngdb-multiarch my_project.elf\n(gdb) target remote localhost:3333\n(gdb) load\n(gdb) break main\n(gdb) continue\n```\n\nRefer to `.vscode\u002Flaunch.json` in the project template for VSCode debugging configuration.\n\n## Common Patterns\n\n### Pattern: Non-Blocking Timer\n\n```c\n#include \"pico\u002Ftime.h\"\n\ntypedef struct {\n    absolute_time_t last_trigger;\n    uint32_t interval_ms;\n} timer_t;\n\nvoid timer_init(timer_t *timer, uint32_t interval_ms) {\n    timer->interval_ms = interval_ms;\n    timer->last_trigger = get_absolute_time();\n}\n\nbool timer_expired(timer_t *timer) {\n    absolute_time_t now = get_absolute_time();\n    int64_t elapsed = absolute_time_diff_us(timer->last_trigger, now);\n\n    if (elapsed >= timer->interval_ms * 1000) {\n        timer->last_trigger = now;\n        return true;\n    }\n    return false;\n}\n\n\u002F\u002F Usage\nint main() {\n    timer_t blink_timer;\n    timer_init(&blink_timer, 500);  \u002F\u002F 500ms interval\n\n    while (1) {\n        if (timer_expired(&blink_timer)) {\n            gpio_xor_mask(1 \u003C\u003C LED_PIN);\n        }\n\n        \u002F\u002F Other non-blocking work\n        tight_loop_contents();\n    }\n}\n```\n\n### Pattern: State Machine\n\n```c\ntypedef enum {\n    STATE_IDLE,\n    STATE_RUNNING,\n    STATE_PAUSED,\n    STATE_COMPLETED\n} app_state_t;\n\ntypedef struct {\n    app_state_t state;\n    uint32_t counter;\n    bool button_pressed;\n} app_context_t;\n\nvoid state_machine_update(app_context_t *ctx) {\n    switch (ctx->state) {\n        case STATE_IDLE:\n            if (ctx->button_pressed) {\n                ctx->state = STATE_RUNNING;\n                ctx->counter = 0;\n            }\n            break;\n\n        case STATE_RUNNING:\n            ctx->counter++;\n            if (ctx->button_pressed) {\n                ctx->state = STATE_PAUSED;\n            }\n            if (ctx->counter >= 1000) {\n                ctx->state = STATE_COMPLETED;\n            }\n            break;\n\n        case STATE_PAUSED:\n            if (ctx->button_pressed) {\n                ctx->state = STATE_RUNNING;\n            }\n            break;\n\n        case STATE_COMPLETED:\n            \u002F\u002F Reset on button press\n            if (ctx->button_pressed) {\n                ctx->state = STATE_IDLE;\n            }\n            break;\n    }\n\n    ctx->button_pressed = false;\n}\n```\n\n### Pattern: Circular Buffer (Ring Buffer)\n\n```c\ntypedef struct {\n    uint8_t *buffer;\n    size_t size;\n    size_t head;\n    size_t tail;\n    size_t count;\n} ring_buffer_t;\n\nvoid ring_buffer_init(ring_buffer_t *rb, uint8_t *buffer, size_t size) {\n    rb->buffer = buffer;\n    rb->size = size;\n    rb->head = 0;\n    rb->tail = 0;\n    rb->count = 0;\n}\n\nbool ring_buffer_push(ring_buffer_t *rb, uint8_t data) {\n    if (rb->count >= rb->size) {\n        return false;  \u002F\u002F Buffer full\n    }\n\n    rb->buffer[rb->head] = data;\n    rb->head = (rb->head + 1) % rb->size;\n    rb->count++;\n    return true;\n}\n\nbool ring_buffer_pop(ring_buffer_t *rb, uint8_t *data) {\n    if (rb->count == 0) {\n        return false;  \u002F\u002F Buffer empty\n    }\n\n    *data = rb->buffer[rb->tail];\n    rb->tail = (rb->tail + 1) % rb->size;\n    rb->count--;\n    return true;\n}\n```\n\n## Performance Optimization\n\n### Memory Management\n\n**Stack Size Configuration:**\nIn `CMakeLists.txt`:\n```cmake\n# Increase stack size if needed\ntarget_compile_definitions(my_project PRIVATE\n    PICO_STACK_SIZE=0x2000  # 8KB stack\n    PICO_CORE1_STACK_SIZE=0x2000\n)\n```\n\n**Static vs Dynamic Allocation:**\n```c\n\u002F\u002F Prefer static allocation on embedded systems\nstatic uint8_t buffer[1024];\n\n\u002F\u002F Avoid malloc\u002Ffree if possible\n\u002F\u002F If needed, consider custom allocator\n```\n\n**Memory-Mapped I\u002FO:**\n```c\n#include \"hardware\u002Fregs\u002Faddressmap.h\"\n\n\u002F\u002F Direct register access (faster than SDK functions)\n#define GPIO_OUT_REG ((volatile uint32_t*)(SIO_BASE + 0x10))\n#define GPIO_OUT_SET ((volatile uint32_t*)(SIO_BASE + 0x14))\n#define GPIO_OUT_CLR ((volatile uint32_t*)(SIO_BASE + 0x18))\n#define GPIO_OUT_XOR ((volatile uint32_t*)(SIO_BASE + 0x1C))\n\n\u002F\u002F Fast GPIO toggle\n*GPIO_OUT_XOR = (1 \u003C\u003C LED_PIN);\n```\n\n### Code Optimization\n\n**Compiler Flags in CMakeLists.txt:**\n```cmake\n# Optimization level\ntarget_compile_options(my_project PRIVATE\n    -O3                    # Maximum optimization\n    -flto                  # Link-time optimization\n    -ffunction-sections    # Each function in own section\n    -fdata-sections        # Each data item in own section\n)\n\ntarget_link_options(my_project PRIVATE\n    -Wl,--gc-sections      # Remove unused sections\n)\n```\n\n**Inline Functions:**\n```c\nstatic inline void fast_gpio_toggle(uint gpio) {\n    sio_hw->gpio_togl = 1u \u003C\u003C gpio;\n}\n```\n\n**Use Hardware Features:**\n- DMA for large data transfers\n- PIO for bit-banging protocols\n- Hardware interpolators for calculations\n\n### Interrupt Optimization\n\n```c\n\u002F\u002F Keep ISRs short and fast\nvoid __isr __time_critical_func(gpio_isr)() {\n    \u002F\u002F Clear interrupt\n    gpio_acknowledge_irq(BUTTON_PIN, GPIO_IRQ_EDGE_FALL);\n\n    \u002F\u002F Set flag for main loop\n    volatile bool button_flag = true;\n\n    \u002F\u002F Don't call printf or blocking functions in ISR\n}\n```\n\n## Troubleshooting\n\n### Build Issues\n\n**SDK Not Found:**\n```bash\nexport PICO_SDK_PATH=\u002Fpath\u002Fto\u002Fpico-sdk\n```\n\n**Undefined Reference Errors:**\nAdd missing libraries in `CMakeLists.txt`:\n```cmake\ntarget_link_libraries(my_project\n    pico_stdlib\n    hardware_spi    # Add this\n    hardware_i2c    # Add this\n)\n```\n\n### Flashing Issues\n\n**Device Not Recognized:**\n1. Check USB cable (data capable, not charge-only)\n2. Verify BOOTSEL button held during power-on\n3. Check `lsusb` for RP2040 device (ID 2e8a:0003)\n\n**Permission Denied (Linux):**\n```bash\nsudo usermod -a -G dialout $USER\n# Log out and back in\n```\n\n### Runtime Issues\n\n**Crash on Startup:**\n- Check stack size (increase if needed)\n- Verify all peripherals initialized before use\n- Check for buffer overflows\n\n**GPIO Not Working:**\n- Verify pin numbers match board pinout\n- Check if pin already used by another peripheral\n- Ensure `gpio_init()` called before use\n\n**SPI\u002FI2C No Response:**\n- Verify wiring and pull-up resistors\n- Check clock frequencies\n- Use oscilloscope to verify signals\n- Try `i2c_scan()` to detect devices\n\n### Memory Issues\n\n**Out of RAM:**\n```c\n\u002F\u002F Check memory usage\nextern char __StackLimit, __bss_end__;\nprintf(\"Heap end: %p\\n\", &__bss_end__);\nprintf(\"Stack limit: %p\\n\", &__StackLimit);\n```\n\n**Reduce Memory Usage:**\n- Use smaller buffers\n- Move large arrays to flash: `const uint8_t data[] = {...};`\n- Optimize struct packing\n- Use bit fields for flags\n\n## Resources\n\nThis skill includes:\n\n### scripts\u002F\nBuild and deployment automation:\n- `build.sh` - Automated build script with error handling\n- `flash.sh` - Automated firmware flashing (supports BOOTSEL and picoprobe)\n- `monitor.sh` - Serial monitor for debugging output\n\n### references\u002F\nComprehensive technical documentation:\n- `pico_sdk_reference.md` - Complete Pico SDK API reference and examples\n- `cmake_configuration.md` - Advanced CMake patterns and build configurations\n- `hardware_interfaces.md` - Detailed hardware peripheral programming guide\n- `freertos_integration.md` - FreeRTOS setup and real-time task patterns\n\n### assets\u002F\nReady-to-use project templates and boilerplate:\n- `project_template\u002F` - Complete CMake project structure with examples\n  - `CMakeLists.txt` - Configured build system\n  - `pico_sdk_import.cmake` - SDK integration\n  - `.vscode\u002F` - VSCode debugging configuration\n  - `src\u002Fmain.c` - Minimal example application\n\nAll scripts and templates are production-ready and can be used directly or customized for specific applications.\n",{"name":5,"description":7},"main","7850740bd837adb32f0a109ab2af82482196c6f2","skills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp",1,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills","https:\u002F\u002Fzturnsgo.com","https:\u002F\u002Fgithub.com\u002Fshengdabai","https:\u002F\u002Fzturnsgo.com\u002F","AI × education creator — producer, not consumer. Taught 6,000+ learners; shipping learning tools & daily essays with Claude Code, practicing @xiaolai's way 🥋","2026-11-01 21:28:23",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add shengdabai\u002FTony-Claude-Code-Skills --skill rp2350-c-cpp",{"tool":70,"command":71},"bunx","bunx skills add shengdabai\u002FTony-Claude-Code-Skills --skill rp2350-c-cpp",{"tool":73,"command":74},"pnpm","pnpm dlx skills add shengdabai\u002FTony-Claude-Code-Skills --skill rp2350-c-cpp","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002FSKILL.md",true,[78,84,88,92,96,100,106,110,114,118,124,128],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"assets\u002Fproject_template\u002FCMakeLists.txt","ASSET","资产文件",836,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fassets\u002Fproject_template\u002FCMakeLists.txt",{"path":85,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":86,"sourceHtmlUrl":87},"assets\u002Fproject_template\u002Fdot_vscode\u002Flaunch.json",1218,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fassets\u002Fproject_template\u002Fdot_vscode\u002Flaunch.json",{"path":89,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":90,"sourceHtmlUrl":91},"assets\u002Fproject_template\u002Fpico_sdk_import.cmake",6022,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fassets\u002Fproject_template\u002Fpico_sdk_import.cmake",{"path":93,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":94,"sourceHtmlUrl":95},"assets\u002Fproject_template\u002FREADME.md",1591,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fassets\u002Fproject_template\u002FREADME.md",{"path":97,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":98,"sourceHtmlUrl":99},"assets\u002Fproject_template\u002Fsrc\u002Fmain.c",789,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fassets\u002Fproject_template\u002Fsrc\u002Fmain.c",{"path":101,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":104,"sourceHtmlUrl":105},"references\u002Fcmake_configuration.md","REFERENCE","参考文档",12039,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Freferences\u002Fcmake_configuration.md",{"path":107,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":108,"sourceHtmlUrl":109},"references\u002Ffreertos_integration.md",15760,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Freferences\u002Ffreertos_integration.md",{"path":111,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":112,"sourceHtmlUrl":113},"references\u002Fhardware_interfaces.md",14679,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Freferences\u002Fhardware_interfaces.md",{"path":115,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":116,"sourceHtmlUrl":117},"references\u002Fpico_sdk_reference.md",17582,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Freferences\u002Fpico_sdk_reference.md",{"path":119,"resourceType":120,"resourceTypeDesc":121,"sizeBytes":122,"sourceHtmlUrl":123},"scripts\u002Fexecutable_build.sh","SCRIPT","脚本",1616,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fscripts\u002Fexecutable_build.sh",{"path":125,"resourceType":120,"resourceTypeDesc":121,"sizeBytes":126,"sourceHtmlUrl":127},"scripts\u002Fexecutable_flash.sh",1976,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fscripts\u002Fexecutable_flash.sh",{"path":129,"resourceType":120,"resourceTypeDesc":121,"sizeBytes":130,"sourceHtmlUrl":131},"scripts\u002Fexecutable_monitor.sh",1287,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Frp2350-c-cpp\u002Fscripts\u002Fexecutable_monitor.sh",[133,150,178,203,225,245],{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":142,"publishedAt":49},"01M70P17DAD4C1C47NPH6A96EM","xiaolai-methodology","以李笑来(Li Xiaolai)的思考方式、方法论与表达风格,为用户做全方位 1-on-1 教练指导,覆盖创业、赚钱、投资、学习、自学、读书写作、用 AI、以及人生心态与自我管理。当用户提到 \"李笑来\"、\"笑来\"、\"笑来老师\"、\"扮演李笑来\"、\"找笑来聊聊\"、\"笑来怎么看\"、\"xiaolai\"、\"把时间当作朋友\"、\"通往财富自由之路\"、\"定投改变命运\"、\"韭菜的自我修养\"、\"自学是门手艺\"、\"让时间陪你慢慢变富\"、\"七年就是一辈子\"、\"元认知\"、\"活在未来\"、\"复利\u002F长期主义\"、\"践行\"、\"痴迷改进\"、\"个人商业模式\u002F出售时间\"、\"睡后收入\"、\"定投\"、\"财富自由\"、\"操作系统升级\"、\"最少必要知识\"、\"北极星提示词\"、\"用 AI 该怎么学\u002F思考\" 等任一触发词,或当用户带着关于创业\u002F赚钱\u002F投资\u002F学习\u002F职业\u002F重大人生决策的困惑、希望被人用笑来式的「逻辑 + 大白话 + 类比 + 重新定义 + 践行导向」来点醒和指导时,自动进入李笑来教练模式。","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fxiaolai-methodology\u002FSKILL.md",[139],{"categoryNo":140,"categoryName":141,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",[143,144,145,146,147,148,149],"methodology","xiaolai","xiaolai methodology","朋友","投资","writing","收入",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":158,"publishedAt":49},"01M70P13NB9YP7ACJR1S861CDS","zread","Produce and consume a wiki-style knowledge base for a code repository via the `zread` CLI and its on-disk output under `.\u002F.zread\u002Fwiki\u002F`. Use this skill whenever the user wants to understand, onboard onto, explore, summarize, map, or get an overview of an unfamiliar codebase; asks for architecture docs, a project wiki, a repo walkthrough, module\u002Fpackage explanations, or \"what does this repo do\"; wants to generate, regenerate, resume, browse, or serve code documentation locally; or mentions zread \u002F zread.ai directly. Also use it proactively before diving into a large unknown repo — if `.\u002F.zread\u002Fwiki\u002Fcurrent` exists, read the generated pages instead of crawling source file-by-file; if it doesn't, consider offering to run `zread generate`. The trigger is the intent (understand a codebase through generated docs), not the literal word \"zread\".","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fzread\u002FSKILL.md",[156,157],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},[152,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177],"knowledge","wiki","explore","walkthrough","project","get","knowledge base","run","generate","intent","cli","map","documentation","project wiki","disk","architecture","code","unknown","generated",{"skillNo":179,"name":180,"nameZh":6,"description":181,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":182,"categories":183,"keywords":188,"publishedAt":49},"01M70P10S4SWMZQ8BJAFBFDRW3","youtube","Launch the YouTube Creator Agent to auto-generate videos.\nUse when: user types \u002Fyoutube, wants to create YouTube videos,\ngenerate video content, or upload to YouTube.\nKeywords: youtube, video, 视频, 创作视频, 发布视频","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube\u002FSKILL.md",[184,185],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":186,"categoryName":187,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000036","内容创作者",[180,189,190,191,192,193,194,195,167,196,197,198,32,41,199,200,201,202],"user","content","视频","creator","generate video","videos","launch","video content","create","upload","auto","types","Video","创作",{"skillNo":204,"name":205,"nameZh":6,"description":206,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":207,"categories":208,"keywords":210,"publishedAt":49},"01M70P0YE95D8BACZCGV8BK90K","youtube-script-sync","Sync, update, or optimize Tony's GetNote knowledge base `Youtube视频逐字稿` by turning each parent recording or first-person idea note into an idempotent child note containing a directly recordable YouTube long-video or Shorts script. Use when the user says “更新\u002F同步\u002F优化 Youtube视频逐字稿知识库”, or says “更新\u002F同步\u002F优化该知识库” while this knowledge base is the active context.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-script-sync\u002FSKILL.md",[209],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[211,212,180,213,214,201,215,216,217,218,219,220,221,222,165,223,32,41,159,224],"sync","script","youtube script sync","recording","shorts","first","base","person","update","active","child","optimize","idempotent","long",{"skillNo":226,"name":227,"nameZh":6,"description":228,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":229,"categories":230,"keywords":235,"publishedAt":49},"01M70P0WMV5XT0EEC0N445PW07","writing-skills","How to write SKILL.md files that trigger reliably and teach effectively. Use when creating, improving, or reviewing Claude Code skills.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fxiaolai\u002Fnlpm\u002Fskills\u002Fnlpm\u002Fwriting-skills\u002FSKILL.md",[231,232,233,234],{"categoryNo":140,"categoryName":141,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},{"categoryNo":186,"categoryName":187,"taxonomyType":26,"taxonomyTypeDesc":27},[236,148,237,238,239,240,175,32,41,241,242,243,244],"writing skills","how","teach","write skill","write","claude code skills","files","how to","trigger",{"skillNo":246,"name":247,"nameZh":6,"description":248,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":249,"categories":250,"keywords":253,"publishedAt":49},"01M70P0SJFR4YVJQBGMHKGSKXT","writing-rules","How to write .claude\u002Frules\u002F files that Claude actually follows. Use when creating, improving, or reviewing project rules.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fxiaolai\u002Fnlpm\u002Fskills\u002Fnlpm\u002Fwriting-rules\u002FSKILL.md",[251,252],{"categoryNo":140,"categoryName":141,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":186,"categoryName":187,"taxonomyType":26,"taxonomyTypeDesc":27},[254,148,255,163,256,242,32,237,240,41,243],"Rules","writing rules","project rules"]