author | sl |
Fri, 29 Aug 2014 22:32:13 +0200 | |
changeset 13 | 70907579a3b6 |
child 35 | 638eb0763e20 |
permissions | -rw-r--r-- |
sl@0 | 1 |
#ifndef HID_REPORT_H |
sl@0 | 2 |
#define HID_REPORT_H |
sl@0 | 3 |
|
sl@0 | 4 |
#include <string.h> |
sl@0 | 5 |
|
sl@0 | 6 |
/** |
sl@0 | 7 |
Define an HID report. |
sl@0 | 8 |
Can be used as input and output. |
sl@0 | 9 |
*/ |
sl@0 | 10 |
template <int S> |
sl@0 | 11 |
class HidReport |
sl@0 | 12 |
{ |
sl@0 | 13 |
public: |
sl@0 | 14 |
HidReport(){Reset();} |
sl@0 | 15 |
void Reset(); |
sl@0 | 16 |
inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];} |
sl@0 | 17 |
const unsigned char* Buffer() const {return iBuffer;} |
sl@0 | 18 |
unsigned char* Buffer() {return iBuffer;} |
sl@0 | 19 |
int Size() {return S;} |
sl@0 | 20 |
protected: |
sl@0 | 21 |
unsigned char iBuffer[S]; |
sl@0 | 22 |
}; |
sl@0 | 23 |
|
sl@0 | 24 |
template <int S> |
sl@0 | 25 |
void HidReport<S>::Reset() |
sl@0 | 26 |
{ |
sl@0 | 27 |
memset(iBuffer,0,sizeof(iBuffer)); |
sl@0 | 28 |
} |
sl@0 | 29 |
|
sl@0 | 30 |
|
sl@0 | 31 |
#endif |