{"id":30587514,"url":"https://github.com/mytechnotalent/rust_embassy_pico_project","last_synced_at":"2026-07-13T05:31:27.384Z","repository":{"id":296571712,"uuid":"993831292","full_name":"mytechnotalent/rust_embassy_pico_project","owner":"mytechnotalent","description":"A simple embedded Rust project running on the Raspberry Pi Pico (RP2040), built with Embassy async framework and no_std runtime.","archived":false,"fork":false,"pushed_at":"2025-11-26T21:39:11.000Z","size":32176,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-29T17:13:22.384Z","etag":null,"topics":["embassy","embassy-rs","embedded-rust","pi-pico","pico","raspberry-pi-pico","rp2040","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mytechnotalent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-31T16:06:24.000Z","updated_at":"2025-11-26T21:39:15.000Z","dependencies_parsed_at":"2025-06-06T15:48:06.738Z","dependency_job_id":"14f3de69-2b81-4aa5-a6e6-80e7183a9612","html_url":"https://github.com/mytechnotalent/rust_embassy_pico_project","commit_stats":null,"previous_names":["mytechnotalent/embassy-pico-neo-button","mytechnotalent/rust-embassy-pico-project","mytechnotalent/rust_embassy_pico_project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mytechnotalent/rust_embassy_pico_project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mytechnotalent%2Frust_embassy_pico_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mytechnotalent%2Frust_embassy_pico_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mytechnotalent%2Frust_embassy_pico_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mytechnotalent%2Frust_embassy_pico_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mytechnotalent","download_url":"https://codeload.github.com/mytechnotalent/rust_embassy_pico_project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mytechnotalent%2Frust_embassy_pico_project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35412244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embassy","embassy-rs","embedded-rust","pi-pico","pico","raspberry-pi-pico","rp2040","rust"],"created_at":"2025-08-29T12:40:44.419Z","updated_at":"2026-07-13T05:31:27.373Z","avatar_url":"https://github.com/mytechnotalent.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://github.com/mytechnotalent/rust_embassy_pico_project/blob/main/rust_embassy_pico_project.jpg?raw=true)\n\n## FREE Reverse Engineering Self-Study Course [HERE](https://github.com/mytechnotalent/Reverse-Engineering-Tutorial)\n\n\u003cbr\u003e\n\n# Rust Embassy Pico Project\nA simple embedded Rust project running on the Raspberry Pi Pico (RP2040), built with Embassy async framework and no_std runtime.\n\n\u003cbr\u003e\n\n# Wiring\n![image](https://github.com/mytechnotalent/embassy-pico-neo-button/blob/main/diagrams/Debug-Probe-Wiring.png?raw=true)\n![image](https://github.com/mytechnotalent/embassy-pico-neo-button/blob/main/diagrams/rust_embassy_pico_project.png?raw=true)\n\n\u003cbr\u003e\n\n# Features\n- Configures an onboard LED (GPIO25).\n- Configures a button (GPIO16) with internal pull-up.\n- Turns LED on when button is pressed, off when released.\n- Debounces the button with async timer.\n- Runs under Embassy's async executor with no RTOS, no heap.\n\n\u003cbr\u003e\n\n# Project Structure\n- `main.rs`: Initializes Embassy, spawns the main async task.\n- `button.rs`: Provides button GPIO initialization.\n- `led.rs`: Provides simple onboard LED control abstraction.\n- `run_cycle.rs`: Defines a single button-press LED-control cycle.\n\n\u003cbr\u003e\n\n# How It Works (Step-by-Step)\n1. **Startup**\n   - The RP2040 boot ROM loads your program from flash.\n   - The Cortex-M `cortex-m-rt` runtime (`#[no_main]`) skips the traditional `main()` and jumps into the reset vector.\n   - The `__cortex_m_rt_main_trampoline` is called automatically at startup.\n   - `__cortex_m_rt_main_trampoline` calls `__cortex_m_rt_main`, which manually initializes and starts the async executor.\n2. **Executor Initialization**\n   - A static instance of `Executor` is created by `transmute`-ing a stack object to `'static` lifetime.\n   - `executor.run()` is called, entering Embassy’s async runtime loop.\n   - A `Spawner` is provided by the executor, allowing you to spawn tasks.\n3. **Task Spawning (Enqueue Operation)**\n   - `Spawner::must_spawn(__embassy_main(spawner))` is called.\n   - The `__embassy_main_task` future is created and wrapped into a `Task`.\n   - **Enqueue**:\n     - The Task is added to the **Task Queue**, a statically allocated double-ended queue (deque) implemented internally by the Executor.\n     - This is a lock-free queue; in single-core systems like RP2040, no locks are needed.\n     - Enqueue happens at the **tail** (back) of the queue — FIFO behavior is preserved.\n4. **Executor Main Loop (Deque + Polling)**\n   - The Executor enters its main loop:\n     - **Dequeue**:\n       - A Task is popped from the **head** (front) of the queue.\n     - The Executor **polls** the Task’s future by calling its `poll()` method.\n       - If the Future returns `Poll::Pending`, it means it cannot complete immediately:\n         - The Task registers a `Waker` — when an awaited event (e.g., timer, GPIO interrupt) completes, the Waker re-schedules the task.\n         - The task is then re-**enqueued** at the tail for future polling.\n       - If the Future returns `Poll::Ready`, the Task has completed:\n         - The Task is **dropped** and removed permanently from the system.\n     - If there are no tasks left in the queue, the Executor executes a `WFI` (Wait-For-Interrupt) instruction, entering low-power sleep until an interrupt occurs.\n5. **Peripheral Setup**\n   - In the spawned `____embassy_main_task`:\n     - `embassy_rp::init()` is called to set up clocks, watchdog, and peripherals.\n     - `PIN_16` is configured as an input GPIO with an internal pull-up resistor (for the button).\n     - `PIN_25` is configured as an output GPIO (for the onboard LED).\n6. **Task Execution**\n   - Inside the `loop {}`:\n     - `run_cycle` is called and awaited:\n       - Waits for a button press (falling edge detected on the input pin).\n       - Turns the LED on by driving `PIN_25` high.\n       - Waits for a button release (rising edge).\n       - Turns the LED off by driving `PIN_25` low.\n       - Waits 10ms for debounce using `Timer::after_millis`.\n     - `run_cycle` returns `Poll::Ready`, but since it's inside an infinite loop, a new future is immediately constructed for the next cycle.\n   - As `run_cycle` awaits on GPIO events and timers, the task yields control back to the Executor, causing the task to be **re-enqueued** and other pending tasks (if any) to be polled.\n7. **Event Handling and Re-Scheduling**\n   - When the awaited GPIO or timer event completes:\n     - The Task’s registered `Waker` is triggered.\n     - The Task is **re-enqueued** into the Task Queue tail.\n     - On the next executor loop iteration, it will be **dequeued** and `poll()` will resume where it left off in its await.\n8. **Continuous Loop**\n   - The `____embassy_main_task` is never terminated due to its infinite loop.\n   - This cycle continues indefinitely, reacting to button presses/releases, toggling the LED accordingly.\n\n\u003cbr\u003e\n\n# Embassy Executor Enqueue/Dequeue In Detail\n- **Enqueue (Push-Back)**:\n  - When a `Future` yields `Poll::Pending`, the Task’s Waker will call `spawn()`.\n  - Internally, this pushes the Task to the **back** of the Task Queue.\n  - The Task Queue is lock-free, array-backed with bounded capacity.\n  - Waker ensures the task is only enqueued if it was not already enqueued (no duplication).\n- **Dequeue (Pop-Front)**:\n  - Executor pops a Task from the **front** of the queue (FIFO order).\n  - Calls `poll()` on the Task.\n  - If `Poll::Pending`, the Task will re-enqueue after its awaited event is ready.\n  - If `Poll::Ready`, the Task is cleaned up and removed.\n- **Task Scheduling**:\n  - Tasks are cooperatively scheduled.\n  - No preemption — a task must yield (await) to allow others to run.\n  - If all tasks are `Pending`, Executor enters WFI (low-power wait).\n- **Wakers**:\n  - Embassy provides a lightweight Waker implementation tied to the Task.\n  - When a peripheral (e.g., Timer or GPIO interrupt) completes, the Waker triggers the task re-enqueue.\n- **No Dynamic Memory**:\n  - All Tasks are statically allocated.\n  - The queue and task structures are baked into flash/ram at compile time.\n  - Ensures no heap fragmentation and determinism — critical for embedded systems.\n\n\u003cbr\u003e\n\n# Deep Dive: From Reset to `run_cycle` Poll\nBelow is **every** assembler instruction captured, with mangled ↔ demangled names and addresses.\n\n## 1. Reset Vector (`Reset` @ 0x100001c0)\n```asm\n0x100001c0 \u003c+0\u003e:   bl      0x10007a94 \u003c__pre_init\u003e\n0x100001c4 \u003c+4\u003e:   ldr     r0, [pc, #32]   @ (0x100001e8)\n0x100001c6 \u003c+6\u003e:   ldr     r1, [pc, #36]   @ (0x100001ec)\n0x100001c8 \u003c+8\u003e:   movs    r2, #0\n0x100001ca \u003c+10\u003e:  cmp     r1, r0\n0x100001cc \u003c+12\u003e:  beq.n   0x100001d2 \u003cReset+18\u003e\n0x100001ce \u003c+14\u003e:  stmia   r0!, {r2}\n0x100001d0 \u003c+16\u003e:  b.n     0x100001ca \u003cReset+10\u003e\n0x100001d2 \u003c+18\u003e:  ldr     r0, [pc, #28]   @ (0x100001f0)\n0x100001d4 \u003c+20\u003e:  ldr     r1, [pc, #28]   @ (0x100001f4)\n0x100001d6 \u003c+22\u003e:  ldr     r2, [pc, #32]   @ (0x100001f8)\n0x100001d8 \u003c+24\u003e:  cmp     r1, r0\n0x100001da \u003c+26\u003e:  beq.n   0x100001e2 \u003cReset+34\u003e\n0x100001dc \u003c+28\u003e:  ldmia   r2!, {r3}\n0x100001de \u003c+30\u003e:  stmia   r0!, {r3}\n0x100001e0 \u003c+32\u003e:  b.n     0x100001d8 \u003cReset+24\u003e\n0x100001e2 \u003c+34\u003e:  bl      0x1000066c \u003cmain\u003e\n0x100001e6 \u003c+38\u003e:  udf     #0\n```\n## 2. `main` Trampoline (@ 0x1000066c)\n```asm\n0x1000066c \u003c+0\u003e:   push    {r7, lr}\n0x1000066e \u003c+2\u003e:   add     r7, sp, #0\n0x10000670 \u003c+4\u003e:   bl      0x10000674 \u003c_ZN25rust_embassy_pico_project18__cortex_m_rt_main17h…\u003e\n```\n## 3. `__cortex_m_rt_main` (@ 0x10000674)\n```asm\n0x10000674 \u003c+0\u003e:   push    {r7, lr}\n0x10000676 \u003c+2\u003e:   add     r7, sp, #0\n0x10000678 \u003c+4\u003e:   sub     sp, #16\n0x1000067a \u003c+6\u003e:   bl      0x10009a20 \u003c_ZN16embassy_executor4arch6thread8Executor3new17h…\u003e\n0x1000067e \u003c+10\u003e:  str     r0, [sp, #4]\n0x10000680 \u003c+12\u003e:  str     r1, [sp, #8]\n0x10000682 \u003c+14\u003e:  add     r0, sp, #4\n0x10000684 \u003c+16\u003e:  bl      0x10000e24 \u003c_ZN25rust_embassy_pico_project18__cortex_m_rt_main13__make_static17h…\u003e\n0x10000688 \u003c+20\u003e:  str     r0, [sp, #12]\n0x1000068a \u003c+22\u003e:  bl      0x1000163c \u003c_ZN16embassy_executor4arch6thread8Executor3run17h…\u003e\n```\n## 4. `Executor::new` → `raw::Executor::new` → `SyncExecutor::new`\n - **Executor::new** (`arch::cortex_m.rs:77`): calls `raw::Executor::new(THREAD_PENDER)`\n - **raw::Executor::new** (mod.rs:495): creates `SyncExecutor::new`\n - **SyncExecutor::new** (mod.rs:383): `run_queue: RunQueue::new()`\n - **RunQueue::new** (run_queue_critical_section.rs:35): `head: Mutex::new(Cell::new(None))`, etc.\n## 5. `Executor::run` (@ 0x1000163c)\n```asm\n0x1000163c \u003c+0\u003e:   push    {r7, lr}\n0x1000163e \u003c+2\u003e:   add     r7, sp, #0\n0x10001640 \u003c+4\u003e:   sub     sp, #16\n0x10001642 \u003c+6\u003e:   str     r0, [sp, #4]\n0x10001644 \u003c+8\u003e:   str     r0, [sp, #8]\n0x10001646 \u003c+10\u003e: bl      0x10009dba \u003craw::Executor::spawner\u003e\n0x1000164a \u003c+14\u003e: bl      0x10000e30 \u003c__cortex_m_rt_main::{closure}\u003e\n0x10001650 \u003c+20\u003e: ldr     r0, [sp, #4]\n0x10001652 \u003c+22\u003e: bl      0x10009daa \u003craw::Executor::poll\u003e\n0x10001656 \u003c+26\u003e: wfe\n0x10001658 \u003c+28\u003e: b.n     0x10001650\n```\n## 6. `run_cycle` Future Constructor (@ 0x10001904)\n```asm\n0x10001904 \u003c+0\u003e:   push    {r7, lr}\n0x10001906 \u003c+2\u003e:   add     r7, sp, #0\n0x10001908 \u003c+4\u003e:   sub     sp, #12\n0x1000190a \u003c+6\u003e:   str     r1, [sp, #0]     # button ptr\n0x1000190c \u003c+8\u003e:   mov     r1, r0\n0x1000190e \u003c+10\u003e:  ldr     r0, [sp, #0]     # button\n0x10001910 \u003c+12\u003e:  str     r0, [sp, #4]     # store in struct\n0x10001912 \u003c+14\u003e:  str     r2, [sp, #8]     # store led ptr\n0x10001914 \u003c+16\u003e:  str     r0, [r1, #0]\n0x10001916 \u003c+18\u003e:  str     r2, [r1, #4]\n0x10001918 \u003c+20\u003e:  movs    r0, #0           # initial state=0\n0x1000191a \u003c+22\u003e:  strb    r0, [r1, #16]    # .state=0\n0x1000191c \u003c+24\u003e:  add     sp, #12\n0x1000191e \u003c+26\u003e:  pop     {r7, pc}\n```\n## 7. `run_cycle` Poll State Machine (@ 0x100006a0)\n```asm\n0x100006a0 \u003c+0\u003e:     push    {r4, r6, r7, lr}\n0x100006a2 \u003c+2\u003e:     add     r7, sp, #8\n0x100006a4 \u003c+4\u003e:     sub     sp, #192        @ 0xc0\n0x100006a6 \u003c+6\u003e:     str     r1, [sp, #20]\n0x100006a8 \u003c+8\u003e:     str     r0, [sp, #28]\n0x100006aa \u003c+10\u003e:    str     r1, [sp, #136]  @ 0x88\n0x100006ac \u003c+12\u003e:    ldr     r0, [sp, #28]\n0x100006ae \u003c+14\u003e:    ldrb    r0, [r0, #16]\n0x100006b0 \u003c+16\u003e:    str     r0, [sp, #24]\n0x100006b2 \u003c+18\u003e:    ldr     r0, [sp, #24]\n0x100006b4 \u003c+20\u003e:    lsls    r1, r0, #2\n0x100006b6 \u003c+22\u003e:    add     r0, pc, #4      @ (adr r0, 0x100006bc \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+28\u003e)\n0x100006b8 \u003c+24\u003e:    ldr     r0, [r0, r1]\n0x100006ba \u003c+26\u003e:    mov     pc, r0\n0x100006bc \u003c+28\u003e:    lsls    r3, r3, #27\n0x100006be \u003c+30\u003e:    asrs    r0, r0, #32\n0x100006c0 \u003c+32\u003e:    lsls    r1, r7, #27\n0x100006c2 \u003c+34\u003e:    asrs    r0, r0, #32\n0x100006c4 \u003c+36\u003e:    lsls    r1, r3, #27\n0x100006c6 \u003c+38\u003e:    asrs    r0, r0, #32\n0x100006c8 \u003c+40\u003e:    lsls    r1, r0, #28\n0x100006ca \u003c+42\u003e:    asrs    r0, r0, #32\n0x100006cc \u003c+44\u003e:    lsls    r7, r0, #28\n0x100006ce \u003c+46\u003e:    asrs    r0, r0, #32\n0x100006d0 \u003c+48\u003e:    lsls    r5, r1, #28\n0x100006d2 \u003c+50\u003e:    asrs    r0, r0, #32\n0x100006d4 \u003c+52\u003e:    lsls    r3, r2, #28\n0x100006d6 \u003c+54\u003e:    asrs    r0, r0, #32\n0x100006d8 \u003c+56\u003e:    udf     #254    @ 0xfe\n0x100006da \u003c+58\u003e:    ldr     r0, [sp, #20]\n0x100006dc \u003c+60\u003e:    str     r0, [sp, #132]  @ 0x84\n0x100006de \u003c+62\u003e:    ldr     r1, [sp, #28]\n0x100006e0 \u003c+64\u003e:    ldr     r0, [r1, #0]\n0x100006e2 \u003c+66\u003e:    str     r0, [r1, #8]\n0x100006e4 \u003c+68\u003e:    ldr     r1, [sp, #28]\n0x100006e6 \u003c+70\u003e:    ldr     r0, [r1, #4]\n0x100006e8 \u003c+72\u003e:    str     r0, [r1, #12]\n0x100006ea \u003c+74\u003e:    ldr     r0, [sp, #28]\n0x100006ec \u003c+76\u003e:    ldr     r0, [r0, #12]\n0x100006ee \u003c+78\u003e:    bl      0x100005d6 \u003c_ZN10embassy_rp4gpio5Input6is_low17h279e6840f083881cE\u003e\n0x100006f2 \u003c+82\u003e:    cmp     r0, #0\n0x100006f4 \u003c+84\u003e:    bne.n   0x10000740 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+160\u003e\n0x100006f6 \u003c+86\u003e:    b.n     0x10000718 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+120\u003e\n0x100006f8 \u003c+88\u003e:    movs    r0, #0\n0x100006fa \u003c+90\u003e:    cmp     r0, #0\n0x100006fc \u003c+92\u003e:    bne.n   0x100006f8 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+88\u003e\n0x100006fe \u003c+94\u003e:    b.n     0x1000077a \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+218\u003e\n0x10000700 \u003c+96\u003e:    ldr     r0, [sp, #20]\n0x10000702 \u003c+98\u003e:    str     r0, [sp, #132]  @ 0x84\n0x10000704 \u003c+100\u003e:   b.n     0x10000768 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+200\u003e\n0x10000706 \u003c+102\u003e:   ldr     r0, [sp, #20]\n0x10000708 \u003c+104\u003e:   str     r0, [sp, #132]  @ 0x84\n0x1000070a \u003c+106\u003e:   b.n     0x1000079c \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+252\u003e\n0x1000070c \u003c+108\u003e:   ldr     r0, [sp, #20]\n0x1000070e \u003c+110\u003e:   str     r0, [sp, #132]  @ 0x84\n0x10000710 \u003c+112\u003e:   b.n     0x100007f8 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+344\u003e\n0x10000712 \u003c+114\u003e:   ldr     r0, [sp, #20]\n0x10000714 \u003c+116\u003e:   str     r0, [sp, #132]  @ 0x84\n0x10000716 \u003c+118\u003e:   b.n     0x1000085c \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+444\u003e\n0x10000718 \u003c+120\u003e:   ldr     r0, [sp, #28]\n0x1000071a \u003c+122\u003e:   ldr     r1, [r0, #12]\n0x1000071c \u003c+124\u003e:   add     r0, sp, #84     @ 0x54\n0x1000071e \u003c+126\u003e:   str     r0, [sp, #16]\n0x10000720 \u003c+128\u003e:   bl      0x100005a6 \u003c_ZN10embassy_rp4gpio5Input12wait_for_low17h2cb7b01158f39cecE\u003e\n0x10000724 \u003c+132\u003e:   ldr     r1, [sp, #16]\n0x10000726 \u003c+134\u003e:   add     r0, sp, #68     @ 0x44\n0x10000728 \u003c+136\u003e:   bl      0x10001378 \u003c_ZN59_$LT$F$u20$as$u20$core..future..into_future..IntoFuture$GT$11into_future17h2ba7c62ecd8f03eaE\u003e\n0x1000072c \u003c+140\u003e:   ldr     r1, [sp, #28]\n0x1000072e \u003c+142\u003e:   ldr     r0, [sp, #80]   @ 0x50\n0x10000730 \u003c+144\u003e:   str     r0, [r1, #32]\n0x10000732 \u003c+146\u003e:   ldr     r0, [sp, #76]   @ 0x4c\n0x10000734 \u003c+148\u003e:   str     r0, [r1, #28]\n0x10000736 \u003c+150\u003e:   ldr     r0, [sp, #72]   @ 0x48\n0x10000738 \u003c+152\u003e:   str     r0, [r1, #24]\n0x1000073a \u003c+154\u003e:   ldr     r0, [sp, #68]   @ 0x44\n0x1000073c \u003c+156\u003e:   str     r0, [r1, #20]\n0x1000073e \u003c+158\u003e:   b.n     0x1000079c \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+252\u003e\n0x10000740 \u003c+160\u003e:   ldr     r0, [sp, #28]\n0x10000742 \u003c+162\u003e:   ldr     r1, [r0, #12]\n0x10000744 \u003c+164\u003e:   add     r0, sp, #52     @ 0x34\n0x10000746 \u003c+166\u003e:   str     r0, [sp, #12]\n0x10000748 \u003c+168\u003e:   bl      0x100005be \u003c_ZN10embassy_rp4gpio5Input13wait_for_high17h9118f9d341070139E\u003e\n0x1000074c \u003c+172\u003e:   ldr     r1, [sp, #12]\n0x1000074e \u003c+174\u003e:   add     r0, sp, #36     @ 0x24\n0x10000750 \u003c+176\u003e:   bl      0x100013d6 \u003c_ZN59_$LT$F$u20$as$u20$core..future..into_future..IntoFuture$GT$11into_future17hf8591a67ae3e02adE\u003e\n0x10000754 \u003c+180\u003e:   ldr     r1, [sp, #28]\n0x10000756 \u003c+182\u003e:   ldr     r0, [sp, #48]   @ 0x30\n0x10000758 \u003c+184\u003e:   str     r0, [r1, #32]\n0x1000075a \u003c+186\u003e:   ldr     r0, [sp, #44]   @ 0x2c\n0x1000075c \u003c+188\u003e:   str     r0, [r1, #28]\n0x1000075e \u003c+190\u003e:   ldr     r0, [sp, #40]   @ 0x28\n0x10000760 \u003c+192\u003e:   str     r0, [r1, #24]\n0x10000762 \u003c+194\u003e:   ldr     r0, [sp, #36]   @ 0x24\n0x10000764 \u003c+196\u003e:   str     r0, [r1, #20]\n0x10000766 \u003c+198\u003e:   b.n     0x10000768 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+200\u003e\n0x10000768 \u003c+200\u003e:   ldr     r0, [sp, #28]\n0x1000076a \u003c+202\u003e:   adds    r0, #20\n0x1000076c \u003c+204\u003e:   str     r0, [sp, #188]  @ 0xbc\n0x1000076e \u003c+206\u003e:   ldr     r1, [sp, #132]  @ 0x84\n0x10000770 \u003c+208\u003e:   bl      0x10001274 \u003c_ZN10embassy_rp4gpio5Input13wait_for_high28_$u7b$$u7b$closure$u7d$$u7d$17h76cb204e6020303dE\u003e\n0x10000774 \u003c+212\u003e:   cmp     r0, #0\n0x10000776 \u003c+214\u003e:   bne.n   0x10000780 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+224\u003e\n0x10000778 \u003c+216\u003e:   b.n     0x10000792 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+242\u003e\n0x1000077a \u003c+218\u003e:   ldr     r0, [pc, #280]  @ (0x10000894 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+500\u003e)\n0x1000077c \u003c+220\u003e:   bl      0x1000b38c \u003c_ZN4core9panicking11panic_const28panic_const_async_fn_resumed17h823dff9daf7f5c44E\u003e\n0x10000780 \u003c+224\u003e:   add     r0, sp, #32\n0x10000782 \u003c+226\u003e:   movs    r1, #1\n0x10000784 \u003c+228\u003e:   strb    r1, [r0, #0]\n0x10000786 \u003c+230\u003e:   ldr     r2, [sp, #28]\n0x10000788 \u003c+232\u003e:   movs    r1, #3\n0x1000078a \u003c+234\u003e:   strb    r1, [r2, #16]\n0x1000078c \u003c+236\u003e:   ldrb    r0, [r0, #0]\n0x1000078e \u003c+238\u003e:   add     sp, #192        @ 0xc0\n0x10000790 \u003c+240\u003e:   pop     {r4, r6, r7, pc}\n0x10000792 \u003c+242\u003e:   ldr     r0, [sp, #28]\n0x10000794 \u003c+244\u003e:   adds    r0, #20\n0x10000796 \u003c+246\u003e:   bl      0x10001ae8 \u003c_ZN4core3ptr88drop_in_place$LT$embassy_rp..gpio..Input..wait_for_high..$u7b$$u7b$closure$u7d$$u7d$$GT$17h412df48bae41fb14E\u003e\n0x1000079a \u003c+250\u003e:   b.n     0x10000718 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+120\u003e\n0x1000079c \u003c+252\u003e:   ldr     r0, [sp, #28]\n0x1000079e \u003c+254\u003e:   adds    r0, #20\n0x100007a0 \u003c+256\u003e:   str     r0, [sp, #176]  @ 0xb0\n0x100007a2 \u003c+258\u003e:   ldr     r1, [sp, #132]  @ 0x84\n0x100007a4 \u003c+260\u003e:   bl      0x100011d4 \u003c_ZN10embassy_rp4gpio5Input12wait_for_low28_$u7b$$u7b$closure$u7d$$u7d$17hde464f8f1fd28345E\u003e\n0x100007a8 \u003c+264\u003e:   cmp     r0, #0\n0x100007aa \u003c+266\u003e:   beq.n   0x100007c0 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+288\u003e\n0x100007ac \u003c+268\u003e:   b.n     0x100007ae \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+270\u003e\n0x100007ae \u003c+270\u003e:   add     r0, sp, #32\n0x100007b0 \u003c+272\u003e:   movs    r1, #1\n0x100007b2 \u003c+274\u003e:   strb    r1, [r0, #0]\n0x100007b4 \u003c+276\u003e:   ldr     r2, [sp, #28]\n0x100007b6 \u003c+278\u003e:   movs    r1, #4\n0x100007b8 \u003c+280\u003e:   strb    r1, [r2, #16]\n0x100007ba \u003c+282\u003e:   ldrb    r0, [r0, #0]\n0x100007bc \u003c+284\u003e:   add     sp, #192        @ 0xc0\n0x100007be \u003c+286\u003e:   pop     {r4, r6, r7, pc}\n0x100007c0 \u003c+288\u003e:   ldr     r0, [sp, #28]\n0x100007c2 \u003c+290\u003e:   adds    r0, #20\n0x100007c4 \u003c+292\u003e:   bl      0x10001ab8 \u003c_ZN4core3ptr87drop_in_place$LT$embassy_rp..gpio..Input..wait_for_low..$u7b$$u7b$closure$u7d$$u7d$$GT$17h649af93cb28f11c1E\u003e\n0x100007c8 \u003c+296\u003e:   ldr     r0, [sp, #28]\n0x100007ca \u003c+298\u003e:   ldr     r0, [r0, #8]\n0x100007cc \u003c+300\u003e:   bl      0x1000020a \u003c_ZN25rust_embassy_pico_project3led3Led2on17h75f7deaba411d497E\u003e\n0x100007d0 \u003c+304\u003e:   ldr     r0, [sp, #28]\n0x100007d2 \u003c+306\u003e:   ldr     r1, [r0, #12]\n0x100007d4 \u003c+308\u003e:   add     r0, sp, #116    @ 0x74\n0x100007d6 \u003c+310\u003e:   str     r0, [sp, #8]\n0x100007d8 \u003c+312\u003e:   bl      0x100005be \u003c_ZN10embassy_rp4gpio5Input13wait_for_high17h9118f9d341070139E\u003e\n0x100007dc \u003c+316\u003e:   ldr     r1, [sp, #8]\n0x100007de \u003c+318\u003e:   add     r0, sp, #100    @ 0x64\n0x100007e0 \u003c+320\u003e:   bl      0x100013d6 \u003c_ZN59_$LT$F$u20$as$u20$core..future..into_future..IntoFuture$GT$11into_future17hf8591a67ae3e02adE\u003e\n0x100007e4 \u003c+324\u003e:   ldr     r1, [sp, #28]\n0x100007e6 \u003c+326\u003e:   ldr     r0, [sp, #112]  @ 0x70\n0x100007e8 \u003c+328\u003e:   str     r0, [r1, #32]\n0x100007ea \u003c+330\u003e:   ldr     r0, [sp, #108]  @ 0x6c\n0x100007ec \u003c+332\u003e:   str     r0, [r1, #28]\n0x100007ee \u003c+334\u003e:   ldr     r0, [sp, #104]  @ 0x68\n0x100007f0 \u003c+336\u003e:   str     r0, [r1, #24]\n0x100007f2 \u003c+338\u003e:   ldr     r0, [sp, #100]  @ 0x64\n0x100007f4 \u003c+340\u003e:   str     r0, [r1, #20]\n0x100007f6 \u003c+342\u003e:   b.n     0x100007f8 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+344\u003e\n0x100007f8 \u003c+344\u003e:   ldr     r0, [sp, #28]\n0x100007fa \u003c+346\u003e:   adds    r0, #20\n0x100007fc \u003c+348\u003e:   str     r0, [sp, #184]  @ 0xb8\n0x100007fe \u003c+350\u003e:   ldr     r1, [sp, #132]  @ 0x84\n0x10000800 \u003c+352\u003e:   bl      0x10001274 \u003c_ZN10embassy_rp4gpio5Input13wait_for_high28_$u7b$$u7b$closure$u7d$$u7d$17h76cb204e6020303dE\u003e\n0x10000804 \u003c+356\u003e:   cmp     r0, #0\n0x10000806 \u003c+358\u003e:   beq.n   0x1000081c \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+380\u003e\n0x10000808 \u003c+360\u003e:   b.n     0x1000080a \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+362\u003e\n0x1000080a \u003c+362\u003e:   add     r0, sp, #32\n0x1000080c \u003c+364\u003e:   movs    r1, #1\n0x1000080e \u003c+366\u003e:   strb    r1, [r0, #0]\n0x10000810 \u003c+368\u003e:   ldr     r2, [sp, #28]\n0x10000812 \u003c+370\u003e:   movs    r1, #5\n0x10000814 \u003c+372\u003e:   strb    r1, [r2, #16]\n0x10000816 \u003c+374\u003e:   ldrb    r0, [r0, #0]\n0x10000818 \u003c+376\u003e:   add     sp, #192        @ 0xc0\n0x1000081a \u003c+378\u003e:   pop     {r4, r6, r7, pc}\n0x1000081c \u003c+380\u003e:   ldr     r0, [sp, #28]\n0x1000081e \u003c+382\u003e:   adds    r0, #20\n0x10000820 \u003c+384\u003e:   bl      0x10001ae8 \u003c_ZN4core3ptr88drop_in_place$LT$embassy_rp..gpio..Input..wait_for_high..$u7b$$u7b$closure$u7d$$u7d$$GT$17h412df48bae41fb14E\u003e\n0x10000824 \u003c+388\u003e:   ldr     r0, [sp, #28]\n0x10000826 \u003c+390\u003e:   ldr     r0, [r0, #8]\n0x10000828 \u003c+392\u003e:   bl      0x1000021a \u003c_ZN25rust_embassy_pico_project3led3Led3off17h3284da408f5fdb1cE\u003e\n0x1000082c \u003c+396\u003e:   add     r0, sp, #144    @ 0x90\n0x1000082e \u003c+398\u003e:   str     r0, [sp, #4]\n0x10000830 \u003c+400\u003e:   movs    r2, #10\n0x10000832 \u003c+402\u003e:   movs    r3, #0\n0x10000834 \u003c+404\u003e:   bl      0x100018de \u003c_ZN12embassy_time5timer5Timer12after_millis17h2c899eceea774000E\u003e\n0x10000838 \u003c+408\u003e:   ldr     r0, [sp, #4]\n0x1000083a \u003c+410\u003e:   ldr     r3, [sp, #148]  @ 0x94\n0x1000083c \u003c+412\u003e:   ldr     r2, [sp, #144]  @ 0x90\n0x1000083e \u003c+414\u003e:   ldrb    r0, [r0, #8]\n0x10000840 \u003c+416\u003e:   str     r0, [sp, #0]\n0x10000842 \u003c+418\u003e:   add     r0, sp, #160    @ 0xa0\n0x10000844 \u003c+420\u003e:   bl      0x10000266 \u003c_ZN59_$LT$F$u20$as$u20$core..future..into_future..IntoFuture$GT$11into_future17h2f5362e0faebbbd9E\u003e\n0x10000848 \u003c+424\u003e:   ldr     r2, [sp, #160]  @ 0xa0\n0x1000084a \u003c+426\u003e:   ldr     r4, [sp, #164]  @ 0xa4\n0x1000084c \u003c+428\u003e:   ldr     r0, [sp, #168]  @ 0xa8\n0x1000084e \u003c+430\u003e:   ldr     r3, [sp, #28]\n0x10000850 \u003c+432\u003e:   mov     r1, r3\n0x10000852 \u003c+434\u003e:   adds    r1, #24\n0x10000854 \u003c+436\u003e:   str     r4, [r3, #28]\n0x10000856 \u003c+438\u003e:   str     r2, [r3, #24]\n0x10000858 \u003c+440\u003e:   strb    r0, [r1, #8]\n0x1000085a \u003c+442\u003e:   b.n     0x1000085c \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+444\u003e\n0x1000085c \u003c+444\u003e:   ldr     r0, [sp, #28]\n0x1000085e \u003c+446\u003e:   adds    r0, #24\n0x10000860 \u003c+448\u003e:   str     r0, [sp, #180]  @ 0xb4\n0x10000862 \u003c+450\u003e:   ldr     r1, [sp, #132]  @ 0x84\n0x10000864 \u003c+452\u003e:   bl      0x10008ec0 \u003c_ZN75_$LT$embassy_time..timer..Timer$u20$as$u20$core..future..future..Future$GT$4poll17hdbee4e72f640d006E\u003e\n0x10000868 \u003c+456\u003e:   cmp     r0, #0\n0x1000086a \u003c+458\u003e:   beq.n   0x10000880 \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+480\u003e\n0x1000086c \u003c+460\u003e:   b.n     0x1000086e \u003c_ZN25rust_embassy_pico_project9run_cycle9run_cycle28_$u7b$$u7b$closure$u7d$$u7d$17h1e5426774f161f69E+462\u003e\n0x1000086e \u003c+462\u003e:   add     r0, sp, #32\n0x10000870 \u003c+464\u003e:   movs    r1, #1\n0x10000872 \u003c+466\u003e:   strb    r1, [r0, #0]\n0x10000874 \u003c+468\u003e:   ldr     r2, [sp, #28]\n0x10000876 \u003c+470\u003e:   movs    r1, #6\n0x10000878 \u003c+472\u003e:   strb    r1, [r2, #16]\n0x1000087a \u003c+474\u003e:   ldrb    r0, [r0, #0]\n0x1000087c \u003c+476\u003e:   add     sp, #192        @ 0xc0\n0x1000087e \u003c+478\u003e:   pop     {r4, r6, r7, pc}\n0x10000880 \u003c+480\u003e:   add     r0, sp, #32\n0x10000882 \u003c+482\u003e:   movs    r1, #0\n0x10000884 \u003c+484\u003e:   strb    r1, [r0, #0]\n0x10000886 \u003c+486\u003e:   ldr     r2, [sp, #28]\n0x10000888 \u003c+488\u003e:   movs    r1, #1\n0x1000088a \u003c+490\u003e:   strb    r1, [r2, #16]\n0x1000088c \u003c+492\u003e:   ldrb    r0, [r0, #0]\n0x1000088e \u003c+494\u003e:   add     sp, #192        @ 0xc0\n0x10000890 \u003c+496\u003e:   pop     {r4, r6, r7, pc}\n0x10000892 \u003c+498\u003e:   nop                     @ (mov r8, r8)\n0x10000894 \u003c+500\u003e:   stmia   r0!, {r4}\n0x10000896 \u003c+502\u003e:   asrs    r0, r0, #32\n```\nEach `bne` or `b.n` jump corresponds to one of the `await` suspension points:\n- `state = 0` → evaluate `button.is_low()` and possibly await `wait_for_high()`\n- `state = 1` → resumed after `wait_for_high().await`\n- `state = 2` → await `wait_for_low().await`\n- `state = 3` → execute `led.on()`\n- `state = 4` → await `wait_for_high().await`\n- `state = 5` → execute `led.off()`\n- `state = 6` → await `Timer::after_millis().await`\n- `state = DONE` → return `Poll::Ready` and exit\nBy placing a breakpoint at the closure entry (`0x100006a0`), you dive directly into your button-press/LED logic, skipping the trivial constructor at `0x10001904`.\n\n\u003cbr\u003e\n\n# Building and Flashing\nMake sure you have:\n- Rust toolchain with thumbv6m-none-eabi target installed.\n- Probe-rs or OpenOCD for flashing.\n\nBuild:\n`cargo build`\n\nFlash:\n`cargo flash`\n\n\u003cbr\u003e\n\n# Requirements\n- Rust nightly (for async embedded features).\n- Embassy (embassy-rp crate) for async HAL support.\n- A Raspberry Pi Pico board.\n\n\u003cbr\u003e\n\n# License\nApache-2.0 License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmytechnotalent%2Frust_embassy_pico_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmytechnotalent%2Frust_embassy_pico_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmytechnotalent%2Frust_embassy_pico_project/lists"}