Skip to content

Commit cb066ff

Browse files
committed
Change SendReport & sendDate "id" values from 16 to 8bits
The underlying HID_::sendReport method is anyhow only transmitting the first byte of the "id" field, so the content of the second byte is currently ignored. One can then just as well change the "id" argument type from 16 to 8bits. Update the HIDPowerDevice_::sendDate the same way, since it's just passing on the "id" argument to HID_::sendReport.
1 parent 6f6442f commit cb066ff

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/HID/HID.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ bool HID_::LockFeature(uint16_t id, bool lock) {
166166
}
167167

168168

169-
int HID_::SendReport(uint16_t id, const void* data, int len)
169+
int HID_::SendReport(uint8_t id, const void* data, int len)
170170
{
171171
auto ret = USB_Send(HID_TX, &id, 1);
172172
if (ret < 0) return ret;

src/HID/HID.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class HID_ : public PluggableUSBModule
115115
public:
116116
HID_(void);
117117
int begin(void);
118-
int SendReport(uint16_t id, const void* data, int len);
118+
int SendReport(uint8_t id, const void* data, int len);
119119
int SetFeature(uint16_t id, const void* data, int len);
120120
bool LockFeature(uint16_t id, bool lock);
121121

src/HIDPowerDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ void HIDPowerDevice_::setSerial(const char* s) {
249249
void HIDPowerDevice_::end(void) {
250250
}
251251

252-
int HIDPowerDevice_::sendDate(uint16_t id, uint16_t year, uint8_t month, uint8_t day) {
252+
int HIDPowerDevice_::sendDate(uint8_t id, uint16_t year, uint8_t month, uint8_t day) {
253253
uint16_t bval = (year - 1980)*512 + month * 32 + day;
254254
return HID().SendReport(id, &bval, sizeof (bval));
255255
}
256256

257-
int HIDPowerDevice_::sendReport(uint16_t id, const void* bval, int len) {
257+
int HIDPowerDevice_::sendReport(uint8_t id, const void* bval, int len) {
258258
return HID().SendReport(id, bval, len);
259259
}
260260

src/HIDPowerDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ class HIDPowerDevice_ {
121121

122122
void end(void);
123123

124-
int sendDate(uint16_t id, uint16_t year, uint8_t month, uint8_t day);
125-
int sendReport(uint16_t id, const void* bval, int len);
124+
int sendDate(uint8_t id, uint16_t year, uint8_t month, uint8_t day);
125+
int sendReport(uint8_t id, const void* bval, int len);
126126

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

0 commit comments

Comments
 (0)