Skip to content

Commit 5d86f78

Browse files
committed
Move HIDPowerDevice_::begin impl. to constructor
Proposal to simplify the implementation by avoiding the need for manually calling begin() before using HIDPowerDevice_.
1 parent a1ab31a commit 5d86f78

File tree

3 files changed

+0
-7
lines changed

3 files changed

+0
-7
lines changed

examples/UPS/UPS.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ int iRes=0;
5151
void setup() {
5252

5353
Serial.begin(57600);
54-
55-
PowerDevice.begin();
5654

5755
// Serial No is set in a special way as it forms Arduino port name
5856
PowerDevice.setSerial(STRING_SERIAL);

src/HIDPowerDevice.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,11 @@ HIDPowerDevice_::HIDPowerDevice_(void) {
226226
static HIDSubDescriptor node(_hidReportDescriptor, sizeof (_hidReportDescriptor));
227227

228228
HID().AppendDescriptor(&node);
229-
}
230229

231-
void HIDPowerDevice_::begin(void) {
232230
// set string ID here
233-
234231
HID().SetFeature(HID_PD_IPRODUCT, &bProduct, sizeof(bProduct));
235232
HID().SetFeature(HID_PD_SERIAL, &bSerial, sizeof(bSerial));
236233
HID().SetFeature(HID_PD_MANUFACTURER, &bManufacturer, sizeof(bManufacturer));
237-
238234
}
239235

240236
void HIDPowerDevice_::setOutput(Serial_& out) {

src/HIDPowerDevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class HIDPowerDevice_ {
102102

103103
public:
104104
HIDPowerDevice_(void);
105-
void begin(void);
106105

107106
void setOutput(Serial_&);
108107

0 commit comments

Comments
 (0)