Skip to content

Commit 00d80d2

Browse files
committed
[USBHost] Add constructor and refactor privates
1 parent 8b838f7 commit 00d80d2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Arduino_MachineControl.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,18 +527,23 @@ extern RtcControllerClass rtc_controller;
527527
*/
528528
class USBClass {
529529
public:
530+
USBClass()
531+
: _power{PB_14, 0}
532+
, _usbflag{PB_15}
533+
{};
534+
530535
/**
531536
* Enable power to USBA VBUS.
532537
*/
533538
void powerEnable() {
534-
power = 0;
539+
_power = 0;
535540
}
536541

537542
/**
538543
* Disable power to USBA VBUS.
539544
*/
540545
void powerDisable() {
541-
power = 1;
546+
_power = 1;
542547
}
543548

544549
/**
@@ -547,12 +552,12 @@ class USBClass {
547552
* @return true if OK, false if fault
548553
*/
549554
bool vflagRead() {
550-
return usbflag;
555+
return _usbflag;
551556
}
552557

553558
private:
554-
mbed::DigitalOut power = mbed::DigitalOut(PB_14);
555-
mbed::DigitalIn usbflag = mbed::DigitalIn(PB_15);
559+
mbed::DigitalOut _power;
560+
mbed::DigitalIn _usbflag;
556561
};
557562

558563

0 commit comments

Comments
 (0)