From 9d7ee13b9cfaa73cd2023e2bdc722e23a2d37e6e Mon Sep 17 00:00:00 2001
From: cnlohr <lohr85@gmail.com>
Date: Wed, 24 Apr 2024 03:03:57 -0400
Subject: [PATCH] Update app

---
 examples_x035/usbdevice/funconfig.h              |  1 +
 examples_x035/usbdevice/testtop.hidapi/testtop.c |  2 +-
 examples_x035/usbdevice/usb_config.h             | 16 +++++++++-------
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/examples_x035/usbdevice/funconfig.h b/examples_x035/usbdevice/funconfig.h
index a8a70b3..a4f64d2 100644
--- a/examples_x035/usbdevice/funconfig.h
+++ b/examples_x035/usbdevice/funconfig.h
@@ -4,6 +4,7 @@
 // Though this should be on by default we can extra force it on.
 #define FUNCONF_USE_DEBUGPRINTF 1
 #define FUNCONF_DEBUGPRINTF_TIMEOUT (1<<31) // Wait for a very very long time.
+#define FUNCONF_5V_OPERATION 1
 
 #endif
 
diff --git a/examples_x035/usbdevice/testtop.hidapi/testtop.c b/examples_x035/usbdevice/testtop.hidapi/testtop.c
index a7a4b68..ea2a11c 100644
--- a/examples_x035/usbdevice/testtop.hidapi/testtop.c
+++ b/examples_x035/usbdevice/testtop.hidapi/testtop.c
@@ -12,7 +12,7 @@
 
 int main()
 {
-	hid_device * hd = hid_open( 0x1206, 0xd035, L"CUSTOMDEVICE000"); // third parameter is "serial"
+	hid_device * hd = hid_open( 0x1209, 0xd035, L"CUSTOMDEVICE000"); // third parameter is "serial"
 	if( !hd )
 	{
 		fprintf( stderr, "Error: Failed to open device.\n" );
diff --git a/examples_x035/usbdevice/usb_config.h b/examples_x035/usbdevice/usb_config.h
index 1f763ae..357d429 100644
--- a/examples_x035/usbdevice/usb_config.h
+++ b/examples_x035/usbdevice/usb_config.h
@@ -1,14 +1,17 @@
 #ifndef _USB_CONFIG_H
 #define _USB_CONFIG_H
 
-#define FUSB_5V_OPERATION 0
-#define FUSB_CONFIG_EPS   4 // Include EP0 in this count
-#define FUSB_SUPPORTS_SLEEP 0
-#define FUSB_HID_INTERFACES 2
+#include "funconfig.h"
+#include "ch32v003fun.h"
+
+#define FUSB_CONFIG_EPS       4 // Include EP0 in this count
+#define FUSB_SUPPORTS_SLEEP   0
+#define FUSB_HID_INTERFACES   2
 #define FUSB_CURSED_TURBO_DMA 0 // Hacky, but seems fine, shaves 2.5us off filling 64-byte buffers.
 #define FUSB_HID_USER_REPORTS 1
-#define FUSB_USE_HPE          1 // Use hardware stack.
 #define FUSB_IO_PROFILE       1
+#define FUSB_USE_HPE          FUNCONF_ENABLE_HPE
+#define FUSB_5V_OPERATION     FUNCONF_5V_OPERATION
 
 #include "usb_defines.h"
 
@@ -213,8 +216,7 @@ static const uint8_t config_descriptor[ ] =
     0x83,                                                   // bEndpointAddress: IN Endpoint 2
     0x03,                                                   // bmAttributes
     0x08, 0x00,                                             // wMaxPacketSize
-    0x0a,                                                   // bInterval: 1mS
-
+    0x0a,                                                   // bInterval: 10mS
 };
 
 
-- 
GitLab