From 1bf44a3fb01d0730b38339748430a3cbbc03cec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 7 Apr 2017 11:39:16 +0200 Subject: [PATCH] [apps] Create a LED timer Change-Id: Ice5a5fbf9fdf7b493597aa9542206372ebf0ae81 --- apps/Makefile | 1 + apps/led_timer.cpp | 13 +++++++++++++ apps/led_timer.h | 15 +++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 apps/led_timer.cpp create mode 100644 apps/led_timer.h diff --git a/apps/Makefile b/apps/Makefile index 07d798181..c29903531 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -17,6 +17,7 @@ app_objs += $(addprefix apps/,\ constant.o\ global_preferences.o\ i18n.o\ + led_timer.o\ main.o\ math_toolbox.o\ node.o\ diff --git a/apps/led_timer.cpp b/apps/led_timer.cpp new file mode 100644 index 000000000..a71fe7248 --- /dev/null +++ b/apps/led_timer.cpp @@ -0,0 +1,13 @@ +#include "led_timer.h" + +LedTimer::LedTimer() : + Timer(1), + m_on(false) +{ +} + +void LedTimer::fire() { + m_on = !m_on; + KDColor ledColor = m_on ? KDColorRed : KDColorBlack; + Ion::LED::setColor(ledColor); +} diff --git a/apps/led_timer.h b/apps/led_timer.h new file mode 100644 index 000000000..fd193ea79 --- /dev/null +++ b/apps/led_timer.h @@ -0,0 +1,15 @@ +#ifndef APPS_LED_TIMER_H +#define APPS_LED_TIMER_H + +#include + +class LedTimer : public Timer { +public: + LedTimer(); +private: + void fire() override; + bool m_on; +}; + +#endif +