flip_trader_e.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef FLIP_TRADE_E_H
  2. #define FLIP_TRADE_E_H
  3. #include <flipper_http.h>
  4. #include <easy_flipper.h>
  5. #include <furi.h>
  6. #include <furi_hal.h>
  7. #include <gui/gui.h>
  8. #include <gui/view.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/view_dispatcher.h>
  11. #include <notification/notification.h>
  12. #include <dialogs/dialogs.h>
  13. #include <jsmn.h>
  14. #define TAG "FlipTrader"
  15. // Define the submenu items for our FlipTrader application
  16. typedef enum
  17. {
  18. // FlipTraderSubmenuIndexMain, // Click to run get the info of the selected pair
  19. FlipTradeSubmenuIndexAssets, // Click to view the assets screen (ETHUSD, BTCUSD, etc.)
  20. FlipTraderSubmenuIndexAbout, // Click to view the about screen
  21. FlipTraderSubmenuIndexSettings, // Click to view the WiFi settings screen
  22. //
  23. FlipTraderSubmenuIndexAssetStartIndex, // Start of the submenu items for the assets
  24. } FlipTraderSubmenuIndex;
  25. // Define a single view for our FlipTrader application
  26. typedef enum
  27. {
  28. FlipTraderViewMain, // The screen that displays the info of the selected pair
  29. FlipTraderViewMainSubmenu, // The main submenu of the FlipTrader app
  30. FlipTraderViewAbout, // The about screen
  31. FlipTraderViewWiFiSettings, // The WiFi settings screen
  32. FlipTraderViewTextInputSSID, // The text input screen for the SSID
  33. FlipTraderViewTextInputPassword, // The text input screen for the password
  34. //
  35. FlipTraderViewAssetsSubmenu, // The submenu for the assets
  36. } FlipTraderView;
  37. // Each screen will have its own view
  38. typedef struct
  39. {
  40. ViewDispatcher *view_dispatcher; // Switches between our views
  41. View *view_main; // The main screen that displays "Hello, World!"
  42. Submenu *submenu_main; // The submenu
  43. Submenu *submenu_assets; // The submenu for the assets
  44. Widget *widget; // The widget
  45. VariableItemList *variable_item_list_wifi; // The variable item list (settngs)
  46. VariableItem *variable_item_ssid; // The variable item for the SSID
  47. VariableItem *variable_item_password; // The variable item for the password
  48. UART_TextInput *uart_text_input_ssid; // The text input for the SSID
  49. UART_TextInput *uart_text_input_password; // The text input for the password
  50. char *uart_text_input_buffer_ssid; // Buffer for the text input (SSID)
  51. char *uart_text_input_temp_buffer_ssid; // Temporary buffer for the text input (SSID)
  52. uint32_t uart_text_input_buffer_size_ssid; // Size of the text input buffer (SSID)
  53. char *uart_text_input_buffer_password; // Buffer for the text input (password)
  54. char *uart_text_input_temp_buffer_password; // Temporary buffer for the text input (password)
  55. uint32_t uart_text_input_buffer_size_password; // Size of the text input buffer (password)
  56. } FlipTraderApp;
  57. static char *asset_names[] = {
  58. // Crypto pairs
  59. "ETHUSD",
  60. "BTCUSD",
  61. // Stocks (will add mroe later)
  62. "AAPL",
  63. "AMZN",
  64. "GOOGL",
  65. "MSFT",
  66. "TSLA",
  67. "NFLX",
  68. "META",
  69. "NVDA",
  70. "AMD",
  71. // Forex pairs
  72. "EURUSD",
  73. "GBPUSD",
  74. "AUDUSD",
  75. "NZDUSD",
  76. "XAUUSD",
  77. "USDJPY",
  78. "USDCHF",
  79. "USDCAD",
  80. "EURJPY",
  81. "EURGBP",
  82. "EURCHF",
  83. "EURCAD",
  84. "EURAUD",
  85. "EURNZD",
  86. "AUDJPY",
  87. "AUDCHF",
  88. "AUDCAD",
  89. "NZDJPY",
  90. "NZDCHF",
  91. "NZDCAD",
  92. "GBPJPY",
  93. "GBPCHF",
  94. "GBPCAD",
  95. "CHFJPY",
  96. "CADJPY",
  97. "CADCHF",
  98. "GBPAUD",
  99. "GBPNZD",
  100. "AUDNZD",
  101. };
  102. // index
  103. static uint32_t asset_index = 0;
  104. #endif // FLIP_TRADE_E_H