mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Create a LED timer
Change-Id: Ice5a5fbf9fdf7b493597aa9542206372ebf0ae81
This commit is contained in:
@@ -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
13
apps/led_timer.cpp
Normal 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
15
apps/led_timer.h
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user