Skip to content

Commit 31fe708

Browse files
nzmichaelhkartben
authored andcommitted
modules: hal_wch: update the HAL to pull in CH32V00x support
Now that the HAL has been commited, pick it and fix the related build errors. Signed-off-by: Michael Hope <[email protected]>
1 parent 964aa56 commit 31fe708

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

drivers/pwm/pwm_wch_gptm.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@
2727
/* Each of the 4 channels uses 1 nibble of CCER */
2828
#define CCER_MASK (TIM_CC1P | TIM_CC1E)
2929

30+
#ifdef TIM2_CTLR1_CEN
31+
/* ch32fun.h uses a different set of names for the CH32V00x series. Remap. */
32+
typedef GPTM_TypeDef TIM_TypeDef;
33+
#define TIM_CEN TIM2_CTLR1_CEN
34+
#define TIM_OC1M TIM2_CHCTLR1_OC1M
35+
#define TIM_OC2M TIM2_CHCTLR1_OC2M
36+
#define TIM_OC3M TIM2_CHCTLR2_OC3M
37+
#define TIM_OC4M TIM2_CHCTLR2_OC4M
38+
#define TIM_CC1P TIM2_CCER_CC1P
39+
#define TIM_CC1E TIM2_CCER_CC1E
40+
#define TIM_CC1E TIM2_CCER_CC1E
41+
#define TIM_ARPE TIM2_CTLR1_ARPE
42+
#endif
43+
3044
struct pwm_wch_gptm_config {
3145
TIM_TypeDef *regs;
3246
const struct device *clock_dev;

modules/hal_wch/hal_ch32fun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#endif
1414

1515
#if defined(CONFIG_SOC_SERIES_CH32V00X)
16-
#define CH32V003 1
16+
#define CH32V00x 1
1717
#include <ch32fun.h>
1818
#endif
1919

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ manifest:
265265
groups:
266266
- hal
267267
- name: hal_wch
268-
revision: 941f5182b5577d168e0cbcc0c9dd26294c1806a5
268+
revision: 6dd313768b5f4cc69baeac4ce6e59f2038eb8ce5
269269
path: modules/hal/wch
270270
groups:
271271
- hal

0 commit comments

Comments
 (0)