/******************************************************************************* * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved. * * This software component is licensed by HDSC under BSD 3-Clause license * (the "License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause */ /******************************************************************************/ /** \file hc32f460_timer0.h ** ** A detailed description is available at ** @link Timer0Group description @endlink ** ** - 2018-10-11 CDT First version for Device Driver Library of TIMER0. ** ******************************************************************************/ #ifndef __HC32F460_TIMER0_H__ #define __HC32F460_TIMER0_H__ /******************************************************************************* * Include files ******************************************************************************/ #include "hc32_common.h" #include "ddl_config.h" #if (DDL_TIMER0_ENABLE == DDL_ON) /* C binding of definitions if building with C++ compiler */ #ifdef __cplusplus extern "C" { #endif /** ******************************************************************************* ** \defgroup Timer0Group Timer0 ** ******************************************************************************/ //@{ /******************************************************************************* * Global type definitions ('typedef') ******************************************************************************/ /** ******************************************************************************* ** \brief Timer0 channel enumeration ** ******************************************************************************/ typedef enum en_tim0_channel { Tim0_ChannelA = 0x00u, Tim0_ChannelB = 0x01u }en_tim0_channel_t; /** ******************************************************************************* ** \brief Timer0 Async Mode clock enumeration ** ******************************************************************************/ typedef enum en_tim0_async_clock_src { Tim0_LRC = 0x00u, Tim0_XTAL32 = 0x01u }en_tim0_async_clock_src_t; /** ******************************************************************************* ** \brief Timer0 Sync Mode clock enumeration ** ******************************************************************************/ typedef enum en_tim0_sync_clock_src { Tim0_Pclk1 = 0x00u, Tim0_InsideHardTrig = 0x01u }en_tim0_sync_clock_src_t; /** ******************************************************************************* ** \brief Timer0 counter mode enumeration ** ******************************************************************************/ typedef enum en_tim0_counter_mode { Tim0_Sync = 0x00u, Tim0_Async = 0x01u }en_tim0_counter_mode_t; /** ******************************************************************************* ** \brief Timer0 trigger event mode enumeration ** ******************************************************************************/ typedef enum en_tim0_function { Tim0_OutputCapare = 0x00u, Tim0_InputCaptrue = 0x01u }en_tim0_function_t; /** ******************************************************************************* ** \brief Timer0 clock division enumeration ** ******************************************************************************/ typedef enum en_tim0_clock_div { Tim0_ClkDiv0 = 0u, Tim0_ClkDiv2, Tim0_ClkDiv4, Tim0_ClkDiv8, Tim0_ClkDiv16, Tim0_ClkDiv32, Tim0_ClkDiv64, Tim0_ClkDiv128, Tim0_ClkDiv256, Tim0_ClkDiv512, Tim0_ClkDiv1024 }en_tim0_clock_div_t; /** ******************************************************************************* ** \brief Timer0 common trigger source select enumeration ** ******************************************************************************/ typedef enum en_tim0_com_trigger { Tim0ComTrigger_1 = 1u, ///< Select common trigger 1. Tim0ComTrigger_2 = 2u, ///< Select common trigger 2. Tim0ComTrigger_1_2 = 3u, ///< Select common trigger 1 and 2. } en_tim0_com_trigger_t; /** ******************************************************************************* ** \brief Timer0 trigger function init structrue definition ** ******************************************************************************/ typedef struct stc_tim0_trigger_init { en_tim0_function_t Tim0_OCMode; ///