diff --git a/application.fam b/application.fam index 365d2491232..787bd60d5cd 100644 --- a/application.fam +++ b/application.fam @@ -1,12 +1,12 @@ App( - appid="gpioreader", - name="GPIO Reader", + appid="gpioreader2", + name="[GPIO] Input Reader 2", apptype=FlipperAppType.EXTERNAL, entry_point="gpio_app", - cdefines=["APP_GPIOREADER"], requires=["gui"], stack_size=1 * 1024, order=50, - fap_libs=["assets"], fap_category="GPIO", + fap_icon="icon.png", + fap_icon_assets="icons", ) diff --git a/gpio_app_i.h b/gpio_app_i.h index 52f76949d8b..0023d1e508d 100644 --- a/gpio_app_i.h +++ b/gpio_app_i.h @@ -16,7 +16,7 @@ #include "views/gpio_test.h" #include "views/gpio_reader.h" #include "views/gpio_usb_uart.h" -#include +#include struct GpioApp { Gui* gui; diff --git a/gpio_item.c b/gpio_item.c index f516bd25875..4d7f056ba2f 100644 --- a/gpio_item.c +++ b/gpio_item.c @@ -26,7 +26,7 @@ void gpio_item_configure_pin(uint8_t index, GpioMode mode, GpioPull pull) { void gpio_item_configure_all_pins(GpioMode mode) { GpioPull pull = GpioPullNo; - if(mode == GpioModeInput){ + if(mode == GpioModeInput) { pull = GpioPullDown; } for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) { diff --git a/icon.png b/icon.png new file mode 100644 index 00000000000..201d033e74e Binary files /dev/null and b/icon.png differ diff --git a/icons/ActiveConnection_50x64.png b/icons/ActiveConnection_50x64.png new file mode 100644 index 00000000000..1d7686dddf8 Binary files /dev/null and b/icons/ActiveConnection_50x64.png differ diff --git a/icons/ArrowUpEmpty_14x15.png b/icons/ArrowUpEmpty_14x15.png new file mode 100644 index 00000000000..261c6d89e3c Binary files /dev/null and b/icons/ArrowUpEmpty_14x15.png differ diff --git a/icons/ArrowUpFilled_14x15.png b/icons/ArrowUpFilled_14x15.png new file mode 100644 index 00000000000..fa35eb2f827 Binary files /dev/null and b/icons/ArrowUpFilled_14x15.png differ diff --git a/img/1.png b/img/1.png new file mode 100644 index 00000000000..31950f5a2f6 Binary files /dev/null and b/img/1.png differ diff --git a/img/2.png b/img/2.png new file mode 100644 index 00000000000..b6846aa0411 Binary files /dev/null and b/img/2.png differ diff --git a/scenes/gpio_scene_start.c b/scenes/gpio_scene_start.c index 71ddd659320..19d0173fa04 100644 --- a/scenes/gpio_scene_start.c +++ b/scenes/gpio_scene_start.c @@ -56,7 +56,7 @@ void gpio_scene_start_on_enter(void* context) { variable_item_list_add(var_item_list, "USB-UART Bridge", 0, NULL, NULL); variable_item_list_add(var_item_list, "GPIO Manual Control", 0, NULL, NULL); - + variable_item_list_add(var_item_list, "GPIO Manual Read", 0, NULL, NULL); item = variable_item_list_add( @@ -97,7 +97,7 @@ bool gpio_scene_start_on_event(void* context, SceneManagerEvent event) { } else if(event.event == GpioStartEventUsbUart) { scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemUsbUart); if(!furi_hal_usb_is_locked()) { - DOLPHIN_DEED(DolphinDeedGpioUartBridge); + dolphin_deed(DolphinDeedGpioUartBridge); scene_manager_next_scene(app->scene_manager, GpioSceneUsbUart); } else { scene_manager_next_scene(app->scene_manager, GpioSceneUsbUartCloseRpc); diff --git a/views/gpio_reader.c b/views/gpio_reader.c index 95a425fda1c..4b3a18f8e41 100644 --- a/views/gpio_reader.c +++ b/views/gpio_reader.c @@ -26,32 +26,25 @@ static void gpio_reader_draw_callback(Canvas* canvas, void* _model) { canvas_set_font(canvas, FontSecondary); elements_multiline_text_aligned( canvas, 64, 16, AlignCenter, AlignTop, "A7 A6 A4 B3 B2 C3 C1 C0"); - elements_multiline_text_aligned( - canvas, 64, 40, AlignCenter, AlignTop, "Pull Up"); + elements_multiline_text_aligned(canvas, 64, 40, AlignCenter, AlignTop, "Pull Up"); int charOffset = 10; for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) { bool high = gpio_item_get_pin(i); if(high) { - elements_multiline_text_aligned( - canvas, charOffset, 25, AlignCenter, AlignTop, "1"); + elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "1"); } else { - elements_multiline_text_aligned( - canvas, charOffset, 25, AlignCenter, AlignTop, "0"); + elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "0"); } - + if(model->pullUp[i]) { - elements_multiline_text_aligned( - canvas, charOffset, 50, AlignCenter, AlignTop, "1"); + elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "1"); } else { - elements_multiline_text_aligned( - canvas, charOffset, 50, AlignCenter, AlignTop, "0"); + elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "0"); } if(i == model->pin_idx) { - elements_multiline_text_aligned( - canvas, charOffset, 53, AlignCenter, AlignTop, "_"); + elements_multiline_text_aligned(canvas, charOffset, 53, AlignCenter, AlignTop, "_"); } - charOffset += 16; } //~ free(charOffset); @@ -93,7 +86,7 @@ static bool gpio_reader_process_right(GpioReader* gpio_reader) { gpio_reader->view, GpioReaderModel * model, { - if(model->pin_idx < GPIO_ITEM_COUNT-1) { + if(model->pin_idx < GPIO_ITEM_COUNT - 1) { model->pin_idx++; } }, @@ -109,11 +102,11 @@ static bool gpio_reader_process_ok(GpioReader* gpio_reader, InputEvent* event) { GpioReaderModel * model, { if(event->type == InputTypePress) { - if(model->pullUp[model->pin_idx]){ + if(model->pullUp[model->pin_idx]) { gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullDown); model->pullUp[model->pin_idx] = 0; consumed = true; - }else{ + } else { gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullUp); model->pullUp[model->pin_idx] = 1; consumed = true; @@ -149,7 +142,10 @@ View* gpio_reader_get_view(GpioReader* gpio_reader) { return gpio_reader->view; } -void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context) { +void gpio_reader_set_ok_callback( + GpioReader* gpio_reader, + GpioReaderOkCallback callback, + void* context) { furi_assert(gpio_reader); furi_assert(callback); with_view_model( diff --git a/views/gpio_reader.h b/views/gpio_reader.h index d027d013887..a59618d57ca 100644 --- a/views/gpio_reader.h +++ b/views/gpio_reader.h @@ -11,4 +11,7 @@ void gpio_reader_free(GpioReader* gpio_reader); View* gpio_reader_get_view(GpioReader* gpio_reader); -void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context); +void gpio_reader_set_ok_callback( + GpioReader* gpio_reader, + GpioReaderOkCallback callback, + void* context);