🐛 Fix, improve PWM on AVR (#23463)

This commit is contained in:
Mike La Spina
2022-01-12 17:28:53 -06:00
committed by GitHub
parent 3e2a38b653
commit 2cfde39eca
7 changed files with 131 additions and 189 deletions

View File

@@ -207,6 +207,7 @@ inline void HAL_adc_init() {
#define strtof strtod
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
#define PWM_FREQUENCY 1000 // Default PWM frequency when set_pwm_duty() is called without set_pwm_frequency()
/**
* set_pwm_frequency
@@ -226,3 +227,9 @@ void set_pwm_frequency(const pin_t pin, const uint16_t f_desired);
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
/*
* init_pwm_timers
* sets the default frequency for timers 2-5 to 1000HZ
*/
void init_pwm_timers();