Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
golemparts committed Nov 30, 2024
1 parent 0c49832 commit 438acd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 0.20.0 (TBD)
## 0.20.0 (November 30, 2024)

* Add support for Raspberry Pi Compute Module 5.
* **Gpio**: Add `set_bias` to `InputPin` (contributed by @KronsyC).
Expand Down
30 changes: 3 additions & 27 deletions src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,20 @@
//! use with other peripherals. Be careful not to enable two peripherals on the same pin
//! at the same time.
//!
//! ## Using PWM without superuser privileges (`sudo`)
//!
//! As of kernel version 4.14.34, released on April 16 2018, it's possible to
//! configure your Raspberry Pi to allow non-root access to PWM. 4.14.34 includes
//! a [patch] that allows `udev` to change file permissions when a
//! PWM channel is exported. This will let any user that's a member of the `gpio`
//! group configure PWM without having to use `sudo`.
//!
//! The `udev` rules needed to make this work haven't been patched in yet as of
//! June 2018, but you can easily add them yourself. Make sure you're running
//! 4.14.34 or later, and append the following snippet to
//! `/etc/udev/rules.d/99-com.rules`. Reboot the Raspberry Pi afterwards.
//!
//! ```text
//! SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c '\
//! chown -R root:gpio /sys/class/pwm && chmod -R 770 /sys/class/pwm;\
//! chown -R root:gpio /sys/devices/platform/soc/*.pwm/pwm/pwmchip* &&\
//! chmod -R 770 /sys/devices/platform/soc/*.pwm/pwm/pwmchip*\
//! '"
//! ```
//!
//! ## Troubleshooting
//!
//! ### Permission denied
//!
//! If [`new`] returns an `io::ErrorKind::PermissionDenied`
//! error, make sure `/sys/class/pwm` and all of its subdirectories
//! are owned by `root:gpio`, the current user is a member of the `gpio` group
//! and `udev` is properly configured as mentioned above. Alternatively, you can
//! launch your application using `sudo`.
//! If [`new`] returns an `io::ErrorKind::PermissionDenied` error, make sure
//! `/sys/class/pwm` and its subdirectories has the appropriate permissions for the current user.
//! Alternatively, you can launch your application using `sudo`.
//!
//! ### Not found
//!
//! If [`new`] returns an `io::ErrorKind::NotFound` error, you may have
//! forgotten to enable the selected PWM channel. The configuration options
//! to enable either of the two PWM channels are listed above.
//!
//! [patch]: https://github.com/raspberrypi/linux/issues/1983
//! [`new`]: struct.Pwm.html#method.new
use std::error;
Expand Down

0 comments on commit 438acd4

Please sign in to comment.