Advertisement
Guest User

kurwa stm

a guest
Jan 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. //W mainie po TIM1_INIT
  2.     HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
  3.     TIM_OC_InitTypeDef sConfigOC;
  4.     sConfigOC.OCMode = TIM_OCMODE_PWM1;
  5.     htim1.Instance->CCR1 = 0;
  6.     sConfigOC.Pulse = pulse;
  7.     sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
  8.     sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
  9.  
  10.  
  11.  
  12. //w while
  13.  
  14. else if (strcmp(payload, "pulse") == 0) {
  15.                 Tx_Send("Pulse\r\n");
  16.                 while(USART_linia(payload) == 0){
  17.                 for (pulse = 0; pulse < 31999; pulse += 50) {
  18.                     stan = 1;
  19.                     while (stan) {
  20.  
  21.                         if (czasUplyniety > 20) {
  22.                             __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, pulse);
  23.                             czasUplyniety = 0;
  24.                             stan = 0;
  25.                         }
  26.                     }
  27.                 }
  28.                 mig=31999;
  29.                 for (pulse = 0; pulse < 31999; pulse += 50) {
  30.                     stan1 = 1;
  31.                     while (stan1) {
  32.                         if (czasUplyniety > 20) {
  33.                             __HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, mig);
  34.                             czasUplyniety = 0;
  35.                             stan1 = 0;
  36.                         }
  37.                     }
  38.                     mig-=50;
  39.                 }
  40.                 }
  41.  
  42.  
  43.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement