Closed stwirth closed 2 years ago
Hah, you're telling me – their code is actually what my library was based on, believe it or not. Theirs is extremely dense, with most of the high-level logic controlled implicitly with HAL hooks and event handlers. So good luck following it if you aren't familiar with their HAL. I had to use their IDE + debugger to trace execution path.
Aaaaanyway, I usually stick with the MIT license. Just added LICENSE
to the root of this repository.
Thanks for the feedback!
Thanks @ardnew!
FYI I'm also looking at https://github.com/sparkfun/SparkFun_STUSB4500_Arduino_Library which is MIT licensed as well. I like your typedefs though but unfortunately I don't have the alert and attach pins connected on my board...
@stwirth You should know there is a major difference between this and the SparkFun library. Your choice of library to use should probably be based on these functional differences instead of which source code design is more appealing to you.
These differences may matter depending on how you plan to use the device: using fixed power profiles or using dynamic power profiles.
sparkfun/SparkFun_STUSB4500_Arduino_Library
Uses the device's integrated NVM for configuring PDOs, which implies the following:
{ +5V, 0.5–3.0A }
, so you really only have two (2) PDOs for a sink to choose from (in addition to the required +5V
standard).VBUS
temporarily:+5V
on VBUS
during initialization, but after "cable disconnect" messages are sent on the PD bus.VBUS
power path may be gated behind a BJT/FET until negotiation completes, resulting in a very noticeable power cycle. ardnew/STUSB4500
and ardnew/tinygo-stusb4500
Does not use the device's integrated NVM but configures the PDOs dynamically at run-time (RAM), which implies the following:
+5V
, +9V
, +12V
, +15V
, +20V
) with varying maximum currents (0.5A–5.0A
). These can be used to create a user-controllable variable power supply for a workbench.Hope this clarifies some confusion and helps you choose an appropriate library for your project!
@ardnew thanks for your guidance and for pointing out the differences in the libraries!
Hi @ardnew, nice work with this library!
I've been trying to find a driver for the ST4500 for an embedded Linux project and I found the official library from ST (https://github.com/usb-c/STUSB4500) hard to integrate/adapt to a non-ST platform. Your library here seems much easier to port to embedded Linux. I could not find any license information in the repo, could you clarify how your code can be used? Thanks!