oxy_linux_pwm/pwm_chip.rs
1use crate::sysfs;
2use crate::pwm_channel::PwmChannel;
3
4#[derive(Clone, Copy)]
5pub struct PwmChip(pub u8);
6
7impl PwmChip {
8 pub fn new(chip: u8) -> Self {
9 PwmChip(chip)
10 }
11
12 pub fn get_channel(self, channel: u8) -> PwmChannel {
13 PwmChannel::new(self, channel)
14 }
15
16 pub fn get_channel_count(self) -> u8 {
17 sysfs::get_channel_count(self.0).unwrap()
18
19 }
20}