A file-browser/include/gui_list_pheripherals.h => file-browser/include/gui_list_pheripherals.h +9 -0
@@ 0,0 1,9 @@
+#ifndef __GUI_LIST_PHERIPHERALS_H__
+#define __GUI_LIST_PHERIPHERALS_H__
+
+#include "mzapo_pheripherals.h"
+#include "gui.h"
+
+void gui_list_ledstrip_update(container_t *container, mzapo_pheripherals_t *pheripherals);
+
+#endif // __GUI_LIST_PHERIPHERALS_H__
A file-browser/src/gui_list_pheripherals.c => file-browser/src/gui_list_pheripherals.c +17 -0
@@ 0,0 1,17 @@
+#include "gui_list_pheripherals.h"
+#include "gui.h"
+#include "mzapo_led_strip.h"
+#include <stdint.h>
+
+#define LIST_LEDSTRIP_AROUND 1
+
+void gui_list_ledstrip_update(container_t *container,
+ mzapo_pheripherals_t *pheripherals) {
+ uint32_t selected_index = gui_list_get_selected_index(container);
+ uint32_t items_count = gui_list_get_items_count(container);
+
+ double perc = (double)selected_index/items_count;
+
+ uint32_t index = LED_STRIP_COUNT * perc;
+ ledstrip_turn_on(pheripherals->ledstrip, index, LIST_LEDSTRIP_AROUND);
+}
M file-browser/src/main.c => file-browser/src/main.c +3 -0
@@ 138,6 138,9 @@ int main(int argc, char *argv[]) {
"Closing application");
file_browser_destroy(&file_browser);
+ rgb_led_clear(pheripherals.rgb_leds, LED_LEFT);
+ rgb_led_clear(pheripherals.rgb_leds, LED_RIGHT);
+ ledstrip_clear(pheripherals.ledstrip);
display_deinit(&display);
file_set_blocking(STDIN_FILENO, &oldstdin);
M file-browser/src/window_browser.c => file-browser/src/window_browser.c +9 -0
@@ 9,9 9,11 @@
#include "gui_container_info.h"
#include "gui_list_commands.h"
#include "gui_component_line.h"
+#include "gui_list_pheripherals.h"
#include "gui_window_info.h"
#include "input.h"
#include "logger.h"
+#include "mzapo_rgb_led.h"
#include "path.h"
#include "renderer.h"
#include "keyboard_const.h"
@@ 242,6 244,11 @@ static void browser_window_item_clicked(container_t *container, void *state,
"Successfully returned without executing anything.");
}
} else if (current_file.type == FT_FOLDER || current_file.type == FT_OTHER) {
+ rgb_led_set_timeout(bstate->gui->pheripherals->rgb_leds, LED_LEFT, 0, 100,
+ 100, 300);
+ rgb_led_set_timeout(bstate->gui->pheripherals->rgb_leds, LED_RIGHT, 0, 100,
+ 100, 300);
+
char new_dir_path[path_join_memory_size(bstate->current_directory->path, current_file.name)];
path_join(bstate->current_directory->path, current_file.name, new_dir_path);
@@ 333,6 340,8 @@ static void browser_window_job(void *state) {
gui_list_container_set_item_height(bstate->list_container,
bstate->font->size);
+ gui_list_ledstrip_update(bstate->list_container, bstate->gui->pheripherals);
+
if (!bstate->running) {
// cleanup
fileaccess_directory_close(bstate->state, bstate->current_directory);