scope_app_i.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #include "scenes/scope_types.h"
  3. #include "scenes/scope_scene.h"
  4. #include <gui/gui.h>
  5. #include <gui/view_dispatcher.h>
  6. #include <gui/scene_manager.h>
  7. #include <gui/modules/submenu.h>
  8. #include <gui/modules/variable_item_list.h>
  9. #include <gui/modules/widget.h>
  10. #include <gui/modules/text_input.h>
  11. #include <notification/notification_messages.h>
  12. #define ADC_CONVERTED_DATA_BUFFER_SIZE ((uint32_t)128)
  13. #define FLIPPERSCOPE_APP_EXTENSION ".dat"
  14. #define MAX_LEN_NAME 30
  15. typedef struct ScopeApp ScopeApp;
  16. typedef struct {
  17. double time;
  18. char* str;
  19. } timeperiod;
  20. static const timeperiod time_list[] =
  21. {{1.0, "1s"}, {0.1, "0.1s"}, {1e-3, "1ms"}, {0.1e-3, "0.1ms"}, {1e-6, "1us"}};
  22. typedef struct {
  23. int window;
  24. char* str;
  25. } fftwindow;
  26. static const fftwindow fft_list[] = {{256, "256"}, {512, "512"}, {1024, "1024"}};
  27. typedef struct {
  28. float scale;
  29. char* str;
  30. } scalesize;
  31. static const scalesize scale_list[] =
  32. {{1.0f, "1x"}, {2.0f, "2x"}, {4.0f, "4x"}, {10.0f, "10x"}, {100.0f, "100x"}};
  33. enum measureenum {
  34. m_time,
  35. m_voltage,
  36. m_capture,
  37. m_fft
  38. };
  39. typedef struct {
  40. enum measureenum type;
  41. char* str;
  42. } measurement;
  43. static const measurement measurement_list[] =
  44. {{m_time, "Time"}, {m_voltage, "Voltage"}, {m_capture, "Capture"}, {m_fft, "FFT"}};
  45. struct ScopeApp {
  46. Gui* gui;
  47. ViewDispatcher* view_dispatcher;
  48. SceneManager* scene_manager;
  49. NotificationApp* notifications;
  50. VariableItemList* variable_item_list;
  51. Submenu* submenu;
  52. Widget* widget;
  53. TextInput* text_input;
  54. double time;
  55. int fft;
  56. float scale;
  57. enum measureenum measurement;
  58. char file_name_tmp[MAX_LEN_NAME];
  59. uint16_t* data;
  60. };
  61. enum ScopeCustomEvent {
  62. ScopeCustomEventTextInputDone,
  63. };