/* Internal function that looks for the target task in the TWDT task list. Returns the list item if found and returns null if not found. Also checks if all the other tasks have reset. Should be called within critical.  */
static twdt_task_t* find_task_in_twdt_list(TaskHandle_t handle, bool *all_reset)
/* Internal function that looks for the target task in the TWDT task list. Returns the list item if found and returns null if not found. Also checks if all the other tasks have reset. Should be called within critical.  */
static twdt_task_t* find_task_in_twdt_list(TaskHandle_t handle, bool *all_reset)
{
    twdt_task_t *target = NULL;
    *all_reset = true;
    for(twdt_task_t *task = twdt_config->list; task != NULL; task = task->next){
        if(task->task_handle == handle){
            target = task;
        }else{
            if(task->has_reset == false){
                *all_reset = false;
            }
        }
    }
    return target;
}