summaryrefslogtreecommitdiff
path: root/bsp/lpc55sxx/Libraries
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2023-02-25 13:52:37 -0500
committerGitHub <[email protected]>2023-02-25 13:52:37 -0500
commit1acef4277b02e5084310ecd7028656ae535178f5 (patch)
tree03b6b6f0b3df75a1cef301e1e7b2b3d234213390 /bsp/lpc55sxx/Libraries
parent759192f5f5af23ae360818483d35974ef5b91c78 (diff)
parente63e33a3c64327aef3556fa811df0a8ec1e0e7ee (diff)
Merge pull request #6981 from RT-Thread/masterserialX-dev
sync from master
Diffstat (limited to 'bsp/lpc55sxx/Libraries')
-rw-r--r--bsp/lpc55sxx/Libraries/drivers/drv_pwm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c b/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c
index aec4fe066d..71403c328a 100644
--- a/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c
+++ b/bsp/lpc55sxx/Libraries/drivers/drv_pwm.c
@@ -68,7 +68,7 @@ static rt_err_t lpc_drv_pwm_get(struct rt_device_pwm *device, struct rt_pwm_conf
#ifdef BSP_USING_CTIMER2
/* get frequence */
- pwmClock = CLOCK_GetFreq(kCLOCK_CTimer2) ;
+ pwmClock = CLOCK_GetFreq(kCLOCK_Timer2) ;
#endif
get_frequence = pwmClock / (base->MR[kCTIMER_Match_3] + 1);
@@ -110,7 +110,7 @@ static rt_err_t lpc_drv_pwm_set(struct rt_device_pwm *device, struct rt_pwm_conf
{
/* Get the PWM period match value and pulse width match value of DEFAULT_FREQ PWM signal with DEFAULT_DUTY dutycycle */
/* Calculate PWM period match value */
- pwmPeriod = (( CLOCK_GetFreq(kCLOCK_CTimer2) / (config.prescale + 1) ) / DEFAULT_FREQ) - 1;
+ pwmPeriod = (( CLOCK_GetFreq(kCLOCK_Timer2) / (config.prescale + 1) ) / DEFAULT_FREQ) - 1;
/* Calculate pulse width match value */
if (DEFAULT_DUTY == 0)
@@ -175,7 +175,7 @@ int rt_hw_pwm_init(void)
#ifdef BSP_USING_CTIMER2_MAT1
/* Get the PWM period match value and pulse width match value of DEFAULT_FREQ PWM signal with DEFAULT_DUTY dutycycle */
/* Calculate PWM period match value */
- pwmPeriod = (( CLOCK_GetFreq(kCLOCK_CTimer2) / (config.prescale + 1) ) / DEFAULT_FREQ) - 1;
+ pwmPeriod = (( CLOCK_GetFreq(kCLOCK_Timer2) / (config.prescale + 1) ) / DEFAULT_FREQ) - 1;
/* Calculate pulse width match value */
if (DEFAULT_DUTY == 0)
@@ -186,7 +186,7 @@ int rt_hw_pwm_init(void)
{
pulsePeriod = (pwmPeriod * (100 - DEFAULT_DUTY)) / 100;
}
- CTIMER_SetupPwmPeriod(CTIMER2, kCTIMER_Match_1 , pwmPeriod, pulsePeriod, false);
+ 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);