Explorar el Código

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 hace 7 años
padre
commit
f45367e5df
Se han modificado 4 ficheros con 12 adiciones y 2 borrados
  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 Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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…
Cancelar
Guardar