Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 043f3de

Browse files
committed
Made USP-API included flexible
1 parent 60e64cf commit 043f3de

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

‎hardware/arduino/avr/cores/arduino/USBAPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class USBDevice_
6767
bool wakeupHost(); // returns false, when wakeup cannot be processed
6868
};
6969
extern USBDevice_ USBDevice;
70+
void setupUSB();
7071

7172
//================================================================================
7273
//================================================================================

‎hardware/arduino/avr/cores/arduino/USBCore.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,4 +828,8 @@ bool USBDevice_::wakeupHost()
828828
return false;
829829
}
830830

831+
void setupUSB() {
832+
USBDevice.attach();
833+
}
834+
831835
#endif /* if defined(USBCON) */

‎hardware/arduino/avr/cores/arduino/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ void initVariant() __attribute__((weak));
2828
void initVariant() { }
2929

3030
void setupUSB() __attribute__((weak));
31-
void setupUSB() { }
31+
void setupUSB() {
32+
#if defined(USBCON) && (MAGIC_KEY_POS != (RAMEND-1))
33+
USBDevice.attach();
34+
#endif
35+
}
3236

3337
int main(void)
3438
{
@@ -37,7 +41,7 @@ int main(void)
3741
initVariant();
3842

3943
#if defined(USBCON)
40-
USBDevice.attach();
44+
setupUSB();
4145
#endif
4246

4347
setup();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /