All Projects → rust-embedded → rust-sysfs-pwm

rust-embedded / rust-sysfs-pwm

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Linux PWM Access via Sysfs in Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-sysfs-pwm

pwm-pca9685-rs
Platform-agnostic Rust driver for the PCA9685 I2C 16-channel, 12-bit PWM/Servo/LED controller
Stars: ✭ 19 (-54.76%)
Mutual labels:  embedded, pwm
PalatisSoftPWM
Software PWM library for Arduino
Stars: ✭ 16 (-61.9%)
Mutual labels:  pwm
Libonnx
A lightweight, portable pure C99 onnx inference engine for embedded devices with hardware acceleration support.
Stars: ✭ 217 (+416.67%)
Mutual labels:  embedded
Parse Embedded Sdks
The Embedded SDKs for the Parse Platform
Stars: ✭ 244 (+480.95%)
Mutual labels:  embedded
Helios
The free embedded operating system.
Stars: ✭ 223 (+430.95%)
Mutual labels:  embedded
Libhydrogen
A lightweight, secure, easy-to-use crypto library suitable for constrained environments.
Stars: ✭ 247 (+488.1%)
Mutual labels:  embedded
Openthread
OpenThread released by Google is an open-source implementation of the Thread networking protocol
Stars: ✭ 2,643 (+6192.86%)
Mutual labels:  embedded
arm-none-eabi-gcc-xpack
A binary xPack with the Arm Embedded GCC toolchain
Stars: ✭ 85 (+102.38%)
Mutual labels:  embedded
Arduino
🚀 Proyectos de todo tipo para arduino utilizando sus sensores y actuadores. 🤖
Stars: ✭ 27 (-35.71%)
Mutual labels:  pwm
Opencr
Software for ROS Embedded board (a.k.a. OpenCR). OpenCR means Open-source Control Module for ROS.
Stars: ✭ 240 (+471.43%)
Mutual labels:  embedded
Littler
A scripting and command-line front-end for GNU R
Stars: ✭ 238 (+466.67%)
Mutual labels:  embedded
Baremetal Arm
An ebook about bare-metal programming for ARM
Stars: ✭ 222 (+428.57%)
Mutual labels:  embedded
Drivers
TinyGo drivers for sensors and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
Stars: ✭ 250 (+495.24%)
Mutual labels:  embedded
Iot Pt
A Virtual environment for Pentesting IoT Devices
Stars: ✭ 218 (+419.05%)
Mutual labels:  embedded
DC-Servo
Analog speed control of Brushed DC Motor
Stars: ✭ 16 (-61.9%)
Mutual labels:  pwm
Skiffos
SkiffOS: lightweight & robust cross-compiled Linux distribution optimized for hosting containers.
Stars: ✭ 151 (+259.52%)
Mutual labels:  embedded
Cubdb
Elixir embedded key/value database
Stars: ✭ 235 (+459.52%)
Mutual labels:  embedded
Stm32f1xx Hal
A Rust embedded-hal HAL impl for the STM32F1 family based on japarics stm32f103xx-hal
Stars: ✭ 245 (+483.33%)
Mutual labels:  embedded
uart
serial com api
Stars: ✭ 37 (-11.9%)
Mutual labels:  embedded
ewok-kernel
A secure and high performances microkernel for building secure MCU-based IoTs
Stars: ✭ 69 (+64.29%)
Mutual labels:  embedded

sysfs-pwm

Build Status Version Minimum Supported Rust Version License

rust-sysfs-pwm is a rust library/crate providing access to the Linux sysfs PWM interface. It seeks to provide an API that is safe, convenient, and efficient.

Install/Use

To use sysfs-pwm, first add this to your Cargo.toml:

[dependencies]
# or latest version
sysfs-pwm = "0.2.0"

Then, add this to your crate root:

use sysfs_pwm;

MSRV (Minimum Supported Rust Version)

This crate is guaranteed to compile on stable Rust 1.28.0 and up. It might compile with older versions but that may change in any new patch release.

Example/API

The main API consists of a Pwm struct with the following methods:

  • Pwm::new - Create a Pwm instance
  • pwm.with_exported - Execute a block with the Pwm exported
  • pwm.set_active - Enable/Disable the Pwm
  • pwm.get_duty_cycle - Get duty cycle as percentage of period
  • pwm.set_duty_cycle - Set duty cycle as percentage of period
  • pwm.get_duty_cycle_ns - Get duty cycle in nanoseconds
  • pwm.set_duty_cycle_ns - Set duty cyle in nanoseconds
  • pwm.get_period_ns - Get the Pwm period in nanoseconds
  • pwm.set_period_ns - Set the Pwm period in nanoseconds

Check out the Breathing LED example for a usage example.

Cross Compiling

Most likely, the machine you are running on is not your development machine (although it could be). In those cases, you will need to cross-compile. The instructions here provide great details on cross compiling for your platform.

Running the Example

Cross-compiling can be done by specifying an appropriate target. You can then move that to your device by whatever means and run it.

$ cargo build --target=arm-unknown-linux-gnueabihf --example breathe
$ scp target/arm-unknown-linux-gnueabihf/debug/examples/breathe ...

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the Embedded Linux Team, promises to intervene to uphold that code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].