Skip to content
Snippets Groups Projects
Commit 5dd2adc4 authored by Cristian Maglie's avatar Cristian Maglie
Browse files

USBD: Rewritten RX/TX LED conditions in a slighlty more clear way

parent 0605c11e
Branches
Tags
No related merge requests found
......@@ -610,7 +610,9 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
return -1;
#ifdef PIN_LED_TXL
digitalWrite(PIN_LED_TXL, LOW);
if (txLEDPulse == 0)
digitalWrite(PIN_LED_TXL, LOW);
txLEDPulse = TX_RX_LED_PULSE_MS;
#endif
......@@ -824,13 +826,19 @@ void USBDeviceClass::ISRHandler()
// check whether the one-shot period has elapsed. if so, turn off the LED
#ifdef PIN_LED_TXL
if (txLEDPulse && !(--txLEDPulse))
digitalWrite(PIN_LED_TXL, HIGH);
if (txLEDPulse > 0) {
txLEDPulse--;
if (txLEDPulse == 0)
digitalWrite(PIN_LED_TXL, HIGH);
}
#endif
#ifdef PIN_LED_RXL
if (rxLEDPulse && !(--rxLEDPulse))
digitalWrite(PIN_LED_RXL, HIGH);
if (rxLEDPulse > 0) {
rxLEDPulse--;
if (rxLEDPulse == 0)
digitalWrite(PIN_LED_RXL, HIGH);
}
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment