2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
26 #include "drivers/light_led.h"
27 #include "drivers/time.h"
29 #include "statusindicator.h"
31 static uint32_t warningLedTimer
= 0;
39 static warningLedState_e warningLedState
= WARNING_LED_OFF
;
41 void warningLedResetTimer(void) {
42 uint32_t now
= millis();
43 warningLedTimer
= now
+ 500000;
46 void warningLedEnable(void)
48 warningLedState
= WARNING_LED_ON
;
51 void warningLedDisable(void)
53 warningLedState
= WARNING_LED_OFF
;
56 void warningLedFlash(void)
58 warningLedState
= WARNING_LED_FLASH
;
61 void warningLedRefresh(void)
63 switch (warningLedState
) {
70 case WARNING_LED_FLASH
:
75 uint32_t now
= micros();
76 warningLedTimer
= now
+ 500000;
79 void warningLedUpdate(void)
81 uint32_t now
= micros();
83 if ((int32_t)(now
- warningLedTimer
) < 0) {