DeqingSun / ch55xduino

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

Convert cryptic USB descriptors to more readable code #122

Closed buttim closed 1 year ago

buttim commented 1 year ago

In the examples the USB descriptors are mere arrays of bytes(uint8t[]). Most of the bytes are just magic numbers often with a comment explaining the meaning, others with no explanation at all. Obviously such code is not easily understandable by a novice, let alone modify it.

I propose to adopt definitions from the LUFA library.

Converting all the examples would probably be overkill, but I think that starting with just one should be doable. I could collaborate on this. We might either convert one of the examples or add something new. I would be particularly interested in the possibility of supporting multiple CDCs, or mass storage + CDC

DeqingSun commented 1 year ago

Lufa is copyright protected code and there need to be another source to copy the code.

prosper00 commented 1 year ago

from their website: "LUFA is free to use - even for commerical purposes, subject to the MIT license restrictions (see project documentation)"

the license itself is here: https://github.com/abcminiuser/lufa/blob/master/LUFA/License.txt

Permission to use, copy, modify, and distribute this software
and its documentation for any purpose is hereby granted without
fee, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, 

I'm no lawyer, but I don't think ch55xduino would be considered commercial. The commercial license adds the following features, none of which seem necessary for this project:

   1. The right to use LUFA without attribution
   2. Three free hours of consultation
   3. Priority for support requests
DeqingSun commented 1 year ago

@prosper00 thanks for sharing. Seems reasonable. I'll fix the upload tool problem on my machine, before doing this job which take a lot of firmware write to test.

DeqingSun commented 1 year ago

Most example converted.

buttim commented 1 year ago

Great work indeed!