{"id":20446306,"url":"https://github.com/rust-embedded/rust-sysfs-pwm","last_synced_at":"2025-04-13T00:45:12.685Z","repository":{"id":4683633,"uuid":"52245096","full_name":"rust-embedded/rust-sysfs-pwm","owner":"rust-embedded","description":"Linux PWM Access via Sysfs in Rust","archived":false,"fork":false,"pushed_at":"2024-01-09T14:29:34.000Z","size":40,"stargazers_count":47,"open_issues_count":10,"forks_count":17,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-13T00:45:06.391Z","etag":null,"topics":["embedded","linux","pwm","rust","sysfs"],"latest_commit_sha":null,"homepage":null,"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/rust-embedded.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2016-02-22T03:43:28.000Z","updated_at":"2024-05-22T11:33:14.000Z","dependencies_parsed_at":"2022-07-11T00:30:30.011Z","dependency_job_id":null,"html_url":"https://github.com/rust-embedded/rust-sysfs-pwm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Frust-sysfs-pwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Frust-sysfs-pwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Frust-sysfs-pwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-embedded%2Frust-sysfs-pwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-embedded","download_url":"https://codeload.github.com/rust-embedded/rust-sysfs-pwm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650420,"owners_count":21139672,"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":["embedded","linux","pwm","rust","sysfs"],"created_at":"2024-11-15T10:19:10.462Z","updated_at":"2025-04-13T00:45:12.664Z","avatar_url":"https://github.com/rust-embedded.png","language":"Rust","readme":"# sysfs-pwm\n\n[![Build Status](https://github.com/rust-embedded/rust-sysfs-pwm/workflows/CI/badge.svg)](https://github.com/rust-embedded/rust-sysfs-pwm/actions)\n[![Version](https://img.shields.io/crates/v/sysfs-pwm.svg)](https://crates.io/crates/sysfs-pwm)\n![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.28+-blue.svg)\n[![License](https://img.shields.io/crates/l/sysfs-pwm.svg)](README.md#license)\n\n- [API Documentation](https://docs.rs/sysfs-pwm)\n\nrust-sysfs-pwm is a rust library/crate providing access to the [Linux\nsysfs PWM interface](https://www.kernel.org/doc/Documentation/pwm.txt).\nIt seeks to provide an API that is safe, convenient, and efficient.\n\n## Install/Use\n\nTo use `sysfs-pwm`, first add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\n# or latest version\nsysfs-pwm = \"0.2.0\"\n```\n\nThen, add this to your crate root:\n\n```rust\nuse sysfs_pwm;\n```\n\n## MSRV (Minimum Supported Rust Version)\n\nThis crate is guaranteed to compile on stable Rust 1.28.0 and up. It *might*\ncompile with older versions but that may change in any new patch release.\n\n## Example/API\n\nThe main API consists of a Pwm struct with the following methods:\n* `Pwm::new` - Create a Pwm instance\n* `pwm.with_exported` - Execute a block with the Pwm exported\n* `pwm.set_active` - Enable/Disable the Pwm\n* `pwm.get_duty_cycle` - Get duty cycle as percentage of period\n* `pwm.set_duty_cycle` - Set duty cycle as percentage of period\n* `pwm.get_duty_cycle_ns` - Get duty cycle in nanoseconds\n* `pwm.set_duty_cycle_ns` - Set duty cyle in nanoseconds\n* `pwm.get_period_ns` - Get the Pwm period in nanoseconds\n* `pwm.set_period_ns` - Set the Pwm period in nanoseconds\n\nCheck out the [Breathing LED](examples/breathe.rs) example for a usage\nexample.\n\n## Cross Compiling\n\nMost likely, the machine you are running on is not your development\nmachine (although it could be).  In those cases, you will need to\ncross-compile.  The [instructions here][rust-cross] provide great details on cross\ncompiling for your platform.\n\n[rust-cross]: https://github.com/cross-rs/cross\n\n## Running the Example\n\nCross-compiling can be done by specifying an appropriate target.  You\ncan then move that to your device by whatever means and run it.\n\n```\n$ cargo build --target=arm-unknown-linux-gnueabihf --example breathe\n$ scp target/arm-unknown-linux-gnueabihf/debug/examples/breathe ...\n```\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n## Code of Conduct\n\nContribution to this crate is organized under the terms of the [Rust Code of\nConduct][CoC], the maintainer of this crate, the [Embedded Linux Team][team], promises\nto intervene to uphold that code of conduct.\n\n[CoC]: CODE_OF_CONDUCT.md\n[team]: https://github.com/rust-embedded/wg#the-embedded-linux-team\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded%2Frust-sysfs-pwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-embedded%2Frust-sysfs-pwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-embedded%2Frust-sysfs-pwm/lists"}