From aed3cc162fa83971c9cd1afe42809746de4246b0 Mon Sep 17 00:00:00 2001 From: Trisuborn <553070703@qq.com> Date: Tue, 19 Jan 2021 17:14:32 +0800 Subject: 为stm32的PWM驱动添加对STM32H7的支持、添加互补PWM功能的支持,补全pwm_get命令 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/drivers/rt_drv_pwm.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'components/drivers/include') diff --git a/components/drivers/include/drivers/rt_drv_pwm.h b/components/drivers/include/drivers/rt_drv_pwm.h index 16de4c6ab8..4b436758d9 100644 --- a/components/drivers/include/drivers/rt_drv_pwm.h +++ b/components/drivers/include/drivers/rt_drv_pwm.h @@ -21,9 +21,15 @@ struct rt_pwm_configuration { - rt_uint32_t channel; /* 0-n */ - rt_uint32_t period; /* unit:ns 1ns~4.29s:1Ghz~0.23hz */ - rt_uint32_t pulse; /* unit:ns (pulse<=period) */ + rt_uint32_t channel; /* 0-n */ + rt_uint32_t period; /* unit:ns 1ns~4.29s:1Ghz~0.23hz */ + rt_uint32_t pulse; /* unit:ns (pulse<=period) */ + + /* + * RT_TRUE : The channel of pwm is complememtary. + * RT_FALSE : The channel of pwm is nomal. + */ + rt_bool_t complementary; }; struct rt_device_pwm; @@ -40,8 +46,8 @@ struct rt_device_pwm rt_err_t rt_device_pwm_register(struct rt_device_pwm *device, const char *name, const struct rt_pwm_ops *ops, const void *user_data); -rt_err_t rt_pwm_enable(struct rt_device_pwm *device, int channel); -rt_err_t rt_pwm_disable(struct rt_device_pwm *device, int channel); +rt_err_t rt_pwm_enable(struct rt_device_pwm *device, int channel, rt_uint8_t complementary); +rt_err_t rt_pwm_disable(struct rt_device_pwm *device, int channel, rt_uint8_t complementary); rt_err_t rt_pwm_set(struct rt_device_pwm *device, int channel, rt_uint32_t period, rt_uint32_t pulse); #endif /* __DRV_PWM_H_INCLUDE__ */ -- cgit v1.3.1