Question
Switch-case function two interrupt timer controlled Elapsed Call Back Function
Hello,
I activated TIM6 and TIM7 in interrupt mode. In the elapsed call back function, I checked TIM7 with toggle function, and it works. But when I place switch-case related functions. It didn't work. Could you check it what I missing?
Thank you
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim->Instance==TIM6)
{
HAL_ADC_Start(&hadc1);
HAL_ADC_Start(&hadc2);
HAL_ADC_PollForConversion(&hadc1,1);
ADC_of_VoltageTransients[i]=HAL_ADC_GetValue(&hadc1);
testdata_in_1[i]= ((float)ADC_of_VoltageTransients[i]*(3.3/4096.0));
HAL_ADC_PollForConversion(&hadc2,1);
ADC_of_EvokedRecordings[i]=HAL_ADC_GetValue(&hadc2);
testdata_in_2[i]= ((float)ADC_of_EvokedRecordings[i]*(3.3/4096.0));
HAL_ADC_Stop(&hadc1);
HAL_ADC_Stop(&hadc2);
i++;
if(i>=1000){
HAL_TIM_Base_Stop_IT(&htim6);
}
}
if(htim->Instance==TIM7)
{
//HAL_GPIO_TogglePin(Led_GPIO_Port,Led_Pin);
switch (count)
{
case 0:
break;
case 50:
HAL_GPIO_WritePin(Phase_1st_GPIO_Port, Phase_1st_Pin, GPIO_PIN_SET);
break;
case 70:
HAL_GPIO_WritePin(Phase_2nd_GPIO_Port, Phase_2nd_Pin, GPIO_PIN_SET);
break;
case 80:
HAL_GPIO_WritePin(Phase_1st_GPIO_Port, Phase_1st_Pin, GPIO_PIN_RESET);
break;
case 100:
HAL_GPIO_WritePin(Phase_2nd_GPIO_Port, Phase_2nd_Pin, GPIO_PIN_RESET);
count=-1;
}
count++;
}
}