|
@@ -18,7 +18,7 @@
|
|
|
* Change Logs:
|
|
|
* Date Author Notes
|
|
|
* 2019-03-11 wangyq the first version
|
|
|
- * 2019-11-01 wangyq update libraries
|
|
|
+ * 2019-11-01 wangyq update libraries
|
|
|
* 2021-04-20 liuhy the second version
|
|
|
*/
|
|
|
|
|
@@ -57,32 +57,32 @@ static rt_err_t es32f3_pwm_control(struct rt_device_pwm *device, int cmd, void *
|
|
|
struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg;
|
|
|
|
|
|
RT_ASSERT(timer_initstruct != RT_NULL);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/* select pwm output channel */
|
|
|
if (1 == cfg->channel)
|
|
|
{
|
|
|
pwm_channel = TIMER_CHANNEL_1;
|
|
|
_ccep_ch_en = timer_initstruct->perh->CCEP & TIMER_CCEP_CC1EN_MSK;
|
|
|
}
|
|
|
- else if (2 == cfg->channel)
|
|
|
+ else if (2 == cfg->channel)
|
|
|
{
|
|
|
pwm_channel = TIMER_CHANNEL_2;
|
|
|
_ccep_ch_en = timer_initstruct->perh->CCEP & TIMER_CCEP_CC2EN_MSK;
|
|
|
}
|
|
|
- else if (3 == cfg->channel)
|
|
|
+ else if (3 == cfg->channel)
|
|
|
{
|
|
|
pwm_channel = TIMER_CHANNEL_3;
|
|
|
_ccep_ch_en = timer_initstruct->perh->CCEP & TIMER_CCEP_CC3EN_MSK;
|
|
|
}
|
|
|
- else if (4 == cfg->channel)
|
|
|
+ else if (4 == cfg->channel)
|
|
|
{
|
|
|
pwm_channel = TIMER_CHANNEL_4;
|
|
|
_ccep_ch_en = timer_initstruct->perh->CCEP & TIMER_CCEP_CC4EN_MSK;
|
|
|
}
|
|
|
else
|
|
|
return RT_EINVAL;
|
|
|
-
|
|
|
+
|
|
|
switch (cmd)
|
|
|
{
|
|
|
case PWM_CMD_ENABLE:
|
|
@@ -94,53 +94,53 @@ static rt_err_t es32f3_pwm_control(struct rt_device_pwm *device, int cmd, void *
|
|
|
break;
|
|
|
|
|
|
case PWM_CMD_SET:
|
|
|
-
|
|
|
+
|
|
|
/*当通道没开的时候:关通道,设置输出模式和极性,初始化通道*/
|
|
|
- if(!_ccep_ch_en)
|
|
|
- {
|
|
|
- tim_ocinit.oc_mode = ES_PWM_OC_MODE;
|
|
|
+ if(!_ccep_ch_en)
|
|
|
+ {
|
|
|
+ tim_ocinit.oc_mode = ES_PWM_OC_MODE;
|
|
|
tim_ocinit.oc_polarity = ES_PWM_OC_POLARITY;
|
|
|
tim_ocinit.oc_fast_en = DISABLE;
|
|
|
tim_ocinit.ocn_polarity = TIMER_OCN_POLARITY_HIGH;
|
|
|
tim_ocinit.ocn_idle = TIMER_OCN_IDLE_RESET;
|
|
|
tim_ocinit.oc_idle = TIMER_OC_IDLE_RESET;
|
|
|
-
|
|
|
+
|
|
|
ald_timer_oc_config_channel(timer_initstruct, &tim_ocinit, pwm_channel);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
bus_speed = (uint64_t)ald_cmu_get_pclk1_clock();
|
|
|
-
|
|
|
+
|
|
|
/*判断外设的计数器最大值*/
|
|
|
-#ifdef ES32F36xx
|
|
|
+#ifdef ES32F36xx
|
|
|
if((timer_initstruct->perh == GP32C4T0)||(timer_initstruct->perh == GP32C4T1))
|
|
|
{
|
|
|
- _maxcnt = 0xFFFFFFFF;
|
|
|
+ _maxcnt = 0xFFFFFFFF;
|
|
|
}
|
|
|
else _maxcnt = 0xFFFF;
|
|
|
#else
|
|
|
_maxcnt = 0xFFFF;
|
|
|
-#endif
|
|
|
-
|
|
|
+#endif
|
|
|
+
|
|
|
/*当最大分频 <= _maxcnt时:估计大概的分频,加快速度 */
|
|
|
tmp = bus_speed * (cfg->period)/1000000000/_maxcnt;
|
|
|
timer_initstruct->init.prescaler = (tmp > 2U) ? (tmp - 2U) : 0U ; /*bus_speed < 500000000*/
|
|
|
-
|
|
|
+
|
|
|
/* count registers max , auto adjust prescaler */
|
|
|
do
|
|
|
{
|
|
|
_arr = bus_speed * (cfg->period) / 1000000000 /(++timer_initstruct->init.prescaler);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- while (_arr > _maxcnt);
|
|
|
-
|
|
|
+ while (_arr > _maxcnt);
|
|
|
+
|
|
|
WRITE_REG(timer_initstruct->perh->AR, (uint32_t)_arr);
|
|
|
timer_initstruct->init.period = (uint32_t)_arr;
|
|
|
-
|
|
|
+
|
|
|
/* update prescaler */
|
|
|
WRITE_REG(timer_initstruct->perh->PRES, --timer_initstruct->init.prescaler);
|
|
|
-
|
|
|
+
|
|
|
pwm_set_duty(timer_initstruct, pwm_channel, cfg->pulse);
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
case PWM_CMD_GET:
|
|
@@ -181,25 +181,25 @@ int rt_hw_pwm_init(void)
|
|
|
|
|
|
/* gpio initialization */
|
|
|
|
|
|
-#if defined(ES_AD16C4T0_CH1_GPIO_FUNC)&&defined(ES_AD16C4T0_CH1_GPIO_PORT)&&defined(ES_AD16C4T0_CH1_GPIO_PIN)
|
|
|
+#if defined(ES_AD16C4T0_CH1_GPIO_FUNC)&&defined(ES_AD16C4T0_CH1_GPIO_PORT)&&defined(ES_AD16C4T0_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T0_CH1_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_AD16C4T0_CH1_GPIO_PORT, ES_AD16C4T0_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_AD16C4T0_CH2_GPIO_FUNC)&&defined(ES_AD16C4T0_CH2_GPIO_PORT)&&defined(ES_AD16C4T0_CH2_GPIO_PIN)
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_AD16C4T0_CH2_GPIO_FUNC)&&defined(ES_AD16C4T0_CH2_GPIO_PORT)&&defined(ES_AD16C4T0_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T0_CH2_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_AD16C4T0_CH2_GPIO_PORT, ES_AD16C4T0_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_AD16C4T0_CH3_GPIO_FUNC)&&defined(ES_AD16C4T0_CH3_GPIO_PORT)&&defined(ES_AD16C4T0_CH3_GPIO_FUNC)
|
|
|
+#if defined(ES_AD16C4T0_CH3_GPIO_FUNC)&&defined(ES_AD16C4T0_CH3_GPIO_PORT)&&defined(ES_AD16C4T0_CH3_GPIO_FUNC)
|
|
|
gpio_initstructure.func = ES_AD16C4T0_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_AD16C4T0_CH3_GPIO_PORT, ES_AD16C4T0_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_AD16C4T0_CH4_GPIO_FUNC)&&defined(ES_AD16C4T0_CH4_GPIO_PORT)&&defined(ES_AD16C4T0_CH4_GPIO_PIN)
|
|
|
+#if defined(ES_AD16C4T0_CH4_GPIO_FUNC)&&defined(ES_AD16C4T0_CH4_GPIO_PORT)&&defined(ES_AD16C4T0_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T0_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_AD16C4T0_CH4_GPIO_PORT, ES_AD16C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_AD16C4T0_CH4_GPIO_PORT, ES_AD16C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&ad16c4t0_pwm_dev, ES_DEVICE_NAME_AD16C4T0_PWM, &es32f3_pwm_ops,
|
|
|
&ad16c4t0_timer_initstruct);
|
|
@@ -213,26 +213,26 @@ int rt_hw_pwm_init(void)
|
|
|
ald_timer_pwm_init(&ad16c4t1_timer_initstruct);
|
|
|
|
|
|
/* gpio initialization */
|
|
|
-
|
|
|
-#if defined(ES_AD16C4T1_CH1_GPIO_FUNC)&&defined(ES_AD16C4T1_CH1_GPIO_PORT)&&defined(ES_AD16C4T1_CH1_GPIO_PIN)
|
|
|
+
|
|
|
+#if defined(ES_AD16C4T1_CH1_GPIO_FUNC)&&defined(ES_AD16C4T1_CH1_GPIO_PORT)&&defined(ES_AD16C4T1_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T1_CH1_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_AD16C4T1_CH1_GPIO_PORT, ES_AD16C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_AD16C4T1_CH2_GPIO_FUNC)&&defined(ES_AD16C4T1_CH2_GPIO_PORT)&&defined(ES_AD16C4T1_CH2_GPIO_PIN)
|
|
|
+ ald_gpio_init(ES_AD16C4T1_CH1_GPIO_PORT, ES_AD16C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_AD16C4T1_CH2_GPIO_FUNC)&&defined(ES_AD16C4T1_CH2_GPIO_PORT)&&defined(ES_AD16C4T1_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T1_CH2_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_AD16C4T1_CH2_GPIO_PORT, ES_AD16C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_AD16C4T1_CH2_GPIO_PORT, ES_AD16C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_AD16C4T1_CH3_GPIO_FUNC)&&defined(ES_AD16C4T1_CH3_GPIO_PORT)&&defined(ES_AD16C4T1_CH3_GPIO_PIN)
|
|
|
+#if defined(ES_AD16C4T1_CH3_GPIO_FUNC)&&defined(ES_AD16C4T1_CH3_GPIO_PORT)&&defined(ES_AD16C4T1_CH3_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T1_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_AD16C4T1_CH3_GPIO_PORT, ES_AD16C4T1_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
#if defined(ES_AD16C4T1_CH4_GPIO_FUNC)&&defined(ES_AD16C4T1_CH4_GPIO_PORT)&&defined(ES_AD16C4T1_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_AD16C4T1_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_AD16C4T1_CH4_GPIO_PORT, ES_AD16C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_AD16C4T1_CH4_GPIO_PORT, ES_AD16C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&ad16c4t1_pwm_dev, ES_DEVICE_NAME_AD16C4T1_PWM, &es32f3_pwm_ops,
|
|
|
&ad16c4t1_timer_initstruct);
|
|
@@ -247,26 +247,26 @@ int rt_hw_pwm_init(void)
|
|
|
ald_timer_pwm_init(&gp32c4t0_timer_initstruct);
|
|
|
|
|
|
/* gpio initialization */
|
|
|
-
|
|
|
-#if defined(ES_GP32C4T0_CH1_GPIO_FUNC)&&defined(ES_GP32C4T0_CH1_GPIO_PORT)&&defined(ES_GP32C4T0_CH1_GPIO_PIN)
|
|
|
+
|
|
|
+#if defined(ES_GP32C4T0_CH1_GPIO_FUNC)&&defined(ES_GP32C4T0_CH1_GPIO_PORT)&&defined(ES_GP32C4T0_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T0_CH1_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T0_CH1_GPIO_PORT, ES_GP32C4T0_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_GP32C4T0_CH2_GPIO_FUNC)&&defined(ES_GP32C4T0_CH2_GPIO_PORT)&&defined(ES_GP32C4T0_CH2_GPIO_PIN)
|
|
|
+ ald_gpio_init(ES_GP32C4T0_CH1_GPIO_PORT, ES_GP32C4T0_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_GP32C4T0_CH2_GPIO_FUNC)&&defined(ES_GP32C4T0_CH2_GPIO_PORT)&&defined(ES_GP32C4T0_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T0_CH2_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T0_CH2_GPIO_PORT, ES_GP32C4T0_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP32C4T0_CH2_GPIO_PORT, ES_GP32C4T0_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_GP32C4T0_CH3_GPIO_FUNC)&&defined(ES_GP32C4T0_CH3_GPIO_PORT)&&defined(ES_GP32C4T0_CH3_GPIO_PIN)
|
|
|
+#if defined(ES_GP32C4T0_CH3_GPIO_FUNC)&&defined(ES_GP32C4T0_CH3_GPIO_PORT)&&defined(ES_GP32C4T0_CH3_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T0_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_GP32C4T0_CH3_GPIO_PORT, ES_GP32C4T0_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
#if defined(ES_GP32C4T0_CH4_GPIO_FUNC)&&defined(ES_GP32C4T0_CH4_GPIO_PORT)&&defined(ES_GP32C4T0_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T0_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T0_CH4_GPIO_PORT, ES_GP32C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP32C4T0_CH4_GPIO_PORT, ES_GP32C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&gp32c4t0_pwm_dev, ES_DEVICE_NAME_AD16C4T1_PWM, &es32f3_pwm_ops,
|
|
|
&gp32c4t0_timer_initstruct);
|
|
@@ -281,26 +281,26 @@ int rt_hw_pwm_init(void)
|
|
|
ald_timer_pwm_init(&gp32c4t1_timer_initstruct);
|
|
|
|
|
|
/* gpio initialization */
|
|
|
-
|
|
|
-#if defined(ES_GP32C4T1_CH1_GPIO_FUNC)&&defined(ES_GP32C4T1_CH1_GPIO_PORT)&&defined(ES_GP32C4T1_CH1_GPIO_PIN)
|
|
|
+
|
|
|
+#if defined(ES_GP32C4T1_CH1_GPIO_FUNC)&&defined(ES_GP32C4T1_CH1_GPIO_PORT)&&defined(ES_GP32C4T1_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T1_CH1_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T1_CH1_GPIO_PORT, ES_GP32C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_GP32C4T1_CH2_GPIO_FUNC)&&defined(ES_GP32C4T1_CH2_GPIO_PORT)&&defined(ES_GP32C4T1_CH2_GPIO_PIN)
|
|
|
+ ald_gpio_init(ES_GP32C4T1_CH1_GPIO_PORT, ES_GP32C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_GP32C4T1_CH2_GPIO_FUNC)&&defined(ES_GP32C4T1_CH2_GPIO_PORT)&&defined(ES_GP32C4T1_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T1_CH2_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T1_CH2_GPIO_PORT, ES_GP32C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP32C4T1_CH2_GPIO_PORT, ES_GP32C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_GP32C4T1_CH3_GPIO_FUNC)&&defined(ES_GP32C4T1_CH3_GPIO_PORT)&&defined(ES_GP32C4T1_CH3_GPIO_PIN)
|
|
|
+#if defined(ES_GP32C4T1_CH3_GPIO_FUNC)&&defined(ES_GP32C4T1_CH3_GPIO_PORT)&&defined(ES_GP32C4T1_CH3_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T1_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_GP32C4T1_CH3_GPIO_PORT, ES_GP32C4T1_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
#if defined(ES_GP32C4T1_CH4_GPIO_FUNC)&&defined(ES_GP32C4T1_CH4_GPIO_PORT)&&defined(ES_GP32C4T1_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP32C4T1_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP32C4T1_CH4_GPIO_PORT, ES_GP32C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP32C4T1_CH4_GPIO_PORT, ES_GP32C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&gp32c4t1_pwm_dev, ES_DEVICE_NAME_GP32C4T1_PWM, &es32f3_pwm_ops,
|
|
|
&gp32c4t1_timer_initstruct);
|
|
@@ -315,26 +315,26 @@ int rt_hw_pwm_init(void)
|
|
|
ald_timer_pwm_init(&gp16c4t0_timer_initstruct);
|
|
|
|
|
|
/* gpio initialization */
|
|
|
-
|
|
|
-#if defined(ES_GP16C4T0_CH1_GPIO_FUNC)&&defined(ES_GP16C4T0_CH1_GPIO_PORT)&&defined(ES_GP16C4T0_CH1_GPIO_PIN)
|
|
|
+
|
|
|
+#if defined(ES_GP16C4T0_CH1_GPIO_FUNC)&&defined(ES_GP16C4T0_CH1_GPIO_PORT)&&defined(ES_GP16C4T0_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T0_CH1_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T0_CH1_GPIO_PORT, ES_GP16C4T0_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_GP16C4T0_CH2_GPIO_FUNC)&&defined(ES_GP16C4T0_CH2_GPIO_PORT)&&defined(ES_GP16C4T0_CH2_GPIO_PIN)
|
|
|
+ ald_gpio_init(ES_GP16C4T0_CH1_GPIO_PORT, ES_GP16C4T0_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_GP16C4T0_CH2_GPIO_FUNC)&&defined(ES_GP16C4T0_CH2_GPIO_PORT)&&defined(ES_GP16C4T0_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T0_CH2_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T0_CH2_GPIO_PORT, ES_GP16C4T0_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP16C4T0_CH2_GPIO_PORT, ES_GP16C4T0_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_GP16C4T0_CH3_GPIO_FUNC)&&defined(ES_GP16C4T0_CH3_GPIO_PORT)&&defined(ES_GP16C4T0_CH3_GPIO_PIN)
|
|
|
+#if defined(ES_GP16C4T0_CH3_GPIO_FUNC)&&defined(ES_GP16C4T0_CH3_GPIO_PORT)&&defined(ES_GP16C4T0_CH3_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T0_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_GP16C4T0_CH3_GPIO_PORT, ES_GP16C4T0_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
#if defined(ES_GP16C4T0_CH4_GPIO_FUNC)&&defined(ES_GP16C4T0_CH4_GPIO_PORT)&&defined(ES_GP16C4T0_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T0_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T0_CH4_GPIO_PORT, ES_GP16C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP16C4T0_CH4_GPIO_PORT, ES_GP16C4T0_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&gp16c4t0_pwm_dev, ES_DEVICE_NAME_GP16C4T0_PWM, &es32f3_pwm_ops,
|
|
|
&gp16c4t0_timer_initstruct);
|
|
@@ -349,26 +349,26 @@ int rt_hw_pwm_init(void)
|
|
|
ald_timer_pwm_init(&gp16c4t1_timer_initstruct);
|
|
|
|
|
|
/* gpio initialization */
|
|
|
-
|
|
|
-#if defined(ES_GP16C4T1_CH1_GPIO_FUNC)&&defined(ES_GP16C4T1_CH1_GPIO_PORT)&&defined(ES_GP16C4T1_CH1_GPIO_PIN)
|
|
|
+
|
|
|
+#if defined(ES_GP16C4T1_CH1_GPIO_FUNC)&&defined(ES_GP16C4T1_CH1_GPIO_PORT)&&defined(ES_GP16C4T1_CH1_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T1_CH1_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T1_CH1_GPIO_PORT, ES_GP16C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
-
|
|
|
-#if defined(ES_GP16C4T1_CH2_GPIO_FUNC)&&defined(ES_GP16C4T1_CH2_GPIO_PORT)&&defined(ES_GP16C4T1_CH2_GPIO_PIN)
|
|
|
+ ald_gpio_init(ES_GP16C4T1_CH1_GPIO_PORT, ES_GP16C4T1_CH1_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
+
|
|
|
+#if defined(ES_GP16C4T1_CH2_GPIO_FUNC)&&defined(ES_GP16C4T1_CH2_GPIO_PORT)&&defined(ES_GP16C4T1_CH2_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T1_CH2_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T1_CH2_GPIO_PORT, ES_GP16C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP16C4T1_CH2_GPIO_PORT, ES_GP16C4T1_CH2_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
-#if defined(ES_GP16C4T1_CH3_GPIO_FUNC)&&defined(ES_GP16C4T1_CH3_GPIO_PORT)&&defined(ES_GP16C4T1_CH3_GPIO_PIN)
|
|
|
+#if defined(ES_GP16C4T1_CH3_GPIO_FUNC)&&defined(ES_GP16C4T1_CH3_GPIO_PORT)&&defined(ES_GP16C4T1_CH3_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T1_CH3_GPIO_FUNC;
|
|
|
ald_gpio_init(ES_GP16C4T1_CH3_GPIO_PORT, ES_GP16C4T1_CH3_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+#endif
|
|
|
|
|
|
#if defined(ES_GP16C4T1_CH4_GPIO_FUNC)&&defined(ES_GP16C4T1_CH4_GPIO_PORT)&&defined(ES_GP16C4T1_CH4_GPIO_PIN)
|
|
|
gpio_initstructure.func = ES_GP16C4T1_CH4_GPIO_FUNC;
|
|
|
- ald_gpio_init(ES_GP16C4T1_CH4_GPIO_PORT, ES_GP16C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
-#endif
|
|
|
+ ald_gpio_init(ES_GP16C4T1_CH4_GPIO_PORT, ES_GP16C4T1_CH4_GPIO_PIN, &gpio_initstructure);
|
|
|
+#endif
|
|
|
|
|
|
ret = rt_device_pwm_register(&gp16c4t1_pwm_dev, ES_DEVICE_NAME_GP16C4T1_PWM, &es32f3_pwm_ops,
|
|
|
&gp16c4t1_timer_initstruct);
|