Skip to content

Commit

Permalink
- change PWM freq. to ~15kHz instead of ~1 MHz
Browse files Browse the repository at this point in the history
  • Loading branch information
ehunck committed Jul 28, 2024
1 parent 5298688 commit 3dd5202
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions motor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ void motor_driver_setup(void)
// PWM Left
gpio_set_function(PIN_LEFT_MOTOR_PWM, GPIO_FUNC_PWM);
left_pwm_slice_num = pwm_gpio_to_slice_num(PIN_LEFT_MOTOR_PWM);
pwm_set_clkdiv_int_frac(left_pwm_slice_num, 61, 0);
pwm_set_wrap(left_pwm_slice_num, 128);
pwm_set_gpio_level(PIN_LEFT_MOTOR_PWM, 0);
pwm_set_enabled(left_pwm_slice_num, true);

// PWM Right
gpio_set_function(PIN_RIGHT_MOTOR_PWM, GPIO_FUNC_PWM);
right_pwm_slice_num = pwm_gpio_to_slice_num(PIN_RIGHT_MOTOR_PWM);
pwm_set_clkdiv_int_frac(right_pwm_slice_num, 61, 0);
pwm_set_wrap(right_pwm_slice_num, 128);
pwm_set_gpio_level(PIN_RIGHT_MOTOR_PWM, 0);
pwm_set_enabled(right_pwm_slice_num, true);
Expand Down

0 comments on commit 3dd5202

Please sign in to comment.