We fast as fuck with osThreadFlagsSet/Wait
This commit is contained in:
@@ -92,8 +92,11 @@ void TellTime(void *argument);
|
|||||||
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
|
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
|
||||||
if (htim->Instance == TIM2 && htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
|
if (htim->Instance == TIM2 && htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
|
||||||
trig_value = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
|
trig_value = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
|
||||||
trig_flag = 1;
|
//trig_flag = 1;
|
||||||
xTaskNotifyFromISR(TimeCHHandle,trig_value,eSetValueWithOverwrite,NULL);
|
//xTaskNotifyFromISR(TimeCHHandle,trig_value,eSetValueWithOverwrite,NULL);
|
||||||
|
TimeCHBuffer[0]=trig_value;
|
||||||
|
osThreadFlagsSet(TimeCHHandle,0x01);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,9 +398,9 @@ void StartDefaultTask(void *argument)
|
|||||||
uint32_t t = 0;
|
uint32_t t = 0;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
SEGGER_RTT_printf(0, "%lu\n\r",__HAL_TIM_GET_COUNTER(&htim2)-t);
|
//SEGGER_RTT_printf(0, "%lu\n\r",__HAL_TIM_GET_COUNTER(&htim2)-t);
|
||||||
t=__HAL_TIM_GET_COUNTER(&htim2);
|
//t=__HAL_TIM_GET_COUNTER(&htim2);
|
||||||
osDelay(1000);
|
//osDelay(1000);
|
||||||
}
|
}
|
||||||
/* USER CODE END 5 */
|
/* USER CODE END 5 */
|
||||||
}
|
}
|
||||||
@@ -416,8 +419,9 @@ void TellTime(void *argument)
|
|||||||
uint32_t ulvalue;
|
uint32_t ulvalue;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
xTaskNotifyWait(0,0,&ulvalue,portMAX_DELAY);
|
//xTaskNotifyWait(0,0,&ulvalue,portMAX_DELAY);
|
||||||
SEGGER_RTT_printf(0, "%lu, %lu\n\r",ulvalue,__HAL_TIM_GET_COUNTER(&htim2));
|
osThreadFlagsWait(0x01,osFlagsWaitAny,osWaitForever);
|
||||||
|
SEGGER_RTT_printf(0, "%lu, %lu\n\r",TimeCHBuffer[0],__HAL_TIM_GET_COUNTER(&htim2));
|
||||||
}
|
}
|
||||||
/* USER CODE END TellTime */
|
/* USER CODE END TellTime */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user