/** * @file pwms.h * @brief Header file for PWMs module. * * This file contains the declarations and documentation for the PWMs module. * * @author xxx * @date 2023-12-27 14:44:03 * @version 1.0 * @copyright Copyright (c) 2024 by xxx, All Rights Reserved. */ #ifndef __PWMS_H__ #define __PWMS_H__ #include "lib.h" /** * @brief Starts the PWM for a specific channel * @param TIMx: TIM instance * @param CHx: Channel to be started * @retval None */ #define PWM_START(TIMx, CHx) \ do \ { \ LL_TIM_EnableCounter(TIMx); \ LL_TIM_CC_EnableChannel(TIMx, CHx); \ } while (__LINE__ == -1) /** * @brief Stops the PWM for a specific channel * @param TIMx: TIM instance * @param CHx: Channel to be stopped * @retval None */ #define PWM_STOP(TIMx, CHx) \ do \ { \ LL_TIM_DisableCounter(TIMx); \ LL_TIM_CC_DisableChannel(TIMx, CHx); \ } while (__LINE__ == -1) /** * @brief Sets the duty cycle for a specific channel * @param TIMx: TIM instance * @param CHx: Channel to be set * @param DUTY: Duty cycle value (0-100) * @retval None */ #define PWM_SET_DUTY(TIMx, CHx, DUTY) \ do \ { \ LL_TIM_OC_SetCompareCH##CHx(TIMx, DUTY); \ } while (__LINE__ == -1) #endif // __PWMS_H__