1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2022-10-20 MXH the first version 9 */ 10 11 #ifndef __DRV_PWM_H__ 12 #define __DRV_PWM_H__ 13 14 #include <rtthread.h> 15 #ifdef BSP_USING_PWM 16 #if defined(SOC_RISCV_SERIES_CH32V3) 17 #include "ch32v30x_tim.h" 18 #endif 19 #if defined(SOC_RISCV_SERIES_CH32V2) 20 #include "ch32v20x_tim.h" 21 #endif 22 #include <drivers/dev_pwm.h> 23 #include <drivers/hwtimer.h> 24 #include <board.h> 25 26 #define MAX_COUNTER 65535 27 #define MIN_COUNTER 2 28 #define MIN_PULSE 2 29 #define FLAG_NOT_INIT 0xFF 30 31 struct rtdevice_pwm_device 32 { 33 struct rt_device_pwm parent; 34 TIM_TypeDef* periph; 35 rt_uint8_t channel[4]; 36 char* name; 37 }; 38 39 #endif/* BSP_USING_PWM */ 40 41 #endif/* __DRV_PWM_H__ */ 42