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)
43 uint32_t now
= millis();
44 warningLedTimer
= now
+ 500000;
47 void warningLedEnable(void)
49 warningLedState
= WARNING_LED_ON
;
52 void warningLedDisable(void)
54 warningLedState
= WARNING_LED_OFF
;
57 void warningLedFlash(void)
59 warningLedState
= WARNING_LED_FLASH
;
62 void warningLedRefresh(void)
64 switch (warningLedState
) {
71 case WARNING_LED_FLASH
:
76 uint32_t now
= micros();
77 warningLedTimer
= now
+ 500000;
80 void warningLedUpdate(void)
82 uint32_t now
= micros();
84 if ((int32_t)(now
- warningLedTimer
) < 0) {