File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -870,13 +870,15 @@ where
870870 esp ! ( ESP_ERR_INVALID_ARG ) ?;
871871 }
872872
873- if config. lowest_frequency > mcpwm_module. borrow ( ) . operator_source_frequency . Hz ( ) {
873+ let operator_source_frequency = mcpwm_module. borrow ( ) . operator_source_frequency ;
874+ if config. lowest_frequency > operator_source_frequency. Hz ( ) {
874875 // Can not specify a lowest_frequency larger than the corresponding value for
875876 // the parent MCPWM module. Use `Mcpwm::lowest_frequency` to enable higher frequencies
876877 esp ! ( ESP_ERR_INVALID_ARG ) ?;
877878 }
878879
879880 let resolution = u32:: from ( config. lowest_frequency ) * MAX_PWM_TIMER_PERIOD ;
881+ let resolution = resolution. min ( operator_source_frequency) ;
880882 unsafe {
881883 esp_idf_sys:: mcpwm_timer_set_resolution ( U :: unit ( ) , O :: timer ( ) , resolution) ;
882884 }
You can’t perform that action at this time.
0 commit comments