Browse Source

Write 5 V in PDV as PD_MV2PDV(5000)

It's more obvious what is meant by that macro than by just the number
100.
Clara Hobbs 7 years ago
parent
commit
24aa91ff64
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      src/device_policy_manager.c

+ 4
- 4
src/device_policy_manager.c View File

112
 
112
 
113
     /* If we have no configuration or want something other than 5 V, add a PDO
113
     /* If we have no configuration or want something other than 5 V, add a PDO
114
      * for vSafe5V */
114
      * for vSafe5V */
115
-    if (cfg == NULL || cfg->v != 100) {
115
+    if (cfg == NULL || cfg->v != PD_MV2PDV(5000)) {
116
         /* Minimum current, 5 V, and higher capability. */
116
         /* Minimum current, 5 V, and higher capability. */
117
         cap->obj[numobj++] = PD_PDO_TYPE_FIXED
117
         cap->obj[numobj++] = PD_PDO_TYPE_FIXED
118
-            | PD_PDO_SNK_FIXED_VOLTAGE_SET(100)
118
+            | PD_PDO_SNK_FIXED_VOLTAGE_SET(PD_MV2PDV(5000))
119
             | PD_PDO_SNK_FIXED_CURRENT_SET(DPM_MIN_CURRENT);
119
             | PD_PDO_SNK_FIXED_CURRENT_SET(DPM_MIN_CURRENT);
120
     }
120
     }
121
 
121
 
125
             | PD_PDO_SNK_FIXED_VOLTAGE_SET(cfg->v)
125
             | PD_PDO_SNK_FIXED_VOLTAGE_SET(cfg->v)
126
             | PD_PDO_SNK_FIXED_CURRENT_SET(cfg->i);
126
             | PD_PDO_SNK_FIXED_CURRENT_SET(cfg->i);
127
         /* If we want more than 5 V, set the Higher Capability flag */
127
         /* If we want more than 5 V, set the Higher Capability flag */
128
-        if (cfg->v != 100) {
128
+        if (cfg->v != PD_MV2PDV(5000)) {
129
             cap->obj[0] |= PD_PDO_SNK_FIXED_HIGHER_CAP;
129
             cap->obj[0] |= PD_PDO_SNK_FIXED_HIGHER_CAP;
130
         }
130
         }
131
     }
131
     }
164
 
164
 
165
     /* If we have no configuration or don't want 5 V, Type-C Current can't
165
     /* If we have no configuration or don't want 5 V, Type-C Current can't
166
      * possibly satisfy our needs */
166
      * possibly satisfy our needs */
167
-    if (cfg == NULL || cfg->v != 100) {
167
+    if (cfg == NULL || cfg->v != PD_MV2PDV(5000)) {
168
         return false;
168
         return false;
169
     }
169
     }
170
 
170
 

Loading…
Cancel
Save