And here is one way to do what @richard-damon suggested -
/* Obtain the task handle at the time of task creation. */
TaskHandle_t dk_task_handle;
rtos_api_result = xTaskCreate( dk_task,
"DK Task",
DK_TASK_STACK_SIZE,
NULL,
DK_TASK_PRIORITY,
&( dk_task_handle ) );
void uart_task( void * arg )
{
for( ;; )
{
if( char_notification_enabled == true )
{
adc_single_channel_process();
/* Signal the dk task. */
xTaskNotifyGive( dk_task_handle );
adc_send_notification();
}
if( humidity_notification_enabled == true )
{
humidity_send_notification();
}
if( temperature_notification_enabled == true )
{
temperature_send_notification();
}
/* 200ms delay between scans. */
cyhal_system_delay_ms( 200 );
}
}
void dk_task( void * pvParam )
{
for( ;; )
{
/* Wait for a notification from the uart_task. */
ulTaskNotifyTake( pdTRUE, portMAX_DELAY );
if( adc_percent > dset)
{
cyhal_gpio_write( P7_1, true );
}
else
{
cyhal_gpio_write( P7_1, false );
}
}
}