move tud_cdc_line_state_cb

This commit is contained in:
hathach committed 2019-04-25 00:59:33 +07:00
1 parent e02b3ff841
commit 68c94e1199
2 files changed
+21 -16

No files matched your search

@@ -117,4 +117,25 @@ size_t Adafruit_USBDev_CDC::write(const uint8_t *buffer, size_t size)
return size - remain;
}
extern "C"
{
// 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 itf, bool dtr, bool rts)
{
(void) itf; // interface ID, not used
// DTR = false is counted as disconnected
if ( !dtr )
{
cdc_line_coding_t coding;
tud_cdc_get_line_coding(&coding);
if ( coding.bit_rate == 1200 ) enterSerialDfu();
}
}
}
#endif // NRF52840_XXAA
-16
View File
@@ -117,20 +117,4 @@ static void usb_device_task(void* param)
}
}
// 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 itf, bool dtr, bool rts)
{
(void) itf; // interface ID, not used
// DTR = false is counted as disconnected
if ( !dtr )
{
cdc_line_coding_t coding;
tud_cdc_get_line_coding(&coding);
if ( coding.bit_rate == 1200 ) enterSerialDfu();
}
}
#endif