{"id":22820187,"url":"https://github.com/kizzycode/ws2812bdriver-rust-rp2040","last_synced_at":"2025-03-30T23:16:35.769Z","repository":{"id":188079355,"uuid":"678069875","full_name":"KizzyCode/Ws2812bDriver-rust-rp2040","owner":"KizzyCode","description":"A serial driver for WS2812B LED strips","archived":false,"fork":false,"pushed_at":"2023-10-03T21:45:33.000Z","size":1951,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T04:44:16.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KizzyCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE BSD 2-CLAUSE.md","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}},"created_at":"2023-08-13T15:32:29.000Z","updated_at":"2023-08-13T15:41:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1206991-3af6-4188-a93a-31b4c9007d2a","html_url":"https://github.com/KizzyCode/Ws2812bDriver-rust-rp2040","commit_stats":null,"previous_names":["kizzycode/ws2812bdriver-rust-rp2040"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2FWs2812bDriver-rust-rp2040","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2FWs2812bDriver-rust-rp2040/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2FWs2812bDriver-rust-rp2040/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2FWs2812bDriver-rust-rp2040/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KizzyCode","download_url":"https://codeload.github.com/KizzyCode/Ws2812bDriver-rust-rp2040/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390858,"owners_count":20769478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-12T15:16:56.023Z","updated_at":"2025-03-30T23:16:35.734Z","avatar_url":"https://github.com/KizzyCode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License BSD-2-Clause](https://img.shields.io/badge/License-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n# `ws2812b-driver`\nWelcome to `ws2812b-driver` 🎉\n\nThis crate provides a RPi Pico driver firmware to control up to 4 WS2812B LED strips simultaneously. It communicates via\nUSB-serial (CDC), and controls the WS2812B strips via the RP2040's PIOs to ensure accurate timings.\n\n\n## Serial Communication\nThe USB-serial communication is a simple request-response format, where the host sends a single command at a time to the\ndriver, and if the command was processed successfully, the driver sends it back to the server as-is.\n\n### Command Format\nEach command consists of a big-endian hex-encoded 64 bit integer, terminated by a newline (indices are bit offsets):\n- `[0, 16)`: The index of the LED strip; must be a number within `[0, 4)` (`strip as u16 \u003c\u003c 48`)\n- `[16, 32)`: The index of the LED pixel within the strip; must be a number within `[0, 512)` (`pixel as u16 \u003c\u003c 32`)\n- `[32, 40)`: The RGBW red value; must be a number within `[0, 256)` (`red as u8 \u003c\u003c 24`)\n- `[40, 48)`: The RGBW green value; must be a number within `[0, 256)` (`green as u8 \u003c\u003c 16`)\n- `[48, 56)`: The RGBW blue value; must be a number within `[0, 256)` (`blue as u8 \u003c\u003c 8`)\n- `[56, 64)`: The RGBW white value; this value is currently unsupported and must be `0`\n\n#### Rust Example\n```rust\n// This example creates a message to set strip 2, LED 17 to RGB 255,255,255\nlet message = format!(\"{:04x}{:04x}{:02x}{:02x}{:02x}00\\n\", 2, 17, 255, 255, 255);\nassert_eq!(message, \"00020011ffffff00\\n\");\n```\n\n#### Shell Example\n```sh\n# This example creates a message to set strip 2, LED 17 to RGB 255,255,255\nprintf \"%04x%04x%02x%02x%02x00\\n\" 2 17 255 255 255\n```\n\n#### `RESET_TO_BOOTSEL\\n` command\nThe `bootsel`-feature (enabled by default) allows you to reboot the Pico into USB bootloader mode by sending the serial\ncommand `RESET_TO_BOOTSEL\\n`. This will reboot the Pico into UF2 update mode so that you can flash another firmware\nwithout the need for user interaction/physical presence.\n\n\n## Configuration\nTo adjust the GPIO pins, you can set the following environment variables during compilation to the appropriate pin\nnumbers:\n - `WS2812B_PIO0_PIN0`: The control pin for the first LED strip (defaults to `10`)\n - `WS2812B_PIO0_PIN1`: The control pin for the second LED strip (defaults to `11`)\n - `WS2812B_PIO0_PIN2`: The control pin for the third LED strip (defaults to `12`)\n - `WS2812B_PIO0_PIN3`: The control pin for the fourth LED strip (defaults to `13`)\n - `WS2812B_GPIO_LED`: The control pin for the status LED (defaults to `25`)\n  \nTo adjust the USB serial number, you can set the following environment variables during compilation:\n - `WS2812B_UID_VENDOR`: The vendor ID (defaults to the JEDEC vendor ID of the connected flash chip)\n - `WS2812B_UID_ID`: The vendor ID (defaults to the maybe-unique fabrication ID of the connected flash chip)\n\n**IMPORTANT**: Please keep in mind that most WS2812B LED strips require 5V, whereas the RP2040's GPIOs are 3V3, which may\nnot be enough or can cause weird errors.\n\n## TODO:\n - [ ] Batch command format to improve state-change performance\n - [ ] Maybe batch/ring IPC between core 0 and 1 instead of SIO FIFO\n - [ ] Update only changed strips/skip strips without change\n - [ ] Select board constant instead of LED PIN\n   - [ ] Disable unused LEDs on Seeduino XIAO RP2040","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fws2812bdriver-rust-rp2040","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkizzycode%2Fws2812bdriver-rust-rp2040","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fws2812bdriver-rust-rp2040/lists"}