Skip to content

Remove begin/end methods to simplify the implementation #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/UPS/UPS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ int iRes=0;
void setup() {

Serial.begin(57600);

PowerDevice.begin();

// Serial No is set in a special way as it forms Arduino port name
PowerDevice.setSerial(STRING_SERIAL);
Expand Down
5 changes: 0 additions & 5 deletions src/HID/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,4 @@ HID_::HID_(void) : PluggableUSBModule(2, 1, epType),
PluggableUSB().plug(this);
}

int HID_::begin(void)
{
return 0;
}

#endif /* if defined(USBCON) */
1 change: 0 additions & 1 deletion src/HID/HID.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class HID_ : public PluggableUSBModule
{
public:
HID_(void);
int begin(void);
int SendReport(uint16_t id, const void* data, int len);
int SetFeature(uint16_t id, const void* data, int len);
bool LockFeature(uint16_t id, bool lock);
Expand Down
9 changes: 0 additions & 9 deletions src/HIDPowerDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,11 @@ HIDPowerDevice_::HIDPowerDevice_(void) {
static HIDSubDescriptor node(_hidReportDescriptor, sizeof (_hidReportDescriptor));

HID().AppendDescriptor(&node);
}

void HIDPowerDevice_::begin(void) {
HID().begin();

// set string ID here

HID().SetFeature(HID_PD_IPRODUCT, &bProduct, sizeof(bProduct));
HID().SetFeature(HID_PD_SERIAL, &bSerial, sizeof(bSerial));
HID().SetFeature(HID_PD_MANUFACTURER, &bManufacturer, sizeof(bManufacturer));

}

void HIDPowerDevice_::setOutput(Serial_& out) {
Expand All @@ -246,9 +240,6 @@ void HIDPowerDevice_::setSerial(const char* s) {
HID().setSerial(s);
}

void HIDPowerDevice_::end(void) {
}

int HIDPowerDevice_::sendDate(uint16_t id, uint16_t year, uint8_t month, uint8_t day) {
uint16_t bval = (year - 1980)*512 + month * 32 + day;
return HID().SendReport(id, &bval, sizeof (bval));
Expand Down
4 changes: 0 additions & 4 deletions src/HIDPowerDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,11 @@ class HIDPowerDevice_ {

public:
HIDPowerDevice_(void);
void begin(void);

void setOutput(Serial_&);

void setSerial(const char*);


void end(void);

int sendDate(uint16_t id, uint16_t year, uint8_t month, uint8_t day);
int sendReport(uint16_t id, const void* bval, int len);

Expand Down