Ralim / usb-pd

USB-PD driver stack for the FUSB302
Apache License 2.0
124 stars 15 forks source link

More simple PPS example? #10

Closed puzrin closed 3 years ago

puzrin commented 3 years ago

From user's point of view, it would be nice to have more "obvious" api for PPS mode:

  1. Check if PPS mode with max [voltage, current] availavle.
  2. Update (anytime) custom [voltage, current].
  3. Optional. Check success of (2) somehow.

That means, in app i'd like to use something like

// On setup
if (!pd_is_pps_available(21000, 3000)) {
    printf("Error: PPS mode with 21V/3A required")
}

// Somewhere in heater's PID
pd_pps_set(my_voltage, 3000);

I understant, current api has unlimited flexibility. But in real world many projects have more simple needs

It would be nice to have copy-paste-able examples for that. May be somewhere in examples/ folder.