@@ -63,6 +63,16 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
63
63
0x81 ,0x23 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
64
64
0x09 ,0x66 , // USAGE (RemainingCapacity)
65
65
0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
66
+ 0x85 ,HID_PD_RELSTATEOFCHARGE, // REPORT_ID (25)
67
+ 0x09 ,0x64 , // USAGE (RelativeStateOfCharge)
68
+ 0x81 ,0x23 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
69
+ 0x09 ,0x64 , // USAGE (RelativeStateOfCharge)
70
+ 0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
71
+ 0x85 ,HID_PD_ABSSTATEOFCHARGE, // REPORT_ID (25)
72
+ 0x09 ,0x65 , // USAGE (RelativeStateOfCharge)
73
+ 0x81 ,0x23 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
74
+ 0x09 ,0x65 , // USAGE (RelativeStateOfCharge)
75
+ 0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
66
76
0x85 ,HID_PD_CPCTYGRANULARITY1,// REPORT_ID (16)
67
77
0x09 ,0x8D , // USAGE (CapacityGranularity1)
68
78
0xB1 ,0x22 , // FEATURE (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Nonvolatile, Bitfield)
@@ -85,6 +95,9 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
85
95
0x85 ,HID_PD_REMNCAPACITYLIMIT,// REPORT_ID (17)
86
96
0x09 ,0x29 , // USAGE (RemainingCapacityLimit)
87
97
0xB1 ,0xA2 , // FEATURE (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
98
+ 0x85 ,HID_PD_AVERAGECURRENT, // REPORT_ID (27)
99
+ 0x09 ,0x62 , // USAGE (AverageCurrent)
100
+ 0xB1 ,0xA2 , // FEATURE (Data, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
88
101
0x85 ,HID_PD_MANUFACTUREDATE, // REPORT_ID (9)
89
102
0x09 ,0x85 , // USAGE (ManufacturerDate)
90
103
0x75 ,0x10 , // REPORT_SIZE (16)
@@ -93,11 +106,22 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
93
106
0x85 ,HID_PD_RUNTIMETOEMPTY, // REPORT_ID (13)
94
107
0x09 ,0x68 , // USAGE (RunTimeToEmpty)
95
108
0x27 ,0xFF ,0xFF ,0x00 ,0x00 , // LOGICAL_MAXIMUM (65534)
96
- 0x66 ,0x01 ,0x10 , // UNIT (?? )
109
+ 0x66 ,0x01 ,0x10 , // UNIT (Seconds )
97
110
0x55 ,0x00 , // UNIT_EXPONENT (0)
98
111
0x81 ,0xA3 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
99
112
0x09 ,0x68 , // USAGE (RunTimeToEmpty)
100
113
0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
114
+ 0x85 ,HID_PD_AVERAGETIME2FULL, // REPORT_ID (26)
115
+ 0x09 ,0x6A , // USAGE (AverageTimeToFull)
116
+ 0x81 ,0xA3 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
117
+ 0x09 ,0x6A , // USAGE (AverageTimeToFull)
118
+ 0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
119
+ 0x05 ,0x84 , // USAGE_PAGE (Power Device)
120
+ 0x85 ,HID_PD_AVERAGETIME2EMPTY,// REPORT_ID (28)
121
+ 0x09 ,0x69 , // USAGE (AverageTimeToEmpty)
122
+ 0x81 ,0xA3 , // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
123
+ 0x09 ,0x69 , // USAGE (AverageTimeToEmpty)
124
+ 0xB1 ,0xA3 , // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
101
125
0x05 ,0x84 , // USAGE_PAGE (Power Device)
102
126
0x85 ,HID_PD_DELAYBE4SHUTDOWN, // REPORT_ID (18)
103
127
0x09 ,0x57 , // USAGE (DelayBeforeShutdown)
@@ -234,33 +258,38 @@ HIDPowerDevice_::HIDPowerDevice_(void)
234
258
235
259
void HIDPowerDevice_::begin (void )
236
260
{
261
+ HID ().begin ();
237
262
}
238
263
239
- void HIDPowerDevice_::end ( void )
264
+ void HIDPowerDevice_::setSerial (Serial_& serial )
240
265
{
266
+ HID ().setSerial (serial);
241
267
}
242
268
243
- void HIDPowerDevice_::sendDate (uint8_t id, uint16_t year, uint8_t month, uint8_t day)
269
+
270
+ void HIDPowerDevice_::end (void )
244
271
{
245
- uint16_t bval = (year - 1980 )*512 + month * 32 + day;
246
- HID ().SendReport (id, &bval, sizeof (bval));
247
272
}
248
273
249
- void HIDPowerDevice_::sendInt32 (uint8_t id, uint32_t bval )
274
+ int HIDPowerDevice_::sendDate (uint8_t id, uint16_t year, uint8_t month, uint8_t day )
250
275
{
251
- HID ().SendReport (id, &bval, sizeof (bval));
276
+ uint16_t bval = (year - 1980 )*512 + month * 32 + day;
277
+ return HID ().SendReport (id, &bval, sizeof (bval));
252
278
}
253
279
254
- void HIDPowerDevice_::sendInt16 (uint8_t id, uint16_t bval)
280
+ int HIDPowerDevice_::sendInt16 (uint8_t id, uint16_t bval)
255
281
{
256
- HID ().SendReport (id, &bval, sizeof (bval));
282
+ return HID ().SendReport (id, &bval, sizeof (bval));
257
283
}
258
284
259
- void HIDPowerDevice_::sendByte (uint8_t id, uint8_t bval)
285
+ int HIDPowerDevice_::sendByte (uint8_t id, uint8_t bval)
260
286
{
261
- HID ().SendReport (id, &bval, sizeof (bval));
287
+ return HID ().SendReport (id, &bval, sizeof (bval));
262
288
}
263
289
290
+ int HIDPowerDevice_::setFeature (uint8_t id, const void *data, int len) {
291
+ return HID ().SetFeature (id, data, len);
292
+ }
264
293
265
294
HIDPowerDevice_ PowerDevice;
266
295
0 commit comments