Advertisement
Guest User

xD

a guest
Dec 8th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.26 KB | None | 0 0
  1. void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
  2. {
  3.     counter++; //ZMIENNA PODPIĘTA POD SysTick_Handler();
  4.         if(i==BLINKWITHVALUES){ //TRYB MRUGANIA DIODA GDY PODALIŚMY WARTOŚCI
  5.              if(counter>=pomoc){
  6.                 if(pulse_direction==UP){
  7.                     pulse_direction=DOWN;
  8.                     __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,0);
  9.                     }
  10.                 else{
  11.                     pulse_direction=UP;
  12.                     __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,65535);
  13.                     mrug--;
  14.                 }
  15.                 if(pomoc==wl){
  16.                     pomoc=wyl;
  17.                     }
  18.                 else{
  19.                     pomoc=wl;
  20.                     }
  21.                 counter=0;
  22.                 if(mrug==0){
  23.                     i=OFF;
  24.                 }
  25.             }
  26.         }
  27.           if(i==DEFAULTBLINK&&counter>=1000){ //DOMYŚLNY TRYB MRUGANIA BEZ PODANYCH WARTOSCI
  28.             if(pulse_direction==UP){
  29.                 pulse=65535;
  30.                 pulse_direction=DOWN;
  31.                 }
  32.             else{
  33.                 pulse=0;
  34.                 pulse_direction=UP;
  35.                 }
  36.                 __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,pulse);
  37.                 counter=0;
  38.             }
  39.     if(i==PULSE){ //TRYB PULSOWANIA DIODĄ
  40.          __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,pulse);
  41.          f(pulse_direction==UP){
  42.             if(pulse>=65535)
  43.                 pulse_direction=DOWN;
  44.             else
  45.                 pulse+=65.535;
  46.             }
  47. else{
  48.             if(pulse<=0)
  49.                 pulse_direction=UP;
  50.             else
  51.                 pulse-=65.535;
  52.          }
  53.     }
  54.     IWDG_Refresh(); //ODŚWIEŻENIE WATCHDOG’A
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement