Skip to content

Change SendReport & sendDate "id" values from 16 to 8bits #40

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 1 commit 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: 1 addition & 1 deletion src/HID/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool HID_::LockFeature(uint16_t id, bool lock) {
}


int HID_::SendReport(uint16_t id, const void* data, int len)
int HID_::SendReport(uint8_t id, const void* data, int len)
{
auto ret = USB_Send(HID_TX, &id, 1);
if (ret < 0) return ret;
Expand Down
2 changes: 1 addition & 1 deletion src/HID/HID.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class HID_ : public PluggableUSBModule
public:
HID_(void);
int begin(void);
int SendReport(uint16_t id, const void* data, int len);
int SendReport(uint8_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
4 changes: 2 additions & 2 deletions src/HIDPowerDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ void HIDPowerDevice_::setSerial(const char* s) {
void HIDPowerDevice_::end(void) {
}

int HIDPowerDevice_::sendDate(uint16_t id, uint16_t year, uint8_t month, uint8_t day) {
int HIDPowerDevice_::sendDate(uint8_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));
}

int HIDPowerDevice_::sendReport(uint16_t id, const void* bval, int len) {
int HIDPowerDevice_::sendReport(uint8_t id, const void* bval, int len) {
return HID().SendReport(id, bval, len);
}

Expand Down
4 changes: 2 additions & 2 deletions src/HIDPowerDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class HIDPowerDevice_ {

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);
int sendDate(uint8_t id, uint16_t year, uint8_t month, uint8_t day);
int sendReport(uint8_t id, const void* bval, int len);

int setFeature(uint16_t id, const void* data, int len);

Expand Down