Documentation
¶
Overview ¶
Package usbpdprofiles computes USB Power Delivery profiles and the wattage a device actually receives once charger, cable and device limits are applied.
A charger's advertised wattage is a ceiling, not a promise. Three independent limits sit between the wall and the battery — the source profile set, the cable current rating, and the device's own maximum — and the smallest one wins.
Reference specifications and per-model wattage data used to validate this package are published at https://cairovolt.com/en/anker/wall-chargers
Index ¶
Constants ¶
const ( // DefaultCableAmps is the current ceiling for a cable without an e-marker chip. DefaultCableAmps = 3.0 // EMarkedCableAmps is the current ceiling for a 5A e-marked cable. EMarkedCableAmps = 5.0 // SPRMaxVolts is the highest voltage in Standard Power Range. Voltages above // this belong to Extended Power Range, which the specification only permits // over a 5A e-marked EPR cable. SPRMaxVolts = 20 )
Variables ¶
var PDVoltages = []int{5, 9, 12, 15, 20, 28, 36, 48}
PDVoltages are the fixed supply voltages defined by the USB Power Delivery specification.
Functions ¶
func SplitBudget ¶
SplitBudget allocates a shared multi-port budget, highest demand claiming first.
Types ¶
type Outcome ¶
Outcome reports delivered wattage and which component limited it. LimitedBy is one of "source", "cable" or "device".
type Profile ¶
Profile is a single negotiated power profile.
func ProfilesOverCable ¶
ProfilesOverCable returns the profiles actually reachable through a given cable. A cable rated below 5A cannot carry Extended Power Range voltages at all, and caps current on every remaining profile.
func SourceProfiles ¶
SourceProfiles returns the fixed PD profiles a source of the given rating can advertise, ignoring cable limits.