camera_suite_view_style_1.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "../helpers/camera_suite_custom_event.h"
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <furi_hal_console.h>
  5. #include <furi_hal_uart.h>
  6. #include <gui/elements.h>
  7. #include <gui/gui.h>
  8. #include <gui/icon_i.h>
  9. #include <gui/modules/dialog_ex.h>
  10. #include <gui/view.h>
  11. #include <gui/view_dispatcher.h>
  12. #include <notification/notification.h>
  13. #include <notification/notification_messages.h>
  14. #include <storage/filesystem_api_defines.h>
  15. #include <storage/storage.h>
  16. #pragma once
  17. #define FRAME_WIDTH 128
  18. #define FRAME_HEIGHT 64
  19. #define FRAME_BIT_DEPTH 1
  20. #define FRAME_BUFFER_LENGTH \
  21. (FRAME_WIDTH * FRAME_HEIGHT * FRAME_BIT_DEPTH / 8) // 128*64*1 / 8 = 1024
  22. #define ROW_BUFFER_LENGTH (FRAME_WIDTH / 8) // 128/8 = 16
  23. #define RING_BUFFER_LENGTH (ROW_BUFFER_LENGTH + 3) // ROW_BUFFER_LENGTH + Header => 16 + 3 = 19
  24. #define LAST_ROW_INDEX (FRAME_BUFFER_LENGTH - ROW_BUFFER_LENGTH) // 1024 - 16 = 1008
  25. // const uint8_t _I_DolphinCommon_56x48_0[] = {
  26. // 0x01, 0x00, 0xdf, 0x00, 0x00, 0x1f, 0xfe, 0x0e, 0x05, 0x3f, 0x04, 0x06, 0x78, 0x06, 0x30, 0x20,
  27. // 0xf8, 0x00, 0xc6, 0x12, 0x1c, 0x04, 0x0c, 0x0a, 0x38, 0x08, 0x08, 0x0c, 0x60, 0xc0, 0x21, 0xe0,
  28. // 0x04, 0x0a, 0x18, 0x02, 0x1b, 0x00, 0x18, 0xa3, 0x00, 0x21, 0x90, 0x01, 0x8a, 0x20, 0x02, 0x19,
  29. // 0x80, 0x18, 0x80, 0x64, 0x09, 0x20, 0x89, 0x81, 0x8c, 0x3e, 0x41, 0xe2, 0x80, 0x50, 0x00, 0x43,
  30. // 0x08, 0x01, 0x0c, 0xfc, 0x68, 0x40, 0x61, 0xc0, 0x50, 0x30, 0x00, 0x63, 0xa0, 0x7f, 0x80, 0xc4,
  31. // 0x41, 0x19, 0x07, 0xff, 0x02, 0x06, 0x18, 0x24, 0x03, 0x41, 0xf3, 0x2b, 0x10, 0x19, 0x38, 0x10,
  32. // 0x30, 0x31, 0x7f, 0xe0, 0x34, 0x08, 0x30, 0x19, 0x60, 0x80, 0x65, 0x86, 0x0a, 0x4c, 0x0c, 0x30,
  33. // 0x81, 0xb9, 0x41, 0xa0, 0x54, 0x08, 0xc7, 0xe2, 0x06, 0x8a, 0x18, 0x25, 0x02, 0x21, 0x0f, 0x19,
  34. // 0x88, 0xd8, 0x6e, 0x1b, 0x01, 0xd1, 0x1b, 0x86, 0x39, 0x66, 0x3a, 0xa4, 0x1a, 0x50, 0x06, 0x48,
  35. // 0x18, 0x18, 0xd0, 0x03, 0x01, 0x41, 0x98, 0xcc, 0x60, 0x39, 0x01, 0x49, 0x2d, 0x06, 0x03, 0x50,
  36. // 0xf8, 0x40, 0x3e, 0x02, 0xc1, 0x82, 0x86, 0xc7, 0xfe, 0x0f, 0x28, 0x2c, 0x91, 0xd2, 0x90, 0x9a,
  37. // 0x18, 0x19, 0x3e, 0x6d, 0x73, 0x12, 0x16, 0x00, 0x32, 0x49, 0x72, 0xc0, 0x7e, 0x5d, 0x44, 0xba,
  38. // 0x2c, 0x08, 0xa4, 0xc8, 0x82, 0x06, 0x17, 0xe0, 0x81, 0x90, 0x2a, 0x40, 0x61, 0xe1, 0xa2, 0x44,
  39. // 0x0c, 0x76, 0x2b, 0xe8, 0x89, 0x26, 0x43, 0x83, 0x31, 0x8c, 0x78, 0x0c, 0xb0, 0x48, 0x10, 0x1a,
  40. // 0xe0, 0x00, 0x63,
  41. // };
  42. // const uint8_t* const _I_DolphinCommon_56x48[] = {_I_DolphinCommon_56x48_0};
  43. // const Icon I_DolphinCommon_56x48 = {
  44. // .width = 56,
  45. // .height = 48,
  46. // .frame_count = 1,
  47. // .frame_rate = 0,
  48. // .frames = _I_DolphinCommon_56x48};
  49. typedef struct UartDumpModel UartDumpModel;
  50. struct UartDumpModel {
  51. bool initialized;
  52. int rotation_angle;
  53. uint8_t pixels[FRAME_BUFFER_LENGTH];
  54. uint8_t ringbuffer_index;
  55. uint8_t row_ringbuffer[RING_BUFFER_LENGTH];
  56. };
  57. typedef struct CameraSuiteViewStyle1 CameraSuiteViewStyle1;
  58. typedef void (*CameraSuiteViewStyle1Callback)(CameraSuiteCustomEvent event, void* context);
  59. void camera_suite_view_style_1_set_callback(
  60. CameraSuiteViewStyle1* camera_suite_view_style_1,
  61. CameraSuiteViewStyle1Callback callback,
  62. void* context);
  63. CameraSuiteViewStyle1* camera_suite_view_style_1_alloc();
  64. void camera_suite_view_style_1_free(CameraSuiteViewStyle1* camera_suite_static);
  65. View* camera_suite_view_style_1_get_view(CameraSuiteViewStyle1* camera_suite_static);
  66. typedef enum {
  67. // Reserved for StreamBuffer internal event
  68. WorkerEventReserved = (1 << 0),
  69. WorkerEventStop = (1 << 1),
  70. WorkerEventRx = (1 << 2),
  71. } WorkerEventFlags;
  72. #define WORKER_EVENTS_MASK (WorkerEventStop | WorkerEventRx)