- #include "mcc_generated_files/mcc.h"
- static uint16_t PWMCount = 0;
- static uint16_t PWMDutyCount = 1;
- static uint8_t Direction = 0;
- void LED_Breathing_cb(void)
- {
- PWMCount++;
- if(PWMCount >= 500)
- {
- LED_SetLow();
- PWMCount = 0;
- if(Direction == 0)
- {
- PWMDutyCount++;
- if(PWMDutyCount > 499)
- {
- Direction = 1;
- }
- }
- else
- {
- PWMDutyCount--;
- if(PWMDutyCount <= 1)
- {
- Direction = 0;
- }
- }
- }
- else if(PWMCount == PWMDutyCount)
- {
- LED_SetHigh();
- }
- }