/*
 * Copyright (c) 2021 Pimax. All rights reserved.
 * Author    Date          ChangeLog
 * Master    2021-03-18    First version
 */
#include "FreeRTOS.h"
#include "task.h"
#include "alps_config.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"

TaskHandle_t  log_task_handle;  


static void log_print_task(void *args)
{
    UNUSED_PARAMETER(args);
    ret_code_t err_code;

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    while(true)
    {
        UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
        vTaskDelay(10);
    }
}


void log_task_init(void)
{
    /* Create task for LED0 blinking with priority set to 2 */
    UNUSED_VARIABLE(xTaskCreate(log_print_task, 
                                LOG_THREAD_NAME, 
                                LOG_THREAD_STACK_SZIE, NULL, 
                                LOG_THREAD_PRIORITY, 
                                &log_task_handle));
}

