summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index cf8b1cb531..4228d12fd3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -104,6 +104,8 @@ enum pd_rx_errors {
#define PDO_FIXED_PEAK_CURR () /* [21..20] Peak current */
#define PDO_FIXED_VOLT(mv) (((mv)/50) << 10) /* Voltage in 50mV units */
#define PDO_FIXED_CURR(ma) (((ma)/10) << 0) /* Max current in 10mA units */
+#define PDO_FIXED_GET_VOLT(pdo) (((pdo >> 10) & 0x3FF) * 50)
+#define PDO_FIXED_GET_CURR(pdo) ((pdo & 0x3FF) * 10)
#define PDO_FIXED(mv, ma, flags) (PDO_FIXED_VOLT(mv) |\
PDO_FIXED_CURR(ma) | (flags))