The PWM peripheral is described in section 4.5 of the datasheet.
In the SDK, pwm_config_set_clkdiv_mode() switches between normal mode (where the counter counts continuously) and the counting modes. You probably want the mode set to PWM_DIV_B_RISING to count rising edges of your anemometer input.
Most of the PWM documentation spends its time talking about all the things you can do triggered by matching the counter value to drive outputs, but you don't want any of that, you just want the basic feature where the counter counts and you can read it with pwm_get_counter()
In the SDK, pwm_config_set_clkdiv_mode() switches between normal mode (where the counter counts continuously) and the counting modes. You probably want the mode set to PWM_DIV_B_RISING to count rising edges of your anemometer input.
Most of the PWM documentation spends its time talking about all the things you can do triggered by matching the counter value to drive outputs, but you don't want any of that, you just want the basic feature where the counter counts and you can read it with pwm_get_counter()
Statistics: Posted by arg001 — Sun Aug 18, 2024 9:14 pm