File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ CFLAGS += \
261
261
-mcpu=cortex-m4 \
262
262
-mfloat-abi=hard \
263
263
-mfpu=fpv4-sp-d16 \
264
+ -ggdb \
264
265
-Os \
265
266
-ffunction-sections \
266
267
-fdata-sections \
@@ -280,8 +281,7 @@ CFLAGS += \
280
281
-Wsign-compare \
281
282
-Wmissing-format-attribute \
282
283
-Wno-endif-labels \
283
- -Wunreachable-code \
284
- -ggdb
284
+ -Wunreachable-code
285
285
286
286
# Suppress warning caused by SDK
287
287
CFLAGS += -Wno-unused-parameter -Wno-expansion-to-defined
Original file line number Diff line number Diff line change 76
76
void usb_init (bool cdc_only );
77
77
void usb_teardown (void );
78
78
79
+ // tinyusb function that handles power event (detected, ready, removed)
80
+ // We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
81
+ extern void tusb_hal_nrf_power_event (uint32_t event );
82
+
79
83
#else
80
84
81
85
#define usb_init (x ) led_state(STATE_USB_MOUNTED) // mark nrf52832 as mounted
@@ -474,13 +478,12 @@ uint32_t proc_soc(void)
474
478
pstorage_sys_event_handler (soc_evt );
475
479
476
480
#ifdef NRF_USBD
477
- extern void tusb_hal_nrf_power_event (uint32_t event );
478
481
/*------------- usb power event handler -------------*/
479
482
int32_t usbevt = (soc_evt == NRF_EVT_POWER_USB_DETECTED ) ? NRFX_POWER_USB_EVT_DETECTED :
480
483
(soc_evt == NRF_EVT_POWER_USB_POWER_READY ) ? NRFX_POWER_USB_EVT_READY :
481
484
(soc_evt == NRF_EVT_POWER_USB_REMOVED ) ? NRFX_POWER_USB_EVT_REMOVED : -1 ;
482
485
483
- if ( usbevt >= 0 ) tusb_hal_nrf_power_event (usbevt );
486
+ if ( usbevt >= 0 ) tusb_hal_nrf_power_event (( uint32_t ) usbevt );
484
487
#endif
485
488
}
486
489
Original file line number Diff line number Diff line change 42
42
* We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled. */
43
43
extern void tusb_hal_nrf_power_event (uint32_t event );
44
44
45
- //--------------------------------------------------------------------+
45
+ // power callback when SD is not enabled
46
+ static void power_event_handler (nrfx_power_usb_evt_t event )
47
+ {
48
+ tusb_hal_nrf_power_event ((uint32_t ) event );
49
+ }
50
+
46
51
// Forward USB interrupt events to TinyUSB IRQ Handler
47
- //--------------------------------------------------------------------+
48
52
void USBD_IRQHandler (void )
49
53
{
50
54
tud_int_handler (0 );
@@ -80,8 +84,8 @@ void usb_init(bool cdc_only)
80
84
const nrfx_power_config_t pwr_cfg = { 0 };
81
85
nrfx_power_init (& pwr_cfg );
82
86
83
- // Register tusb function as USB power handler
84
- const nrfx_power_usbevt_config_t config = { .handler = ( nrfx_power_usb_event_handler_t ) tusb_hal_nrf_power_event };
87
+ // Register USB power handler
88
+ const nrfx_power_usbevt_config_t config = { .handler = power_event_handler };
85
89
nrfx_power_usbevt_init (& config );
86
90
87
91
nrfx_power_usbevt_enable ();
You can’t perform that action at this time.
0 commit comments