error: declaration may not appear after executable statement in block

When transplanting timer 4-way PWM output, I found this problem after typing the code.

As shown in the figure, the location of the error is reported, and then my solution is:

Just define a function.

Read More: