[arduino][lpc55s69] : update PWM

This commit is contained in:
褚仕成 2023-02-25 13:51:58 +08:00 committed by guo
parent f5798d9917
commit dfad527019
3 changed files with 9 additions and 9 deletions

View File

@ -59,11 +59,11 @@ static rt_err_t lpc_ctimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *a
{ {
uint32_t clk; uint32_t clk;
uint32_t pre; uint32_t pre;
if(hwtimer_dev == CTIMER0) clk = CLOCK_GetFreq(kCLOCK_CTimer0); if(hwtimer_dev == CTIMER0) clk = CLOCK_GetFreq(kCLOCK_Timer0);
if(hwtimer_dev == CTIMER1) clk = CLOCK_GetFreq(kCLOCK_CTimer1); if(hwtimer_dev == CTIMER1) clk = CLOCK_GetFreq(kCLOCK_Timer1);
if(hwtimer_dev == CTIMER2) clk = CLOCK_GetFreq(kCLOCK_CTimer2); if(hwtimer_dev == CTIMER2) clk = CLOCK_GetFreq(kCLOCK_Timer2);
if(hwtimer_dev == CTIMER3) clk = CLOCK_GetFreq(kCLOCK_CTimer3); if(hwtimer_dev == CTIMER3) clk = CLOCK_GetFreq(kCLOCK_Timer3);
if(hwtimer_dev == CTIMER4) clk = CLOCK_GetFreq(kCLOCK_CTimer4); if(hwtimer_dev == CTIMER4) clk = CLOCK_GetFreq(kCLOCK_Timer4);
pre = clk / *((uint32_t *)args) - 1; pre = clk / *((uint32_t *)args) - 1;

View File

@ -153,7 +153,7 @@ int rt_hw_pwm_init(void)
#ifdef BSP_USING_CTIMER2 #ifdef BSP_USING_CTIMER2
static struct rt_device_pwm pwm1_device; static struct rt_device_pwm pwm2_device;
ctimer_config_t config; ctimer_config_t config;
uint32_t pwmPeriod, pulsePeriod; uint32_t pwmPeriod, pulsePeriod;
@ -186,11 +186,11 @@ int rt_hw_pwm_init(void)
CTIMER_SetupPwmPeriod(CTIMER2, kCTIMER_Match_3 , kCTIMER_Match_1, pwmPeriod, pulsePeriod, false); CTIMER_SetupPwmPeriod(CTIMER2, kCTIMER_Match_3 , kCTIMER_Match_1, pwmPeriod, pulsePeriod, false);
#endif #endif
ret = rt_device_pwm_register(&pwm1_device, "pwm1", &lpc_drv_ops, CTIMER2); ret = rt_device_pwm_register(&pwm2_device, "pwm2", &lpc_drv_ops, CTIMER2);
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
LOG_E("%s register failed", "pwm1"); LOG_E("%s register failed", "pwm2");
} }
#endif /* BSP_USING_CTIMER2 */ #endif /* BSP_USING_CTIMER2 */

View File

@ -35,7 +35,7 @@ const pin_map_t pin_map_table[]=
{D9, GET_PINS(1,5)}, {D9, GET_PINS(1,5)},
{D10, GET_PINS(1,1)}, {D10, GET_PINS(1,1)},
{D11, GET_PINS(0,26)}, {D11, GET_PINS(0,26)},
{D12, GET_PINS(1,3), "pwm0", 3}, /* PWM */ {D12, GET_PINS(1,3)},
{D13, GET_PINS(1,2)}, {D13, GET_PINS(1,2)},
{D14, GET_PINS(1,21), "i2c4"}, /* I2C-SDA (Wire) */ {D14, GET_PINS(1,21), "i2c4"}, /* I2C-SDA (Wire) */
{D15, GET_PINS(1,20), "i2c4"}, /* I2C-SCL (Wire) */ {D15, GET_PINS(1,20), "i2c4"}, /* I2C-SCL (Wire) */