Add license information to files. Mostly automated with: find src/ -name '*.[c,h]' | xargs sed -i '1s,^,// SPDX-License-Identifier: GPL-3.0-only\n\n,' find src/ -name '*.mk' | xargs sed -i '1s,^,# SPDX-License-Identifier: GPL-3.0-only\n\n,'
31 lines
557 B
C
31 lines
557 B
C
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <board/pwm.h>
|
|
|
|
void pwm_init(void) {
|
|
// Set T0CHSEL to TACH0A and T1CHSEL to TACH1A
|
|
TSWCTLR = 0;
|
|
|
|
// Disable PWM
|
|
ZTIER = 0;
|
|
|
|
// Set prescalar clock frequency to EC clock
|
|
PCFSR = 0b01;
|
|
|
|
// Use C0CPRS and CTR0 for all channels
|
|
PCSSGL = 0;
|
|
PCSSGH = 0;
|
|
|
|
// Set clock prescaler to 0 + 1
|
|
C0CPRS = 0;
|
|
|
|
// Set cycle time to 255 + 1
|
|
CTR0 = 255;
|
|
|
|
// Turn off CPU fan (temperature control in peci_event)
|
|
DCR2 = 0;
|
|
|
|
// Enable PWM
|
|
ZTIER = (1 << 1);
|
|
}
|