void timer1_fast_pwm_init() {
// Set PB1 (OC1A) as output
DDRB |= (1 << PB1);
// Configure Timer1 for Fast PWM
TCCR1A = (1 << WGM11) | (1 << WGM10) | (1 << COM1A1); // Fast PWM (10-bit), Clear OC1A on Compare Match
TCCR1B = (1 << WGM12) | (1 << CS11); // Fast PWM, Prescaler = 8
// Set initial duty cycle to 50%
OCR1A = 512; // 50% of 10-bit range (0 to 1023)
// Set TOP value for 10-bit PWM
ICR1 = 1023; // Full range of 10-bit Fast PWM
}
int main() {
timer1_fast_pwm_init();
while (1) {
//
}
return 0;
}