Fix for SITL target
[betaflight.git] / src / main / drivers / light_led.h
blob198a3f3244ebfe540aeac957315ae46ecd6f21ad
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "config/parameter_group.h"
21 #include "drivers/io_types.h"
22 #include "common/utils.h"
24 #define STATUS_LED_NUMBER 3
26 typedef struct statusLedConfig_s {
27 ioTag_t ioTags[STATUS_LED_NUMBER];
28 uint8_t inversion;
29 } statusLedConfig_t;
31 PG_DECLARE(statusLedConfig_t, statusLedConfig);
33 // Helpful macros
34 #if defined(UNIT_TEST) || defined(USE_FAKE_LED)
36 #define LED0_TOGGLE NOOP
37 #define LED0_OFF NOOP
38 #define LED0_ON NOOP
40 #define LED1_TOGGLE NOOP
41 #define LED1_OFF NOOP
42 #define LED1_ON NOOP
44 #define LED2_TOGGLE NOOP
45 #define LED2_OFF NOOP
46 #define LED2_ON NOOP
48 #else
50 #define LED0_TOGGLE ledToggle(0)
51 #define LED0_OFF ledSet(0, false)
52 #define LED0_ON ledSet(0, true)
54 #define LED1_TOGGLE ledToggle(1)
55 #define LED1_OFF ledSet(1, false)
56 #define LED1_ON ledSet(1, true)
58 #define LED2_TOGGLE ledToggle(2)
59 #define LED2_OFF ledSet(2, false)
60 #define LED2_ON ledSet(2, true)
62 void ledInit(const statusLedConfig_t *statusLedConfig);
63 void ledToggle(int led);
64 void ledSet(int led, bool state);
66 #endif