From f62966456d620f6e135cd019a2d263c34027f119 Mon Sep 17 00:00:00 2001 From: Venelin Efremov <ghent360@iqury.us> Date: Sun, 7 May 2023 23:07:13 -0700 Subject: [PATCH] Allow expressions to be passed to Delay_Ms and Delay_Us. --- ch32v003fun/ch32v003fun.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h index 4b33a1b..f75a27e 100644 --- a/ch32v003fun/ch32v003fun.h +++ b/ch32v003fun/ch32v003fun.h @@ -4838,8 +4838,8 @@ void DefaultIRQHandler( void ) __attribute__((section(".text.vector_handler"))) void DelaySysTick( uint32_t n ); -#define Delay_Us(n) DelaySysTick( n * DELAY_US_TIME ) -#define Delay_Ms(n) DelaySysTick( n * DELAY_MS_TIME ) +#define Delay_Us(n) DelaySysTick( (n) * DELAY_US_TIME ) +#define Delay_Ms(n) DelaySysTick( (n) * DELAY_MS_TIME ) // Tricky: We need to make sure main and SystemInit() are preserved. int main() __attribute__((used)); -- GitLab