lightmeter.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <stream/stream.h>
  5. #include <flipper_format/flipper_format_i.h>
  6. #include <gui/gui.h>
  7. #include <gui/view.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/scene_manager.h>
  10. #include "gui/views/main_view.h"
  11. #include <gui/modules/widget.h>
  12. #include <gui/modules/variable_item_list.h>
  13. #include "gui/scenes/config/lightmeter_scene.h"
  14. #include <notification/notification_messages.h>
  15. #include "lightmeter_config.h"
  16. #include <BH1750.h>
  17. #include <MAX44009.h>
  18. #define APP_PATH_DIR STORAGE_APP_DATA_PATH_PREFIX
  19. #define APP_PATH_CFG "config.txt"
  20. typedef struct {
  21. int32_t iso;
  22. int32_t nd;
  23. int32_t aperture;
  24. int32_t dome;
  25. int32_t backlight;
  26. int32_t lux_only;
  27. int32_t sensor_type;
  28. int32_t measurement_resolution;
  29. int32_t device_addr;
  30. } LightMeterConfig;
  31. typedef struct {
  32. Gui* gui;
  33. SceneManager* scene_manager;
  34. ViewDispatcher* view_dispatcher;
  35. MainView* main_view;
  36. VariableItemList* var_item_list;
  37. VariableItem* var_item_addr;
  38. LightMeterConfig* config;
  39. NotificationApp* notifications;
  40. Widget* widget;
  41. Storage* storage;
  42. FuriString* cfg_path;
  43. } LightMeterApp;
  44. typedef enum {
  45. LightMeterAppViewMainView,
  46. LightMeterAppViewConfigView,
  47. LightMeterAppViewVarItemList,
  48. LightMeterAppViewAbout,
  49. LightMeterAppViewHelp,
  50. } LightMeterAppView;
  51. typedef enum {
  52. LightMeterAppCustomEventReset,
  53. LightMeterAppCustomEventConfig,
  54. LightMeterAppCustomEventHelp,
  55. LightMeterAppCustomEventAbout,
  56. } LightMeterAppCustomEvent;
  57. void lightmeter_app_set_config(LightMeterApp* context, LightMeterConfig* config);
  58. void lightmeter_app_i2c_init_sensor(LightMeterApp* context);
  59. void lightmeter_app_i2c_deinit_sensor(LightMeterApp* context);
  60. void lightmeter_app_i2c_callback(LightMeterApp* context);
  61. void lightmeter_app_reset_callback(LightMeterApp* context);