#embedded-hal #raspberry-pi #hal #embedded-hal-impl #pi #raspberry

oxy-linux-pwm

A crate for controlling the PWM on the linux

3 releases

0.1.2 May 31, 2024
0.1.1 Apr 28, 2024
0.1.0 Apr 28, 2024

#944 in Hardware support

Download history 6/week @ 2024-07-21 20/week @ 2024-07-28 2/week @ 2024-09-15 14/week @ 2024-09-22 4/week @ 2024-09-29

172 downloads per month

MIT license

13KB
269 lines

Oxy-linux-plus

This is a Rust PWM crate for Linux that automatically selects software or hardware implementation. Hardware PWM will be implemented through the Linux sysfs ABI. Please check if your PWM chip is under /sys/class/pwm directory. (The software pwm engine has not been done)

// the channel will be reset after channel dropped
fn demo() {
    reset_all();
    let chip = PwmChip::new(0);
    let channel = chip.get_channel(0);
    channel.set_period(Duration::from_micros(50));
    channel.set_duty_cycle(Duration::from_micros(25));
    channel.enable();    
}

No runtime deps