scope_app_i.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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[] =
  27. {{256, "256"}, {512, "512"}, {1024, "1024"}};
  28. typedef struct {
  29. float scale;
  30. char* str;
  31. } scalesize;
  32. static const scalesize scale_list[] =
  33. {{1.0f, "1x"}, {2.0f, "2x"}, {4.0f, "4x"}, {10.0f, "10x"}, {100.0f, "100x"}};
  34. enum measureenum { m_time, m_voltage, m_capture, m_fft};
  35. typedef struct {
  36. enum measureenum type;
  37. char* str;
  38. } measurement;
  39. static const measurement measurement_list[] = {
  40. {m_time, "Time"},
  41. {m_voltage, "Voltage"},
  42. {m_capture, "Capture"},
  43. {m_fft, "FFT"}};
  44. struct ScopeApp {
  45. Gui* gui;
  46. ViewDispatcher* view_dispatcher;
  47. SceneManager* scene_manager;
  48. NotificationApp* notifications;
  49. VariableItemList* variable_item_list;
  50. Submenu* submenu;
  51. Widget* widget;
  52. TextInput* text_input;
  53. double time;
  54. int fft;
  55. float scale;
  56. enum measureenum measurement;
  57. char file_name_tmp[MAX_LEN_NAME];
  58. uint16_t* data;
  59. };
  60. enum ScopeCustomEvent {
  61. ScopeCustomEventTextInputDone,
  62. };