How does the code in beacon.c generate the waveforms?
Beacon.c just initializes the two CCP/PWM modules to generate a 40KHz, 50% square wave. Timer 0 is then used to periodically call a software state machine that does two things: Controls which, if any, PWM channel is allowed to oscillate and then sets the delay, via timer 0, before the state machine is called again.