add board_reset_to_bootloader(), try to implement that for ch32v203 but not working yet
This commit is contained in:
@@ -119,6 +119,26 @@ static void cdc_task(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Invoked when cdc when line state changed e.g connected/disconnected
|
||||
// Use to reset to DFU when disconnect with 1200 bps
|
||||
void tud_cdc_line_state_cb(uint8_t instance, bool dtr, bool rts) {
|
||||
(void)rts;
|
||||
|
||||
// DTR = false is counted as disconnected
|
||||
if (!dtr) {
|
||||
// touch1200 only with first CDC instance (Serial)
|
||||
if (instance == 0) {
|
||||
cdc_line_coding_t coding;
|
||||
tud_cdc_get_line_coding(&coding);
|
||||
if (coding.bit_rate == 1200) {
|
||||
if (board_reset_to_bootloader) {
|
||||
board_reset_to_bootloader();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// BLINKING TASK
|
||||
//--------------------------------------------------------------------+
|
||||
|
Reference in New Issue
Block a user