Merge pull request #3306 from kamtom480/usb_fix

spresense: call usb_background function
This commit is contained in:
Scott Shawcroft 2020-08-20 11:23:16 -07:00 committed by GitHub
commit e47447ba59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,8 @@
#include "boards/board.h" #include "boards/board.h"
#include "supervisor/port.h" #include "supervisor/port.h"
#include "supervisor/background_callback.h"
#include "supervisor/usb.h"
#include "supervisor/shared/tick.h" #include "supervisor/shared/tick.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
@ -114,6 +116,11 @@ uint32_t port_get_saved_word(void) {
return _ebss; return _ebss;
} }
static background_callback_t callback;
static void usb_background_do(void* unused) {
usb_background();
}
volatile bool _tick_enabled; volatile bool _tick_enabled;
void board_timerhook(void) void board_timerhook(void)
{ {
@ -121,6 +128,8 @@ void board_timerhook(void)
if (_tick_enabled) { if (_tick_enabled) {
supervisor_tick(); supervisor_tick();
} }
background_callback_add(&callback, usb_background_do, NULL);
} }
uint64_t port_get_raw_ticks(uint8_t* subticks) { uint64_t port_get_raw_ticks(uint8_t* subticks) {