/*!
 * @file        user_tmr_config.c
 *
 * @brief       Main program body
 *
 * @version     V1.0.0
 *
 * @date        2026-03-27
 *
 * @attention
 *
 *  Copyright (C) 2026 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the Geehy Semiconductor Software License Agreement for the governing permissions
 *  and limitations under the License.
 */

/* Includes */
#include "user_tmr_config.h"

/** @addtogroup Examples
  @{
*/

/** @addtogroup TMR_Examples
@{
*/

/** @addtogroup TMR_TimeStampWithDma
  @{
*/

/** @defgroup TMR_TimeStampWithDma_Variables Variables
  @{
*/

#define TIME_STAMP_BUFF_SIZE_WITHDMA  10u

Gpio_ConfigType g_tmr1_ch3_gpio_config = {
    .mode = GPIO_MODE_AF,
    .outtype = GPIO_OUT_TYPE_PP,
    .pin  = (uint16_t)TMR1_CH3_GPIO_PIN,
    .pupd = GPIO_PUPD_NO,
    .speed = GPIO_SPEED_50MHz
};

Tmr_TimeBaseType g_tmr1_timebase_config = {
    .clockDivision = TMR_CKD_DIV1,
    .counterMode = TMR_COUNTER_MODE_UP,
    .div = 7,
    .period = 0xFFFF,
    .repetitionCounter = 0
};

Tmr_IcConfigType g_tmr1_ic3_config = {
    .channel = TMR_CHANNEL_3,
    .ICfilter = 0x00,
    .ICpolarity = TMR_IC_POLARITY_BOTHEDGE,
    .ICprescaler = TMR_ICPSC_DIV1,
    .ICselection = TMR_IC_SELECTION_DIRECT_TI
};

Dma_ConfigType g_dma1_ch5_config = {
    .bufferSize = TIME_STAMP_BUFF_SIZE_WITHDMA,
    .memoryDataSize = DMA_MEMORY_DATASIZE_HALFWORD,
    .peripheralDataSize = DMA_PERIPHERAL_DATASIZE_HALFWORD,
    .memoryInc = DMA_MEMORY_INC_ENABLE,
    .peripheralInc = DMA_PERIPHERAL_INC_DISABLE,
    .circular = DMA_CIRCULAR_ENABLE,
    .priority = DMA_PRIORITY_LEVEL_HIGHT,
    .direction = DMA_DIR_PERIPHERAL,
    .memoryTomemory = DMA_M2M_DISABLE
};

/**@} end of group TMR_TimeStampWithDma_Variables */

/**@} end of group TMR_TimeStampWithDma */
/**@} end of group TMR_Examples */
/**@} end of group Examples */
