Skip to content

Commit 92457ec

Browse files
authored
Merge pull request hathach#2202 from Rocky04/patch-4
Invoke unmounted state on configuration reset
2 parents 04f0cd5 + 9602c06 commit 92457ec

File tree

21 files changed

+46
-25
lines changed

21 files changed

+46
-25
lines changed

examples/device/audio_4_channel_mic/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
133133
// Invoked when usb bus is resumed
134134
void tud_resume_cb(void)
135135
{
136-
blink_interval_ms = BLINK_MOUNTED;
136+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
137137
}
138138

139139
//--------------------------------------------------------------------+

examples/device/audio_test/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
134134
// Invoked when usb bus is resumed
135135
void tud_resume_cb(void)
136136
{
137-
blink_interval_ms = BLINK_MOUNTED;
137+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
138138
}
139139

140140
//--------------------------------------------------------------------+

examples/device/audio_test_multi_rate/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
146146
// Invoked when usb bus is resumed
147147
void tud_resume_cb(void)
148148
{
149-
blink_interval_ms = BLINK_MOUNTED;
149+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
150150
}
151151

152152
//--------------------------------------------------------------------+

examples/device/cdc_msc/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
9999
// Invoked when usb bus is resumed
100100
void tud_resume_cb(void)
101101
{
102-
blink_interval_ms = BLINK_MOUNTED;
102+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
103103
}
104104

105105

examples/device/cdc_msc_freertos/src/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,14 @@ void tud_suspend_cb(bool remote_wakeup_en)
179179
// Invoked when usb bus is resumed
180180
void tud_resume_cb(void)
181181
{
182-
xTimerChangePeriod(blinky_tm, pdMS_TO_TICKS(BLINK_MOUNTED), 0);
182+
if (tud_mounted())
183+
{
184+
xTimerChangePeriod(blinky_tm, pdMS_TO_TICKS(BLINK_MOUNTED), 0);
185+
}
186+
else
187+
{
188+
xTimerChangePeriod(blinky_tm, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), 0);
189+
}
183190
}
184191

185192
//--------------------------------------------------------------------+

examples/device/dfu/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
116116
// Invoked when usb bus is resumed
117117
void tud_resume_cb(void)
118118
{
119-
blink_interval_ms = BLINK_MOUNTED;
119+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
120120
}
121121

122122
//--------------------------------------------------------------------+

examples/device/dfu_runtime/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
111111
// Invoked when usb bus is resumed
112112
void tud_resume_cb(void)
113113
{
114-
blink_interval_ms = BLINK_MOUNTED;
114+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
115115
}
116116

117117
// Invoked on DFU_DETACH request to reboot to the bootloader

examples/device/dynamic_configuration/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
100100
// Invoked when usb bus is resumed
101101
void tud_resume_cb(void)
102102
{
103-
blink_interval_ms = BLINK_MOUNTED;
103+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
104104
}
105105

106106

examples/device/hid_boot_interface/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
102102
// Invoked when usb bus is resumed
103103
void tud_resume_cb(void)
104104
{
105-
blink_interval_ms = BLINK_MOUNTED;
105+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
106106
}
107107

108108
//--------------------------------------------------------------------+

examples/device/hid_composite/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void tud_suspend_cb(bool remote_wakeup_en)
101101
// Invoked when usb bus is resumed
102102
void tud_resume_cb(void)
103103
{
104-
blink_interval_ms = BLINK_MOUNTED;
104+
blink_interval_ms = tud_mounted() ? BLINK_MOUNTED : BLINK_NOT_MOUNTED;
105105
}
106106

107107
//--------------------------------------------------------------------+

0 commit comments

Comments
 (0)