MX 2 лет назад
Родитель
Сommit
57c69dadc7
7 измененных файлов с 21 добавлено и 4 удалено
  1. 1 1
      README.md
  2. 1 0
      application.fam
  3. BIN
      icons/pause_10x10.png
  4. BIN
      icons/play_10x10.png
  5. 3 1
      scenes/scope_scene_about.c
  6. 14 0
      scenes/scope_scene_run.c
  7. 2 2
      scope_app_i.h

+ 1 - 1
README.md

@@ -10,7 +10,7 @@ cd ..
 ./fbt launch_app APPSRC=applications_user/flipperscope
 ```
 
-Alternatively upload the **scope.fap** file in the binary folder of this repository to your flipper zero.
+Alternatively the binary can now be installed from https://lab.flipper.net/apps/flipperscope or the Flipper Mobile App.
 
 Provide signal to **pin 16/PC0**, with a voltage ranging from 0V to 2.5V and ground to **pin 18/GND**.
 

+ 1 - 0
application.fam

@@ -8,6 +8,7 @@ App(
     stack_size=1 * 1024,
     fap_category="GPIO",
     fap_icon="scope_10px.png",
+    fap_icon_assets="icons",
     fap_version="0.1",
     fap_description="Oscilloscope application - apply signal to pin 16/PC0, with a voltage ranging from 0V to 2.5V and ground to pin 18/GND",
 )

BIN
icons/pause_10x10.png


BIN
icons/play_10x10.png


+ 3 - 1
scenes/scope_scene_about.c

@@ -13,7 +13,9 @@ void scope_scene_about_on_enter(void* context) {
     FuriString* temp_str;
     temp_str = furi_string_alloc();
     furi_string_printf(temp_str, "\e#%s\n", "Information");
-    furi_string_cat_printf(temp_str, "Provide signal to pin 16/PC0, with a voltage ranging from 0V to 2.5V and ground to pin 18/GND.\n\n");
+    furi_string_cat_printf(
+        temp_str,
+        "Provide signal to pin 16/PC0, with a voltage ranging from 0V to 2.5V and ground to pin 18/GND.\n\n");
     furi_string_cat_printf(temp_str, "Developed by: %s\n", S_DEVELOPED);
     furi_string_cat_printf(temp_str, "Github: %s\n\n", S_GITHUB);
 

+ 14 - 0
scenes/scope_scene_run.c

@@ -24,6 +24,7 @@
 #include "stm32wbxx_ll_gpio.h"
 
 #include "../scope_app_i.h"
+#include "flipperscope_icons.h"
 
 #define DIGITAL_SCALE_12BITS ((uint32_t)0xFFF)
 #define ADC_CONVERTED_DATA_BUFFER_SIZE ((uint32_t)128)
@@ -352,6 +353,11 @@ static void app_draw_callback(Canvas* canvas, void* ctx) {
     float min = FLT_MAX;
     int count = 0;
 
+    if(pause)
+        canvas_draw_icon(canvas, 115, 0, &I_pause_10x10);
+    else
+        canvas_draw_icon(canvas, 115, 0, &I_play_10x10);
+
     // Calculate voltage measurements
     for(uint32_t x = 0; x < ADC_CONVERTED_DATA_BUFFER_SIZE; x++) {
         if(mvoltDisplay[x] < min) min = mvoltDisplay[x];
@@ -454,6 +460,10 @@ void scope_scene_run_on_enter(void* context) {
     // What type of measurement are we performing
     type = app->measurement;
 
+    // Pause capture, when first started, if capturing
+    if(type == m_capture)
+        pause = 1;
+
     // Copy vector table, modify to use our own IRQ handlers
     __disable_irq();
     memcpy(ramVector, (uint32_t*)(FLASH_BASE | SCB->VTOR), sizeof(uint32_t) * TABLE_SIZE);
@@ -534,6 +544,10 @@ void scope_scene_run_on_enter(void* context) {
 
     furi_hal_bus_disable(FuriHalBusTIM2);
 
+    // Disable ADC interrupt and timer
+    LL_ADC_DisableIT_OVR(ADC1);
+    LL_TIM_DisableCounter(TIM2);
+
     // Stop DMA and switch back to original vector table
     LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_1);
 

+ 2 - 2
scope_app_i.h

@@ -21,14 +21,14 @@ typedef struct {
 static const timeperiod time_list[] =
     {{1.0, "1s"}, {0.1, "0.1s"}, {1e-3, "1ms"}, {0.1e-3, "0.1ms"}, {1e-6, "1us"}};
 
-enum measureenum { m_time, m_voltage };
+enum measureenum { m_time, m_voltage, m_capture };
 
 typedef struct {
     enum measureenum type;
     char* str;
 } measurement;
 
-static const measurement measurement_list[] = {{m_time, "Time"}, {m_voltage, "Voltage"}};
+static const measurement measurement_list[] = {{m_time, "Time"}, {m_voltage, "Voltage"}, {m_capture, "Capture"}};
 
 struct ScopeApp {
     Gui* gui;