Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

40 lines
1.3KB

  1. #ifndef __HIDDumper_h_
  2. #define __HIDDumper_h_
  3. #include <Arduino.h>
  4. #include <USBHost_t36.h>
  5. class HIDDumpController : public USBHIDInput {
  6. public:
  7. HIDDumpController(USBHost &host, uint32_t usage = 0) : fixed_usage_(usage) { init(); }
  8. uint32_t usage(void) {return usage_;}
  9. static bool show_raw_data;
  10. static bool show_formated_data;
  11. static bool changed_data_only;
  12. protected:
  13. virtual hidclaim_t claim_collection(USBHIDParser *driver, Device_t *dev, uint32_t topusage);
  14. virtual bool hid_process_in_data(const Transfer_t *transfer);
  15. virtual bool hid_process_out_data(const Transfer_t *transfer);
  16. virtual void hid_input_begin(uint32_t topusage, uint32_t type, int lgmin, int lgmax);
  17. virtual void hid_input_data(uint32_t usage, int32_t value);
  18. virtual void hid_input_end();
  19. virtual void disconnect_collection(Device_t *dev);
  20. private:
  21. void init();
  22. USBHIDParser *driver_;
  23. uint8_t collections_claimed = 0;
  24. volatile int hid_input_begin_level_ = 0;
  25. uint32_t fixed_usage_;
  26. uint32_t usage_ = 0;
  27. // Track changing fields.
  28. const static int MAX_CHANGE_TRACKED = 512;
  29. uint32_t usages_[MAX_CHANGE_TRACKED];
  30. int32_t values_[MAX_CHANGE_TRACKED];
  31. int count_usages_ = 0;
  32. int index_usages_ = 0;
  33. // See if we can contribute transfers
  34. Transfer_t mytransfers[2] __attribute__ ((aligned(32)));
  35. };
  36. #endif // __HIDDumper_h_