From 159f5265f56ca122540001048e55c87e687e24a2 Mon Sep 17 00:00:00 2001
From: Mark Frost <mark.frost@gmail.com>
Date: Fri, 14 Jul 2023 11:53:58 -0500
Subject: [PATCH] #error if someone sets both USE_HSI and USE_HSE

---
 ch32v003fun/ch32v003fun.h    | 3 +++
 examples/MCOtest/funconfig.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/ch32v003fun/ch32v003fun.h b/ch32v003fun/ch32v003fun.h
index c8b7f99..ce2c4bf 100644
--- a/ch32v003fun/ch32v003fun.h
+++ b/ch32v003fun/ch32v003fun.h
@@ -34,6 +34,9 @@
 	#define FUNCONF_DEBUGPRINTF_TIMEOUT 160000
 #endif
 
+#if defined(FUNCONF_USE_HSI) && defined(FUNCONF_USE_HSE) && FUNCONF_USE_HSI && FUNCONF_USE_HSE
+       #error FUNCONF_USE_HSI and FUNCONF_USE_HSE cannot both be set
+#endif
 
 #if !defined( FUNCONF_USE_HSI ) && !defined( FUNCONF_USE_HSE )
 	#define FUNCONF_USE_HSI 1 // Default to use HSI
diff --git a/examples/MCOtest/funconfig.h b/examples/MCOtest/funconfig.h
index 16f4a82..2711774 100644
--- a/examples/MCOtest/funconfig.h
+++ b/examples/MCOtest/funconfig.h
@@ -4,5 +4,8 @@
 #define FUNCONF_TINYVECTOR 1
 #define CH32V003           1
 
+#define FUNCONF_USE_HSE 1
+#define FUNCONF_USE_HSI 1
+
 #endif
 
-- 
GitLab