| 94 | IRAM_ATTR |
| 95 | #endif |
| 96 | void setFeedbackLED(bool aSwitchLedOn) { |
| 97 | if (aSwitchLedOn) { |
| 98 | // Turn user defined pin LED on |
| 99 | if (FeedbackLEDControl.FeedbackLEDPin == USE_DEFAULT_FEEDBACK_LED_PIN) { |
| 100 | #if defined(LED_BUILTIN) // use fast macros here |
| 101 | # if defined(FEEDBACK_LED_IS_ACTIVE_LOW) |
| 102 | digitalWriteFast(LED_BUILTIN, LOW); // For AVR, this generates a single cbi command |
| 103 | # else |
| 104 | digitalWriteFast(LED_BUILTIN, HIGH); // For AVR, this generates a single sbi command |
| 105 | # endif |
| 106 | #endif |
| 107 | |
| 108 | } else { |
| 109 | #if defined(FEEDBACK_LED_IS_ACTIVE_LOW) |
| 110 | if (__builtin_constant_p(FeedbackLEDControl.FeedbackLEDPin) ) { |
| 111 | digitalWriteFast(FeedbackLEDControl.FeedbackLEDPin, LOW); |
| 112 | } else { |
| 113 | digitalWrite(FeedbackLEDControl.FeedbackLEDPin, LOW); |
| 114 | } |
| 115 | #else |
| 116 | if (__builtin_constant_p(FeedbackLEDControl.FeedbackLEDPin)) { |
| 117 | digitalWriteFast(FeedbackLEDControl.FeedbackLEDPin, HIGH); |
| 118 | } else { |
| 119 | digitalWrite(FeedbackLEDControl.FeedbackLEDPin, HIGH); |
| 120 | } |
| 121 | #endif |
| 122 | } |
| 123 | |
| 124 | } else { |
| 125 | // Turn user defined pin LED off |
| 126 | if (FeedbackLEDControl.FeedbackLEDPin == USE_DEFAULT_FEEDBACK_LED_PIN) { |
| 127 | #if defined(LED_BUILTIN) |
| 128 | # if defined(FEEDBACK_LED_IS_ACTIVE_LOW) |
| 129 | digitalWriteFast(LED_BUILTIN, HIGH); // For AVR, this generates a single sbi command |
| 130 | # else |
| 131 | digitalWriteFast(LED_BUILTIN, LOW); // For AVR, this generates a single cbi command |
| 132 | # endif |
| 133 | #endif |
| 134 | } else { |
| 135 | #if defined(FEEDBACK_LED_IS_ACTIVE_LOW) |
| 136 | if (__builtin_constant_p(FeedbackLEDControl.FeedbackLEDPin) ) { |
| 137 | digitalWriteFast(FeedbackLEDControl.FeedbackLEDPin, HIGH); |
| 138 | } else { |
| 139 | digitalWrite(FeedbackLEDControl.FeedbackLEDPin, HIGH); |
| 140 | } |
| 141 | #else |
| 142 | if (__builtin_constant_p(FeedbackLEDControl.FeedbackLEDPin)) { |
| 143 | digitalWriteFast(FeedbackLEDControl.FeedbackLEDPin, LOW); |
| 144 | } else { |
| 145 | digitalWrite(FeedbackLEDControl.FeedbackLEDPin, LOW); |
| 146 | } |
| 147 | #endif |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Old deprecated function name for setLEDFeedback() or enableLEDFeedback() / disableLEDFeedback() |
no outgoing calls
no test coverage detected