Phase Correct PWM library?

I would guess you need to use an external interrupt handler to start the output pulse and start a hardware timer which will trigger an interrupt handler to end the pulse. I can follow the general principles well enough to feel that it ought to be possible, but it'd require direct configuration of the hardware timers which I have no experience of. Given that you've found an article explaining how to do this sort of thing, I'm sure you'll figure it out with perseverance.