これは何?
TinyUSB が提供するデバイスクラスドライバを override する方法を紹介します。
想定読者
TinyUSB を使って vendor クラスを実装したいんだけど、 TinyUSB のデフォルト実装だとやりたいことが出来ない人
結論
PR385 で追加された
usbd_app_driver_get_cb
を実装し、自前デバイスクラスドライバの usbd_class_driver_t
を返しましょう。
実装例は Raspberry pi Pico の resetデバイス があります。
補足
Device Stack の説明に次のような説明があります。上記結論と同様のことを書いています。
If you have a special requirement, usbd_app_driver_get_cb() can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface raspberrypi/pico-sdk#197