[apps] Create a LED timer

Change-Id: Ice5a5fbf9fdf7b493597aa9542206372ebf0ae81
This commit is contained in:
Émilie Feral
2017-04-07 11:39:16 +02:00
parent dadeb98d99
commit 1bf44a3fb0
3 changed files with 29 additions and 0 deletions

View File

@@ -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\

13
apps/led_timer.cpp Normal file
View File

@@ -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);
}

15
apps/led_timer.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef APPS_LED_TIMER_H
#define APPS_LED_TIMER_H
#include <escher.h>
class LedTimer : public Timer {
public:
LedTimer();
private:
void fire() override;
bool m_on;
};
#endif