From dfad5270198f10861a1e0f50d6a5cf69204a0d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A4=9A=E4=BB=95=E6=88=90?= <1468559561@qq.com> Date: Sat, 25 Feb 2023 13:51:58 +0800 Subject: [PATCH] [arduino][lpc55s69] : update PWM --- bsp/lpc55sxx/Libraries/drivers/drv_hwtimer.c | 10 +++++----- bsp/lpc55sxx/Libraries/drivers/drv_pwm.c | 6 +++--- .../applications/arduino_pinout/pins_arduino.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_hwtimer.c b/bsp/lpc55sxx/Libraries/drivers/drv_hwtimer.c index 98393fd619..a13283e0e2 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_hwtimer.c +++ b/bsp/lpc55sxx/Libraries/drivers/drv_hwtimer.c @@ -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 pre; - if(hwtimer_dev == CTIMER0) clk = CLOCK_GetFreq(kCLOCK_CTimer0); - if(hwtimer_dev == CTIMER1) clk = CLOCK_GetFreq(kCLOCK_CTimer1); - if(hwtimer_dev == CTIMER2) clk = CLOCK_GetFreq(kCLOCK_CTimer2); - if(hwtimer_dev == CTIMER3) clk = CLOCK_GetFreq(kCLOCK_CTimer3); - if(hwtimer_dev == CTIMER4) clk = CLOCK_GetFreq(kCLOCK_CTimer4); + if(hwtimer_dev == CTIMER0) clk = CLOCK_GetFreq(kCLOCK_Timer0); + if(hwtimer_dev == CTIMER1) clk = CLOCK_GetFreq(kCLOCK_Timer1); + if(hwtimer_dev == CTIMER2) clk = CLOCK_GetFreq(kCLOCK_Timer2); + if(hwtimer_dev == CTIMER3) clk = CLOCK_GetFreq(kCLOCK_Timer3); + if(hwtimer_dev == CTIMER4) clk = CLOCK_GetFreq(kCLOCK_Timer4); pre = clk / *((uint32_t *)args) - 1; diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c b/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c index 701d1349ee..4abb65b1d0 100644 --- a/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c +++ b/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c @@ -153,7 +153,7 @@ int rt_hw_pwm_init(void) #ifdef BSP_USING_CTIMER2 - static struct rt_device_pwm pwm1_device; + static struct rt_device_pwm pwm2_device; ctimer_config_t config; 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); #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) { - LOG_E("%s register failed", "pwm1"); + LOG_E("%s register failed", "pwm2"); } #endif /* BSP_USING_CTIMER2 */ diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c index 0c02e3ac29..a43917a52d 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/arduino_pinout/pins_arduino.c @@ -35,7 +35,7 @@ const pin_map_t pin_map_table[]= {D9, GET_PINS(1,5)}, {D10, GET_PINS(1,1)}, {D11, GET_PINS(0,26)}, - {D12, GET_PINS(1,3), "pwm0", 3}, /* PWM */ + {D12, GET_PINS(1,3)}, {D13, GET_PINS(1,2)}, {D14, GET_PINS(1,21), "i2c4"}, /* I2C-SDA (Wire) */ {D15, GET_PINS(1,20), "i2c4"}, /* I2C-SCL (Wire) */