diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-05-29 05:44:59 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-05-29 16:31:08 +0300 |
commit | 8b2088103a74e616ca82fe043de55cb7ed58e329 (patch) | |
tree | f8dad8b7bbe9cb6eb135e63cb3ece2338e035aba /platformio/common/libs/led/homekit | |
parent | 6a64c97c799bd4919b46f8dc39d80799bb751ab3 (diff) |
platformio: split code into libraries
Diffstat (limited to 'platformio/common/libs/led/homekit')
-rw-r--r-- | platformio/common/libs/led/homekit/led.cpp | 9 | ||||
-rw-r--r-- | platformio/common/libs/led/homekit/led.h | 13 |
2 files changed, 17 insertions, 5 deletions
diff --git a/platformio/common/libs/led/homekit/led.cpp b/platformio/common/libs/led/homekit/led.cpp index acc2140..ffefb04 100644 --- a/platformio/common/libs/led/homekit/led.cpp +++ b/platformio/common/libs/led/homekit/led.cpp @@ -1,6 +1,6 @@ #include "led.h" -namespace homekit { +namespace homekit::led { void Led::on_off(uint16_t delay_ms, bool last_delay) const { on(); @@ -17,4 +17,11 @@ void Led::blink(uint8_t count, uint16_t delay_ms) const { } } + +#ifdef CONFIG_TARGET_NODEMCU +const Led* board_led = new Led(CONFIG_BOARD_LED_GPIO); +#endif +const Led* mcu_led = new Led(CONFIG_MCU_LED_GPIO); + + } diff --git a/platformio/common/libs/led/homekit/led.h b/platformio/common/libs/led/homekit/led.h index 513bfea..775d2eb 100644 --- a/platformio/common/libs/led/homekit/led.h +++ b/platformio/common/libs/led/homekit/led.h @@ -1,10 +1,10 @@ -#ifndef COMMON_HOMEKIT_LED_H -#define COMMON_HOMEKIT_LED_H +#ifndef HOMEKIT_LIB_LED_H +#define HOMEKIT_LIB_LED_H #include <Arduino.h> #include <stdint.h> -namespace homekit { +namespace homekit::led { class Led { private: @@ -23,6 +23,11 @@ public: void blink(uint8_t count, uint16_t delay_ms) const; }; +#ifdef CONFIG_TARGET_NODEMCU +extern const Led* board_led; +#endif +extern const Led* mcu_led; + } -#endif //COMMON_HOMEKIT_LED_H +#endif //HOMEKIT_LIB_LED_H |