![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork for LoDev S76S
Dependencies: mbed BufferedSerial SX1276GenericLib USBDeviceHT
Diff: utils.cpp
- Revision:
- 21:6379a5650867
- Parent:
- 20:a1029437adca
--- a/utils.cpp Sun Jun 03 19:25:37 2018 +0000 +++ b/utils.cpp Mon Feb 18 22:57:14 2019 +0000 @@ -7,9 +7,6 @@ time_t cvt_date(char const *date, char const *time); BufferedSerial *ser; -#ifdef FEATURE_USBSERIAL -USBSerialBuffered *usb; -#endif bool _useDprintf; /* @@ -28,38 +25,15 @@ void InitSerial(int timeout, DigitalOut *led) { _useDprintf = true; - bool uartActive; { - { - // need to turn rx low to avoid floating signal - DigitalOut rx(USBRX); - rx = 0; - } - DigitalIn uartRX(USBRX); - uartActive = uartRX.read(); + // need to turn rx low to avoid floating signal + DigitalOut rx(USBRX); + rx = 0; } -#ifdef FEATURE_USBSERIAL - if (!uartActive) { - usb = new USBSerialBuffered(); - Timer t; - t.start(); - while(!usb->connected()) { - if (led) - *led = !*led; - wait_ms(100); - if (timeout) { - if (t.read_ms() >= timeout) - return; - } - } - busyTimerFunc(); - return; - } else { -#else + DigitalIn uartRX(USBRX); { -#endif ser = new BufferedSerial(USBTX, USBRX); - ser->baud(230400); + ser->baud(115200); ser->format(8); } time_t t = cvt_date(__DATE__, __TIME__); @@ -115,14 +89,7 @@ if (timstamp) printTimeStamp(); -#ifdef FEATURE_USBSERIAL - if (usb) { - usb->vprintf_irqsafe(format, arg); - if (newline) - usb->printf_irqsafe("\r\n"); -#else if (0) { -#endif } else if (ser) { // serial jas int r = 0;