Ver código fonte

Added DPM function to get GiveBack flag

Clara Hobbs 7 anos atrás
pai
commit
99421b50bd
2 arquivos alterados com 12 adições e 0 exclusões
  1. 7
    0
      src/device_policy_manager.c
  2. 5
    0
      src/device_policy_manager.h

+ 7
- 0
src/device_policy_manager.c Ver arquivo

@@ -128,6 +128,13 @@ void pdb_dpm_get_sink_capability(union pd_msg *cap)
128 128
         | PD_POWERROLE_SINK | PD_NUMOBJ(numobj);
129 129
 }
130 130
 
131
+bool pdb_dpm_giveback_enabled(void)
132
+{
133
+    struct pdb_config *cfg = pdb_config_flash_read();
134
+
135
+    return cfg->flags & PDB_CONFIG_FLAGS_GIVEBACK;
136
+}
137
+
131 138
 bool pdb_dpm_evaluate_typec_current(void)
132 139
 {
133 140
     static bool cfg_set = false;

+ 5
- 0
src/device_policy_manager.h Ver arquivo

@@ -36,6 +36,11 @@ bool pdb_dpm_evaluate_capability(const union pd_msg *capabilities, union pd_msg
36 36
  */
37 37
 void pdb_dpm_get_sink_capability(union pd_msg *cap);
38 38
 
39
+/*
40
+ * Return whether or not GiveBack support is enabled.
41
+ */
42
+bool pdb_dpm_giveback_enabled(void);
43
+
39 44
 /*
40 45
  * Evaluate whether or not the currently offered Type-C Current can fulfill our
41 46
  * power needs.

Carregando…
Cancelar
Salvar