/*!
 * @file        user_tmr_config.c
 *
 * @brief       TMR Parallel Synchro configuration
 *
 * @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).
 */

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

/** @addtogroup Examples
  @{
*/

/** @addtogroup TMR_Examples
@{
*/

/** @addtogroup TMR_ParallelSynchro
  @{
*/

/** @defgroup TMR_ParallelSynchro_Variables Variables
  @{
*/

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

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

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

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

Tmr_TimeBaseType g_tmr2_BaseConfig = {
    .div = 0,
    .period = 1,
    .clockDivision = TMR_CKD_DIV1,
    .counterMode = TMR_COUNTER_MODE_UP
};

Tmr_TimeBaseType g_tmr3_BaseConfig = {
    .div = 1,
    .period = 1,
    .clockDivision = TMR_CKD_DIV1,
    .counterMode = TMR_COUNTER_MODE_UP
};

Tmr_TimeBaseType g_tmr1_BaseConfig = {
    .clockDivision = TMR_CKD_DIV1,
    .counterMode = TMR_COUNTER_MODE_UP,
    .div = 63,
    .period = 999,
    .repetitionCounter = 0
};

Tmr_IcConfigType g_tmr1_IC2Config = {
    .channel = TMR_CHANNEL_2,
    .ICfilter = 0x00,
    .ICpolarity = TMR_IC_POLARITY_RISING,
    .ICprescaler = TMR_ICPSC_DIV1,
    .ICselection = TMR_IC_SELECTION_INDIRECT_TI
};

Tmr_OcConfigType g_tmr1_OC1PWMConfig = {
    .OC_Mode = TMR_OC_MODE_PWM1,
    .OC_Idlestate = TMR_OCIDLESTATE_RESET,
    .OC_NIdlestate = TMR_OCNIDLESTATE_RESET,
    .OC_OutputNState = TMR_OUTPUT_NSTATE_DISABLE,
    .OC_OutputState = TMR_OUTPUT_STATE_ENABLE,
    .OC_Polarity = TMR_OC_POLARITY_HIGH,
    .OC_NPolarity = TMR_OC_NPOLARITY_HIGH,
    .Pulse = 500
};

Tmr_OcConfigType g_tmr_OC1CommonConfig = {
    .OC_Mode = TMR_OC_MODE_PWM1,
    .OC_Idlestate = TMR_OCIDLESTATE_RESET,
    .OC_NIdlestate = TMR_OCNIDLESTATE_RESET,
    .OC_OutputNState = TMR_OUTPUT_NSTATE_DISABLE,
    .OC_OutputState = TMR_OUTPUT_STATE_ENABLE,
    .OC_Polarity = TMR_OC_POLARITY_HIGH,
    .OC_NPolarity = TMR_OC_NPOLARITY_HIGH,
    .Pulse = 1
};

/**@} end of group TMR_ParallelSynchro_Variables */
/**@} end of group TMR_ParallelSynchro */
/**@} end of group TMR_Examples */
/**@} end of group Examples */
