{"id":16521462,"url":"https://github.com/golemparts/blinkt","last_synced_at":"2025-03-21T09:30:34.656Z","repository":{"id":10847615,"uuid":"67170862","full_name":"golemparts/blinkt","owner":"golemparts","description":"A Rust library for the Pimoroni Blinkt!, and any similar APA102 or SK9822 LED strips or boards, on a Raspberry Pi.","archived":false,"fork":false,"pushed_at":"2023-10-18T14:30:03.000Z","size":194,"stargazers_count":21,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T16:55:47.199Z","etag":null,"topics":["apa102","blinkt","blinkt-library","raspberry-pi","raspberrypi","rust","rust-library","sk9822"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/golemparts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-01T22:30:18.000Z","updated_at":"2023-05-20T11:41:26.000Z","dependencies_parsed_at":"2022-08-08T04:00:04.747Z","dependency_job_id":null,"html_url":"https://github.com/golemparts/blinkt","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemparts%2Fblinkt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemparts%2Fblinkt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemparts%2Fblinkt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golemparts%2Fblinkt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golemparts","download_url":"https://codeload.github.com/golemparts/blinkt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221813411,"owners_count":16884823,"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":["apa102","blinkt","blinkt-library","raspberry-pi","raspberrypi","rust","rust-library","sk9822"],"created_at":"2024-10-11T16:56:12.607Z","updated_at":"2024-10-28T09:42:05.333Z","avatar_url":"https://github.com/golemparts.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blinkt\n\n[![Build Status](https://travis-ci.com/golemparts/blinkt.svg?branch=master)](https://travis-ci.com/golemparts/blinkt)\n[![crates.io](https://img.shields.io/crates/v/blinkt)](https://crates.io/crates/blinkt)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Minimum rustc version](https://img.shields.io/badge/rustc-v1.56.0-lightgray.svg)](https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html)\n\nBlinkt is a Rust library that provides an interface for the Pimoroni Blinkt!, and any similar APA102 or SK9822 LED strips or boards, on a Raspberry Pi. The library supports bitbanging mode on any GPIO pins, and hardware SPI mode on GPIO 10 (physical pin 19) for data, and GPIO 11 (physical pin 23) for clock.\n\nFor bitbanging mode, Blinkt gains access to the BCM283x GPIO peripheral either through `/dev/gpiomem` or `/dev/mem`. Hardware SPI mode is controlled through `/dev/spidev0.0`.\n\nBoth the original APA102 and the SK9822 clone are supported. The RGB LED/driver ICs are referred to as pixels throughout the code and documentation.\n\nBackwards compatibility for minor revisions isn't guaranteed until the library reaches v1.0.0.\n\nBlinkt is under development on the [master branch](https://github.com/golemparts/blinkt/tree/master) of the repository on GitHub. If you're looking for the `README.md` or the `examples` directory for the latest release or any of the earlier releases, visit [crates.io](https://crates.io/crates/blinkt), download an archived release from the GitHub [releases](https://github.com/golemparts/blinkt/releases) page, or clone and checkout the relevant release tag.\n\n## Documentation\n\nOnline documentation is available for the latest release, older releases, and the version currently in development.\n\n* Latest release: [docs.golemparts.com/blinkt](https://docs.golemparts.com/blinkt)\n* Older releases: [docs.rs/blinkt](https://docs.rs/blinkt)\n* In development: [docs.golemparts.com/blinkt-dev](https://docs.golemparts.com/blinkt-dev)\n\n## Usage\n\nAdd a dependency for `blinkt` to your `Cargo.toml` using `cargo add blinkt`, or by adding the following line to your dependencies section.\n\n```toml\n[dependencies]\nblinkt = \"0.7.1\"\n```\n\nCall `Blinkt::new()` to create a new Blinkt with the default settings. Alternative configuration options are available through `Blinkt::with_settings()` and `Blinkt::with_spi()`.\n\n```rust\nuse blinkt::Blinkt;\n\nlet mut blinkt = Blinkt::new()?;\n```\n\n## Examples\n\nThe example below demonstrates swapping all pixels on a Blinkt! board between red, green and blue.\n\n```rust\nuse std::error::Error;\nuse std::time::Duration;\nuse std::{mem, thread};\n\nuse blinkt::Blinkt;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let mut blinkt = Blinkt::new()?;\n    let (red, green, blue) = (\u0026mut 255, \u0026mut 0, \u0026mut 0);\n\n    loop {\n        blinkt.set_all_pixels(*red, *green, *blue);\n        blinkt.show()?;\n\n        thread::sleep(Duration::from_millis(250));\n\n        mem::swap(red, green);\n        mem::swap(red, blue);\n    }\n}\n```\n\nTo control an LED strip consisting of 144 pixels, connected to the Raspberry Pi's hardware SPI pins (data on GPIO 10 (physical pin 19), and clock on GPIO 11 (physical pin 23)), at 16 MHz clock speed, replace the `Blinkt::new()` line in the above example with the following. You may have to tweak the maximum clock speed based on the number of pixels and the wire quality.\n\n```rust\nlet mut blinkt = Blinkt::with_spi(16_000_000, 144)?;\n```\n\nAdditional examples can be found in the `examples` directory.\n\n## Cross compilation\n\nIf you're not working directly on a Raspberry Pi, you'll have to cross-compile your code for the appropriate ARM architecture. Check out [this guide](https://github.com/japaric/rust-cross) for more information, or try the [cross](https://github.com/japaric/cross) project for \"zero setup\" cross compilation.\n\n### Cargo\n\nWhile additional steps may be necessary to cross-compile binaries on your platform, checking your code with `cargo check` only requires the installation of an appropriate target. Most Raspberry Pi models need the `armv7-unknown-linux-gnueabihf` target. For some models, like the Raspberry Pi Zero, a different target triple is required.\n\nInstall the relevant target using `rustup`.\n\n```bash\nrustup target install armv7-unknown-linux-gnueabihf\n```\n\nIn the root directory of your project, create a `.cargo` subdirectory, and then save the following snippet to `.cargo/config`.\n\n```toml\n[build]\ntarget = \"armv7-unknown-linux-gnueabihf\"\n```\n\n### Visual Studio Code\n\nThe rust-analyzer extension for Visual Studio Code needs to be made aware of the target platform by setting the `rust-analyzer.cargo.target` configuration option. In the root directory of your project, create a `.vscode` subdirectory, and then save the following snippet to `.vscode/settings.json`.\n\n```json\n{\n    \"rust-analyzer.cargo.target\": \"armv7-unknown-linux-gnueabihf\"\n}\n```\n\n## Copyright and license\n\nCopyright (c) 2016-2022 Rene van der Meer. Released under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemparts%2Fblinkt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolemparts%2Fblinkt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolemparts%2Fblinkt/lists"}