/* * src/pwm.c * (c) 2022 Jonas Gunz * License: MIT */ #include "pwm.h" #include uint8_t t0_ovf_cnt = 0; uint8_t pwm_duty[PWM_PINS]; uint8_t pwm_target[PWM_PINS]; ISR(TIMER0_OVF_vect) { uint8_t i; cli(); /*TCNT0 = (1<<7);*/ /* Hack-increase Interrupt trigger freq */ t0_ovf_cnt ++; for( i=0; i pwm_target[i]) pwm_duty[i]--; } sei(); } void pwm_init() { uint8_t i; PWM_DDR |= (0xff >> (8-PWM_PINS)); PWM_PORT &= ~(0xff >> (8-PWM_PINS)); for ( i=0; i