Enhancing USBAPI.h

瀏覽次數:50 次
跳到第一則未讀訊息

Aleksandr Bratchik

未讀,
2021年1月18日 凌晨3:56:142021/1/18
收件者:Developers
Hello, all

I'd like to propose a small modification to USB API in order to extend its functionality for Arduino Leonardo/Arduino Pro Mini boards:

  1. Make the static bool USB_SendStringDescriptor(const u8*string_P, u8 string_len, uint8_t flags) non-static and public (expose through USBAPI.h), similar to USB_SendControl methods. This would allow developers to create custom string descriptors for their devices, using PluggableUSB interface.
  2. Extend the HID API. Current version of HID library allows only communication through bulk interrupt pipe and this limits use cases that one can support  - for example, power devices, which mostly use control pipe for communication. I updated the HID.h/HID.cpp so that using SetFeature/GetFeature protocols of HID USB become possible. Teh main idea is - one can declare a global variable in the sketch initiation and pass the address of this variable to HID using SetFeature method. This variable can be later updated in the loop of the sketch and these updates will become visible to the host through USB HID control pipe.
    The source code is here .
Any comments/questions/suggestions please let know.
回覆所有人
回覆作者
轉寄
0 則新訊息