static void tui_blsettingmenu(void) { uint8_t sel = 0; for(;;) { sel = tui_gen_listmenu((PGM_P)tui_blsm_name, tui_blsm_table, 5, sel); switch (sel) { case 0: { uint8_t v = tui_gen_nummenu((PGM_P)tui_blsm_s1, 0, 16, backlight_get()); backlight_set(v); } break; case 1: { uint8_t v = tui_gen_nummenu((PGM_P)tui_blsm_s2, 0, backlight_get(), backlight_get_dv()); backlight_set_dv(v); } break; case 2: { uint8_t v = tui_gen_nummenu((PGM_P)tui_blsm_s3, 1, 255, backlight_get_to()); backlight_set_to(v); } break; case 3: tui_contrast_set_util(); break; default: return; } } }
static void handle_control_message(struct lfd_control_message *msg, int s) { int ret = 0; switch (msg->command) { case LFD_COMMAND_GET_VOLUME: msg->payload = sound_get_volume(); msg->command |= LFD_RESPONSE; break; case LFD_COMMAND_SET_VOLUME: sound_set_volume(msg->payload); break; case LFD_COMMAND_GET_BACKLIGHT: msg->payload = backlight_get(); msg->command |= LFD_RESPONSE; break; case LFD_COMMAND_SET_BACKLIGHT: backlight_set(msg->payload); break; case LFD_COMMAND_SET_BACKLIGHT_NEXT: backlight_next(); break; case LFD_COMMAND_SET_RTC_TO_SYSTIME: time_set_rtc(); break; case LFD_COMMAND_GET_BATTERY_MV: msg->payload = mv; msg->command |= LFD_RESPONSE; break; default: dbprintf("unknown LFD command: 0x%X\n", msg->command); return; }; if (msg->command & LFD_RESPONSE) { ret = send(s, msg, sizeof(*msg), MSG_NOSIGNAL); if (ret < 0) dbprintf("can't send response\n"); } }
long backlight_get_actual_brightness(struct backlight *backlight) { return backlight_get(backlight, "actual_brightness"); }
long backlight_get_max_brightness(struct backlight *backlight) { return backlight_get(backlight, "max_brightness"); }