drv_pwm.h 704 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2006-2022, 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. #include "ch32v30x_tim.h"
  15. #include <drivers/rt_drv_pwm.h>
  16. #include <drivers/hwtimer.h>
  17. #include <board.h>
  18. #define MAX_COUNTER 65535
  19. #define MIN_COUNTER 2
  20. #define MIN_PULSE 2
  21. #define FLAG_NOT_INIT 0xFF
  22. struct rtdevice_pwm_device
  23. {
  24. struct rt_device_pwm parent;
  25. TIM_TypeDef* periph;
  26. rt_uint8_t channel[4];
  27. char* name;
  28. };
  29. #endif/* BSP_USING_PWM */
  30. #endif/* __DRV_PWM_H__ */