/*!
 * @file        user_tmr_config.c
 *
 * @brief       TMR DMA Configuration
 *
 * @version     V1.0.0
 *
 * @date        2026-03-26
 *
 * @attention
 *
 *  Copyright (C) 2026 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  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 in an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTIES 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.
 */

#include "user_tmr_config.h"

/** @addtogroup Examples
  @{
*/

/** @addtogroup TMR_Examples
@{
*/

/** @addtogroup TMR_DMA
  @{
*/

/** @defgroup TMR_DMA_Variables Variables
  @{
*/

Gpio_ConfigType g_tmrGpioConfig = {
    .mode    = GPIO_MODE_AF,
    .outtype = GPIO_OUT_TYPE_PP,
    .speed   = GPIO_SPEED_50MHz,
    .pupd    = GPIO_PUPD_NO
};

Dma_ConfigType g_dmaConfig = {
    .bufferSize        = 3,
    .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_MEMORY,
    .memoryTomemory    = DMA_M2M_DISABLE
};

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

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

/**@} end of group TMR_DMA_Variables */

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