I noticed that the power supply from the Huawei P30 Pro is a "switching power adapter". How does it know how many volts an application needs? After all, it can output 5V 2A, 9V 2A, or 10V 4A. If I connect a circuit that needs 5V, will it be destroyed, or will the power supply switch automatically even if it is not a cell phone?
I assume that it is a power supply with a USB-C connector. In this case there's always a voltage of 5V as standard. To get a higher voltage, your connected device would have to actively communicate with the power supply via the USB data line and agree on a higher voltage. It's called USB-PD if you want to keep looking for it.