瀏覽代碼

Keep the LED blinking after failed hard resets

After a failed hard reset, we keep trying to negotiate power.  Before,
the LED was on steady indicating negotiation failure during these
continued negotiations.  Now it keeps blinking, indicating what's
actually going on.
Clara Hobbs 7 年之前
父節點
當前提交
f45367e5df
共有 4 個文件被更改,包括 12 次插入2 次删除
  1. 5
    0
      src/device_policy_manager.c
  2. 5
    0
      src/device_policy_manager.h
  3. 1
    2
      src/main.c
  4. 1
    0
      src/policy_engine.c

+ 5
- 0
src/device_policy_manager.c 查看文件

@@ -113,6 +113,11 @@ void pdb_dpm_get_sink_capability(union pd_msg *cap)
113 113
         | PD_POWERROLE_SINK | PD_NUMOBJ(numobj);
114 114
 }
115 115
 
116
+void pdb_dpm_pd_start(void)
117
+{
118
+    chEvtSignal(pdb_led_thread, PDB_EVT_LED_FAST_BLINK);
119
+}
120
+
116 121
 void pdb_dpm_output_on(void)
117 122
 {
118 123
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_MEDIUM_BLINK_OFF);

+ 5
- 0
src/device_policy_manager.h 查看文件

@@ -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
+ * Indicate that power negotiations are starting.
41
+ */
42
+void pdb_dpm_pd_start(void);
43
+
39 44
 /*
40 45
  * Turn on the power output, with LED indication.
41 46
  */

+ 1
- 2
src/main.c 查看文件

@@ -66,6 +66,7 @@ static const I2CConfig i2c2config = {
66 66
  */
67 67
 static void setup(void)
68 68
 {
69
+    /* Indicate that we're in setup mode */
69 70
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_SLOW_BLINK);
70 71
 
71 72
     /* Disconnect from USB */
@@ -88,8 +89,6 @@ static void setup(void)
88 89
  */
89 90
 static void pd_buddy(void)
90 91
 {
91
-    chEvtSignal(pdb_led_thread, PDB_EVT_LED_FAST_BLINK);
92
-
93 92
     /* Start I2C2 to make communication with the PHY possible */
94 93
     i2cStart(&I2CD2, &i2c2config);
95 94
 

+ 1
- 0
src/policy_engine.c 查看文件

@@ -62,6 +62,7 @@ mailbox_t pdb_pe_mailbox;
62 62
 static enum policy_engine_state pe_sink_startup(void)
63 63
 {
64 64
     explicit_contract = false;
65
+    pdb_dpm_pd_start();
65 66
 
66 67
     /* No need to reset the protocol layer here.  There are two ways into this
67 68
      * state: startup and exiting hard reset.  On startup, the protocol layer

Loading…
取消
儲存