drv_pwm.h 818 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef __DRV_PWM_H__
  11. #define __DRV_PWM_H__
  12. #include <rtthread.h>
  13. #ifdef BSP_USING_PWM
  14. #if defined(SOC_RISCV_SERIES_CH32V3)
  15. #include "ch32v30x_tim.h"
  16. #endif
  17. #if defined(SOC_RISCV_SERIES_CH32V2)
  18. #include "ch32v20x_tim.h"
  19. #endif
  20. #include <drivers/rt_drv_pwm.h>
  21. #include <drivers/hwtimer.h>
  22. #include <board.h>
  23. #define MAX_COUNTER 65535
  24. #define MIN_COUNTER 2
  25. #define MIN_PULSE 2
  26. #define FLAG_NOT_INIT 0xFF
  27. struct rtdevice_pwm_device
  28. {
  29. struct rt_device_pwm parent;
  30. TIM_TypeDef* periph;
  31. rt_uint8_t channel[4];
  32. char* name;
  33. };
  34. #endif/* BSP_USING_PWM */
  35. #endif/* __DRV_PWM_H__ */