/*
 * Copyright (C) 2020, Huada Semiconductor Co., Ltd.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-10-30     CDT          first version
 */


/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_ddl.h"
#include "board.h"

#include <rtthread.h>
#include <rtdevice.h>

/*******************************************************************************
 * Local type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/

/* defined the LED pin: PC9 */
#define LED_PIN                 (41)

#define DELAY_MS                (RT_TICK_PER_SECOND)    /* 1s */

/*******************************************************************************
 * Global variable definitions (declared in header file with 'extern')
 ******************************************************************************/

/*******************************************************************************
 * Local function prototypes ('static')
 ******************************************************************************/

/*******************************************************************************
 * Local variable definitions ('static')
 ******************************************************************************/

/*******************************************************************************
 * Function implementation - global ('extern') and local ('static')
 ******************************************************************************/

/**
 *******************************************************************************
 ** \brief  Main function of GPIO output
 **
 ** \param  None
 **
 ** \retval int32_t Return value, if needed
 **
 ******************************************************************************/
int32_t main(void)
{
    rt_kprintf("Os is Start!!! \n");

    while(1)
    {
        rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
        rt_pin_write(LED_PIN, PIN_HIGH);
        rt_thread_delay(DELAY_MS);
        rt_pin_write(LED_PIN, PIN_LOW);
        rt_thread_delay(DELAY_MS);
     };
}

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/