Merge branch 'main' into atmega1284p
This commit is contained in:
@@ -81,6 +81,8 @@ int PWM_Init(void)
|
||||
TCCR1B = BIT(WGM12) | BIT(WGM13) | BIT(CS10);
|
||||
ICR1 = PWM_CYCLE_TOP; // 8000 MHz / 25000 KHz
|
||||
|
||||
// TIMER3: Fast mode, non-inverting, top=ICR3, prescale /1
|
||||
|
||||
TCCR3A = BIT(WGM31) | BIT(COM3A1) | BIT(COM3B1);
|
||||
TCCR3B = BIT(WGM32) | BIT(WGM33) | BIT(CS30);
|
||||
ICR3 = PWM_CYCLE_TOP; // 8000 MHz / 25000 KHz
|
||||
@@ -100,7 +102,8 @@ void PWM_SetValue(int port, int value)
|
||||
if (port != FAN01 && port != FAN02 && port != FAN03)
|
||||
return; // Invalid port
|
||||
|
||||
n = CLAMP(value, 100, 0) * (PWM_CYCLE_TOP / 100.0f);
|
||||
// Workaround: Missing third 16-bit timer output
|
||||
n = CLAMP(value, 100, 0) * PWM_CYCLE_TOP / 100.0f;
|
||||
|
||||
Info("Setting duty cycle for %s to %d/%d...",
|
||||
(port == FAN01) ? "FAN01" :
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define PWM_CYCLE_TOP (F_CPU / 25000 - 1) // 8 MHz / 25 KHz
|
||||
#define FAN01_MIN_DUTY (PWM_CYCLE_TOP * 0.2f)
|
||||
#define FAN02_MIN_DUTY (PWM_CYCLE_TOP * 0.2f)
|
||||
#define FAN03_MIN_DUTY (PWM_CYCLE_TOP * 0.2f)
|
||||
#define FAN03_MIN_DUTY (0xFF * 0.2f)
|
||||
|
||||
int PWM_Init(void);
|
||||
void PWM_SetValue(int port, int value);
|
||||
|
||||
Reference in New Issue
Block a user