The turnOffPWM() stops PWM output of a specified timer. Please refer to the explanation of the analogWrite().
Stopping the PWM output is carried out by controlling timer/counter register.
The turnOffPWM() is defined in hardware/arduino/avr/cores/arduino/wiring_digital.c as below. The function deals with many chips using #ifs.
The input is timer and its type is uint8_t. According to the value of timer, it operates the compare match output bit of Timer/Counter Control Registers(TCCRnx) to stop the output.
The cbi() is a macro to set the bit(the second argument) of the address(the first argument) to 0.
June 19, 2020