From cf892c3862d4594fcaec7bde2a86cb653a4b4cdb Mon Sep 17 00:00:00 2001 From: Dien-Nhung Nguyen-Phu Date: Wed, 23 Jul 2025 12:29:27 +0700 Subject: [PATCH] chore: add configurable refresh rate --- Makefile | 4 ++++ src/main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a4e6916..be7b072 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ TARGET = badgemagic-ch582 # DEBUG = 1 # Uncomment below to build for USB-C version # USBC_VERSION = 1 + +LED_REFRESH_RATE = 2000 # Hz + # optimization for size OPT = -Os @@ -142,6 +145,7 @@ CFLAGS += -DUSBC_VERSION=$(USBC_VERSION) endif CFLAGS += -DVERSION='"$(VERSION)"' -DVERSION_ABBR='"$(VERSION_ABBR)"' +CFLAGS += -DLED_REFRESH_RATE='$(LED_REFRESH_RATE)' # Generate dependency information CFLAGS += -MMD -MP diff --git a/src/main.c b/src/main.c index a1127cb..e06e9f1 100644 --- a/src/main.c +++ b/src/main.c @@ -419,7 +419,7 @@ int main() usb_start(); led_init(); - TMR0_TimerInit((FREQ_SYS / 2000) / 2); + TMR0_TimerInit((FREQ_SYS / LED_REFRESH_RATE) / 2); TMR0_ITCfg(ENABLE, TMR0_3_IT_CYC_END); PFIC_EnableIRQ(TMR0_IRQn);