#ifndef __THER_LED_HPP__ #define __THER_LED_HPP__ #include #include #include #include #include namespace ther { template class Led { public: static auto On() -> zpp::error { return led_on_dt(&kSpec); } static auto Off() -> zpp::error { return led_off_dt(&kSpec); } template static auto Flash(std::chrono::duration period) { s_work.submit(period); } private: static auto Flash() -> void { static bool flag = false; if (flag) { led_off_dt(&kSpec); } else { led_on_dt(&kSpec); } flag = !flag; } static inline zpp::periodic_work<> s_work{Flash}; }; } // namespace ther #endif