Flattened code structure of pwm_server.xc to speed up code, and advanced ADC-trigger by 1/4 PWM period (NB This has to compensated by a 1/4 period delay in ADC block)