LED Breathing Effect
You need to do two things - the first is make it fade out. The brightness of the LED is determined by the value in the TPM1C2VH register. by changing TPM1C2VH you are changing the brightness. In order to decrease the brightness, you need to switch around the direction so that you're counting in the opposite direction.

The second bit you need to do is detect when you are increasing and when you are decreasing. You need something like an if statement, like so:

if (TPM1C2VH &gt;= max_threshold)
  // decrease TPM1C2VH
else if (TPM1C2VH &lt;= min_threshold)
  // increase TPM1C2VH


Combine these two, and you have your breathing LED.