Browse Source

Merge pull request #382 from stawiski/teensy3-usb-delay-defines

Added the ability to parametrize Teensy 3 core USB init delays
teensy4-core
Paul Stoffregen 5 years ago
parent
commit
67bc96922c
No account linked to committer's email address
1 changed files with 20 additions and 8 deletions
  1. +20
    -8
      teensy3/pins_teensy.c

+ 20
- 8
teensy3/pins_teensy.c View File

@@ -583,18 +583,30 @@ void _init_Teensyduino_internal_(void)
TPM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0);
#endif
analog_init();

#if !defined(TEENSY_INIT_USB_DELAY_BEFORE)
#if TEENSYDUINO >= 142
#define TEENSY_INIT_USB_DELAY_BEFORE 25
#else
#define TEENSY_INIT_USB_DELAY_BEFORE 50
#endif
#endif

#if !defined(TEENSY_INIT_USB_DELAY_AFTER)
#if TEENSYDUINO >= 142
#define TEENSY_INIT_USB_DELAY_AFTER 275
#else
#define TEENSY_INIT_USB_DELAY_AFTER 350
#endif
#endif

// for background about this startup delay, please see these conversations
// https://forum.pjrc.com/threads/36606-startup-time-(400ms)?p=113980&viewfull=1#post113980
// https://forum.pjrc.com/threads/31290-Teensey-3-2-Teensey-Loader-1-24-Issues?p=87273&viewfull=1#post87273
#if TEENSYDUINO >= 142
delay(25);
usb_init();
delay(275);
#else
delay(50);

delay(TEENSY_INIT_USB_DELAY_BEFORE);
usb_init();
delay(350);
#endif
delay(TEENSY_INIT_USB_DELAY_AFTER);
}



Loading…
Cancel
Save