Software PWM Generation
Implement a software PWM generator in C using a timer tick function. The PWM must allow configurable duty cycle and period.
Constraints
- tick() called periodically.
- period and duty in ticks.
- pwm_output() returns HIGH/LOW.
- Internal counter rolls over.
- duty <= period.
1void pwm_init(int period, int duty);2int pwm_tick();