esp_pwm_reader

Crates.ioesp_pwm_reader
lib.rsesp_pwm_reader
version0.1.2
sourcesrc
created_at2023-11-19 11:53:18.437897
updated_at2023-11-19 13:35:00.72295
descriptionWrapper around the mcpwm capture module for reading pwm signals.
homepagehttps://github.com/daschr/esp_pwm_reader
repositoryhttps://github.com/daschr/esp_pwm_reader
max_upload_size
id1041111
size12,052
David Schramm (daschr)

documentation

https://daschr.github.io/esp_pwm_reader/esp_pwm_reader/index.html

README

esp_pwm_reader

Wrapper around the mcpwm capture module for reading pwm signals.

Documentation

Usage

  • you need to create a capture timer which can then be used by multiple channel readers
  • f.e.
    use channel_reader::{CaptureTimer, ChannelReader};
    use esp_idf_hal::delay::FreeRtos;
    
    use esp_idf_sys::{
      gpio_num_t_GPIO_NUM_16, gpio_num_t_GPIO_NUM_17
    };
    
    fn main() {
      let capture_timer = CaptureTimer::new(0).unwrap();
    
      let channel1 = ChannelReader::new(&capture_timer, gpio_num_t_GPIO_NUM_16).unwrap();
      let channel2 = ChannelReader::new(&capture_timer, gpio_num_t_GPIO_NUM_17).unwrap();
    
      loop {
          println!(
              "ch1: {} ch2: {}",
              channel1.get_value(),
              channel2.get_value()
          );
    
          FreeRtos::delay_ms(11);
      }
    }
    
Commit count: 18

cargo fmt