aboutsummaryrefslogtreecommitdiff
path: root/control/application.c
diff options
context:
space:
mode:
Diffstat (limited to 'control/application.c')
-rw-r--r--control/application.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/control/application.c b/control/application.c
index ce14bf2..c304a84 100644
--- a/control/application.c
+++ b/control/application.c
@@ -2,6 +2,7 @@
#include <bc_eeprom.h>
#include <bc_spi.h>
#include <bc_dice.h>
+#include "ledctl.h"
#define SERVICE_INTERVAL_INTERVAL (60 * 60 * 1000)
#define BATTERY_UPDATE_INTERVAL (60 * 60 * 1000)
@@ -51,26 +52,24 @@ void tmp112_event_handler(bc_tmp112_t *self, bc_tmp112_event_t event, void *even
bc_scheduler_plan_now(APPLICATION_TASK_ID);
}
-int brightness = 0;
-
-void set_brightness() {
- bc_radio_pub_int("led/brightness/set", &brightness);
-}
-
void lcd_button_left_event_handler(bc_button_t *self, bc_button_event_t event, void *event_param) {
- if (event != BC_BUTTON_EVENT_CLICK)
- return;
- bc_led_pulse(&led_lcd_blue, 30);
- brightness = 100;
- set_brightness();
+ if (event == BC_BUTTON_EVENT_CLICK) {
+ click_left();
+ bc_led_pulse(&led_lcd_blue, 30);
+ } else if (event == BC_BUTTON_EVENT_HOLD) {
+ hold_left();
+ bc_led_pulse(&led_lcd_blue, 500);
+ }
}
void lcd_button_right_event_handler(bc_button_t *self, bc_button_event_t event, void *event_param) {
- if (event != BC_BUTTON_EVENT_CLICK)
- return;
- bc_led_pulse(&led_lcd_red, 30);
- brightness = 0;
- set_brightness();
+ if (event == BC_BUTTON_EVENT_CLICK) {
+ click_right();
+ bc_led_pulse(&led_lcd_red, 30);
+ } else if (event == BC_BUTTON_EVENT_HOLD) {
+ hold_right();
+ bc_led_pulse(&led_lcd_red, 500);
+ }
}
void battery_event_handler(bc_module_battery_event_t event, void *event_param) {