/* This function initializes clock module by opening the CGC Module and Changes the System Clock to MOSC.  */
static fsp_err_t init_cgc(void)
/* This function initializes clock module by opening the CGC Module and Changes the System Clock to MOSC.  */
static fsp_err_t init_cgc(void)
{
    fsp_err_t err = FSP_SUCCESS;
    cgc_clock_t       lsys_clock_source = {RESET_VALUE};
    cgc_divider_cfg_t sys_divider_cf    = {RESET_VALUE};
    err = R_CGC_Open(&g_cgc0_ctrl, &g_cgc0_cfg);
    if (FSP_SUCCESS == err)
    {
        err =  R_CGC_SystemClockGet(&g_cgc0_ctrl, &lsys_clock_source, &sys_divider_cf);
        if (FSP_SUCCESS == err)
        {
            LOG_D("MCU Running with Clock Source = %s.", clk_to_string(lsys_clock_source));
        }
    }
    return err;
}