Browse Source

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 years ago
parent
commit
f45367e5df
4 changed files with 12 additions and 2 deletions
  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 View File

113
         | PD_POWERROLE_SINK | PD_NUMOBJ(numobj);
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
 void pdb_dpm_output_on(void)
121
 void pdb_dpm_output_on(void)
117
 {
122
 {
118
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_MEDIUM_BLINK_OFF);
123
     chEvtSignal(pdb_led_thread, PDB_EVT_LED_MEDIUM_BLINK_OFF);

+ 5
- 0
src/device_policy_manager.h View File

36
  */
36
  */
37
 void pdb_dpm_get_sink_capability(union pd_msg *cap);
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
  * Turn on the power output, with LED indication.
45
  * Turn on the power output, with LED indication.
41
  */
46
  */

+ 1
- 2
src/main.c View File

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

+ 1
- 0
src/policy_engine.c View File

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

Loading…
Cancel
Save