text: /***************************************************************************//**
   * @file
   * @brief app_init.c
   *******************************************************************************
   * # License
   * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
   *******************************************************************************
   *
   * SPDX-License-Identifier: Zlib
   *
   * The licensor of this software is Silicon Laboratories Inc.
   *
   * This software is provided 'as-is', without any express or implied
   * warranty. In no event will the authors be held liable for any damages
   * arising from the use of this software.
   *
   * Permission is granted to anyone to use this software for any purpose,
   * including commercial applications, and to alter it and redistribute it
   * freely, subject to the following restrictions:
   *
   * 1. The origin of this software must not be misrepresented; you must not
   *    claim that you wrote the original software. If you use this software
   *    in a product, an acknowledgment in the product documentation would be
   *    appreciated but is not required.
   * 2. Altered source versions must be plainly marked as such, and must not be
   *    misrepresented as being the original software.
   * 3. This notice may not be removed or altered from any source distribution.
   *
   ******************************************************************************/
  
  // -----------------------------------------------------------------------------
  //                                   Includes
  // -----------------------------------------------------------------------------
  #include <stdint.h>
  
  #include "sl_component_catalog.h"
  #include "rail.h"
  #include "rail_config.h"
  #include "sl_rail_util_init.h"
  #include "app_process.h"
  #include "sl_simple_led_instances.h"
  #include "app_log.h"
  
  #if defined(SL_CATALOG_KERNEL_PRESENT)
  #include "app_task_init.h"
  #endif
  
  // -----------------------------------------------------------------------------
  //                              Macros and Typedefs
  // -----------------------------------------------------------------------------
  
  // -----------------------------------------------------------------------------
  //                          Static Function Declarations
  // -----------------------------------------------------------------------------
  
  // -----------------------------------------------------------------------------
  //                                Global Variables
  // -----------------------------------------------------------------------------
  
  // -----------------------------------------------------------------------------
  //                                Static Variables
  // -----------------------------------------------------------------------------
  
  // -----------------------------------------------------------------------------
  //                          Public Function Definitions
  // -----------------------------------------------------------------------------
  
  /******************************************************************************
   * Print sample app name
   *****************************************************************************/
  SL_WEAK void print_sample_app_name(const char* app_name)
  {
    app_log_info("%s\n", app_name);
  }
  
  /******************************************************************************
   * The function is used for some basic initialization related to the app.
   *****************************************************************************/
  RAIL_Handle_t app_init(void)
  {
    // Get RAIL handle, used later by the application
    RAIL_Handle_t rail_handle = sl_rail_util_get_handle(SL_RAIL_UTIL_HANDLE_INST0);
  
    // Turn OFF LEDs
    sl_led_turn_off(&sl_led_led0);
    sl_led_turn_off(&sl_led_led1);
    init_display();
  
    // CLI info message
    print_sample_app_name("Light");
  
    // Start reception
    RAIL_Status_t status = RAIL_StartRx(rail_handle, CHANNEL, NULL);
    if (status != RAIL_STATUS_NO_ERROR) {
      app_log_warning("After initialization RAIL_StartRx() result:%d ", status);
    }
  
    return rail_handle;
  }
  
  // -----------------------------------------------------------------------------
  //                          Static Function Definitions
  // -----------------------------------------------------------------------------
  