DeqingSun / ch55xduino

An Arduino-like programming API for the CH55X
GNU Lesser General Public License v2.1
439 stars 86 forks source link

cleaner USB code suggestion #25

Closed nerdralph closed 3 years ago

nerdralph commented 3 years ago

The string descriptors are a bit verbose as u8. defining them as u16 makes the code a bit cleaner:

 __code uint16_t SerDes[]={
     0x030E,
     'C','H','5','5','x'
 };

Or if you are willing to define a struct for each descriptor, you can use UTF-16 string constants like I do here; https://github.com/nerdralph/ch554_sdcc_usb_blinky/blob/master/projects/include/usb_intr.h#L24

DeqingSun commented 3 years ago

That's cool. Thanks for suggestion. Will take a look.

DeqingSun commented 3 years ago

Fixed in https://github.com/DeqingSun/ch55xduino/commit/4b80e0edf368f21f40d85da487f5b800aefe1ccf Will be merged into main branch in the next release.