Browse Source

Use a bool for dpm_unconstrained_power

It was a uint8_t before, but it was really just a boolean variable.
It's a proper bool now, and the code that sets its value is less
ridiculous.
Clara Hobbs 7 years ago
parent
commit
fb50afc4cd
1 changed files with 2 additions and 6 deletions
  1. 2
    6
      src/device_policy_manager.c

+ 2
- 6
src/device_policy_manager.c View File

@@ -28,7 +28,7 @@
28 28
 
29 29
 
30 30
 /* Whether or not the power supply is unconstrained */
31
-static uint8_t dpm_unconstrained_power;
31
+static bool dpm_unconstrained_power;
32 32
 
33 33
 bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg *request)
34 34
 {
@@ -41,11 +41,7 @@ bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg
41 41
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_FAST_BLINK);
42 42
 
43 43
     /* Get whether or not the power supply is constrained */
44
-    if (capabilities->obj[0] & PD_PDO_SRC_FIXED_UNCONSTRAINED) {
45
-        dpm_unconstrained_power = 1;
46
-    } else {
47
-        dpm_unconstrained_power = 0;
48
-    }
44
+    dpm_unconstrained_power = capabilities->obj[0] & PD_PDO_SRC_FIXED_UNCONSTRAINED;
49 45
 
50 46
     /* Make sure we have configuration */
51 47
     if (cfg != NULL) {

Loading…
Cancel
Save