You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UsbRaw.h 891B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Based on Obdev's AVRUSB code and under the same license.
  3. * Modified by Robin Thoni <robin@rthoni.com>
  4. */
  5. #ifndef __UsbRaw_h__
  6. #define __UsbRaw_h__
  7. #include <avr/pgmspace.h>
  8. #include <avr/interrupt.h>
  9. #include <Arduino.h>
  10. #include "usbdrv.h"
  11. #define CALLBACK_ARGS usbRequest_t* rq, UsbRawDevice* dev, uchar* data, uchar len
  12. class UsbRawDevice {
  13. public:
  14. UsbRawDevice();
  15. void init();
  16. void poll();
  17. void setData(const uchar* data, uchar len);
  18. void setDataString(const char* data);
  19. void setDataUsbNoMsg();
  20. usbMsgLen_t _usbFunctionSetup(usbRequest_t* rq);
  21. uchar _usbFunctionWrite(uchar *data, uchar len);
  22. void setCallback(void (*callback)(CALLBACK_ARGS));
  23. private:
  24. const uchar* _dataSend;
  25. uchar _dataSendLen;
  26. void (*_callback)(CALLBACK_ARGS);
  27. usbRequest_t _rq;
  28. };
  29. extern UsbRawDevice UsbRaw;
  30. #endif // __UsbRaw_h__