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