Просмотр исходного кода

now suspends UART on app exit and resumes on enter, and added success noise back

frux-c 2 лет назад
Родитель
Сommit
68d639a81a
2 измененных файлов с 11 добавлено и 9 удалено
  1. 7 0
      scenes/uhf_scene_read_tag_success.c
  2. 4 9
      uhf_app.c

+ 7 - 0
scenes/uhf_scene_read_tag_success.c

@@ -1,4 +1,5 @@
 #include "../uhf_app_i.h"
+#include <dolphin/dolphin.h>
 
 void uhf_read_tag_success_worker_callback(UHFWorkerEvent event, void* ctx) {
     UNUSED(event);
@@ -17,6 +18,12 @@ void uhf_scene_read_card_success_widget_callback(GuiButtonType result, InputType
 void uhf_scene_read_tag_success_on_enter(void* ctx) {
     UHFApp* uhf_app = ctx;
     UHFTag* uhf_tag = uhf_app->worker->uhf_tag;
+
+    dolphin_deed(DolphinDeedNfcReadSuccess);
+
+    // Send notification
+    notification_message(uhf_app->notifications, &sequence_success);
+
     widget_add_string_element(
         uhf_app->widget, 32, 5, AlignLeft, AlignCenter, FontPrimary, "Read Success");
 

+ 4 - 9
uhf_app.c

@@ -1,12 +1,5 @@
 #include "uhf_app_i.h"
 
-// empty callback
-void empty_rx_callback(UartIrqEvent event, uint8_t data, void* ctx) {
-    UNUSED(event);
-    UNUSED(data);
-    UNUSED(ctx);
-}
-
 char* convertToHexString(const uint8_t* array, size_t length) {
     if(array == NULL || length == 0) {
         return " ";
@@ -191,16 +184,18 @@ int32_t uhf_app_main(void* ctx) {
     UNUSED(ctx);
     UHFApp* uhf_app = uhf_alloc();
 
+    furi_hal_uart_resume(FuriHalUartIdUSART1);
+
     // enable 5v pin
     furi_hal_power_enable_otg();
+
     scene_manager_next_scene(uhf_app->scene_manager, UHFSceneVerify);
     view_dispatcher_run(uhf_app->view_dispatcher);
 
     // disable 5v pin
     furi_hal_power_disable_otg();
 
-    // set uart callback to none
-    furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, empty_rx_callback, NULL);
+    furi_hal_uart_suspend(FuriHalUartIdUSART1);
 
     // exit app
     uhf_free(uhf_app);