diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h
index f2b392a1324f6be6210b8b761efabe2b10b39b7c..1ac7e194114bf755bf7e0b7f54eb72efa933523a 100644
--- a/ch32v003fun/ch32v003fun.h
+++ b/ch32v003fun/ch32v003fun.h
@@ -321,7 +321,7 @@ typedef struct
 static inline void GPIOset(GPIO_TypeDef *gpio, uint8_t pins) {gpio->BSHR = pins;}
 static inline void GPIOreset(GPIO_TypeDef *gpio, uint8_t pins) {gpio->BCR = pins;}
 static inline void GPIOsetReset(GPIO_TypeDef *gpio, uint8_t set_pins, uint8_t reset_pins) {gpio->BSHR = set_pins|(reset_pins<<16);}
-#define DYN_GPIO_WRITE(gpio, reg, field, value) { const struct reg##_t tmp = {.##field = value ,}; gpio##->##reg = tmp;}
+#define DYN_REG_WRITE(basereg, reg, field, value) { const struct reg##_t tmp = {.##field = value ,}; basereg##->##reg = tmp;}
 
 /* Alternate Function I/O */
 typedef struct