Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

UsbRawHid.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Based on Obdev's AVRUSB code and under the same license.
  3. * Modified by Robin Thoni <robin@rthoni.com>
  4. */
  5. #ifndef __UsbKeyboard_h__
  6. #define __UsbKeyboard_h__
  7. #include <avr/pgmspace.h>
  8. #include <avr/interrupt.h>
  9. #include <string.h>
  10. #include "usbdrv.h"
  11. // TODO: Work around Arduino 12 issues better.
  12. //#include <WConstants.h>
  13. //#undef int()
  14. typedef uint8_t byte;
  15. #define WAIT_USB do { \
  16. UsbRawHid.update(); \
  17. if (!usbInterruptIsReady()) \
  18. { \
  19. return; \
  20. } \
  21. } while(0)
  22. #define BUFFER_SIZE 64
  23. static uchar idleRate;/* repeat rate for keyboards, never used for mice */
  24. class UsbRawHidDevice {
  25. public:
  26. UsbRawHidDevice();
  27. bool isUsbReady();
  28. void update() {
  29. usbPoll();
  30. }
  31. void sendData(const char* data, unsigned size = 0);
  32. //private: TODO: Make friend?
  33. byte reportBuffer[BUFFER_SIZE]; // buffer for HID reports [ 1 modifier byte + (len-1) key strokes]
  34. private:
  35. };
  36. #include "UsbRawHid.hxx"
  37. #endif // __UsbKeyboard_h__