diff options
-rw-r--r-- | firmware/export/config/erosqnative.h | 1 | ||||
-rw-r--r-- | firmware/export/config/fiiom3k.h | 1 | ||||
-rw-r--r-- | firmware/export/config/shanlingq1.h | 1 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 6 |
4 files changed, 9 insertions, 0 deletions
diff --git a/firmware/export/config/erosqnative.h b/firmware/export/config/erosqnative.h index e0a668d82d..e326f29b98 100644 --- a/firmware/export/config/erosqnative.h +++ b/firmware/export/config/erosqnative.h | |||
@@ -114,6 +114,7 @@ | |||
114 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) | 114 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) |
115 | #define HAVE_USB_POWER | 115 | #define HAVE_USB_POWER |
116 | #define HAVE_USB_CHARGING_ENABLE | 116 | #define HAVE_USB_CHARGING_ENABLE |
117 | #define HAVE_USB_CHARGING_IN_THREAD | ||
117 | #define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE | 118 | #define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE |
118 | #define HAVE_BOOTLOADER_USB_MODE | 119 | #define HAVE_BOOTLOADER_USB_MODE |
119 | #endif | 120 | #endif |
diff --git a/firmware/export/config/fiiom3k.h b/firmware/export/config/fiiom3k.h index dc56f0a5cc..5a2fa6c025 100644 --- a/firmware/export/config/fiiom3k.h +++ b/firmware/export/config/fiiom3k.h | |||
@@ -114,6 +114,7 @@ | |||
114 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) | 114 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) |
115 | #define HAVE_USB_POWER | 115 | #define HAVE_USB_POWER |
116 | #define HAVE_USB_CHARGING_ENABLE | 116 | #define HAVE_USB_CHARGING_ENABLE |
117 | #define HAVE_USB_CHARGING_IN_THREAD | ||
117 | #define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE | 118 | #define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE |
118 | #define HAVE_BOOTLOADER_USB_MODE | 119 | #define HAVE_BOOTLOADER_USB_MODE |
119 | #endif | 120 | #endif |
diff --git a/firmware/export/config/shanlingq1.h b/firmware/export/config/shanlingq1.h index 88175b9160..1122b7693c 100644 --- a/firmware/export/config/shanlingq1.h +++ b/firmware/export/config/shanlingq1.h | |||
@@ -104,6 +104,7 @@ | |||
104 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) | 104 | #define USB_DEVBSS_ATTR __attribute__((aligned(32))) |
105 | #define HAVE_USB_POWER | 105 | #define HAVE_USB_POWER |
106 | #define HAVE_USB_CHARGING_ENABLE | 106 | #define HAVE_USB_CHARGING_ENABLE |
107 | #define HAVE_USB_CHARGING_IN_THREAD | ||
107 | #define HAVE_BOOTLOADER_USB_MODE | 108 | #define HAVE_BOOTLOADER_USB_MODE |
108 | #endif | 109 | #endif |
109 | 110 | ||
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index bf73c58abc..65bf7293c8 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -928,8 +928,14 @@ void usb_core_bus_reset(void) | |||
928 | usb_address = 0; | 928 | usb_address = 0; |
929 | usb_state = DEFAULT; | 929 | usb_state = DEFAULT; |
930 | #ifdef HAVE_USB_CHARGING_ENABLE | 930 | #ifdef HAVE_USB_CHARGING_ENABLE |
931 | #ifdef HAVE_USB_CHARGING_IN_THREAD | ||
932 | /* On some targets usb_charging_maxcurrent_change() cannot be called | ||
933 | * from an interrupt handler; get the USB thread to do it instead. */ | ||
934 | usb_charger_update(); | ||
935 | #else | ||
931 | usb_charging_maxcurrent_change(usb_charging_maxcurrent()); | 936 | usb_charging_maxcurrent_change(usb_charging_maxcurrent()); |
932 | #endif | 937 | #endif |
938 | #endif | ||
933 | } | 939 | } |
934 | 940 | ||
935 | /* called by usb_drv_transfer_completed() */ | 941 | /* called by usb_drv_transfer_completed() */ |