Skip to content

Commit 7f2f41b

Browse files
sebromerofacchinm
authored andcommitted
Add enableVbus function
1 parent 285b435 commit 7f2f41b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libraries/USBHOST/src/USBHost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
static rtos::Thread t(osPriorityHigh);
55

6+
void USBHost::supplyPowerOnVBUS(bool enable){
7+
mbed::DigitalOut otg(PJ_6, enable ? 0 : 1);
8+
}
9+
610
void USBHost::InternalTask() {
711
while (1) {
812
tusbh_msg_loop(mq);

libraries/USBHOST/src/USBHost.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class USBHost {
2626
return _hs;
2727
};
2828

29+
/**
30+
* Allows to provide power to USB devices on VBUS when powered through VIN.
31+
* @param enable A flag to indicate whether power is supplied on VBUS.
32+
*/
33+
void supplyPowerOnVBUS(bool enable);
34+
2935
private:
3036

3137
void InternalTask();

0 commit comments

Comments
 (0)