applications.c 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. #include "applications.h"
  2. // Services and apps decalartion
  3. int32_t application_vertical_screen(void* p);
  4. int32_t irda_monitor_app(void* p);
  5. int32_t flipper_test_app(void* p);
  6. int32_t application_blink(void* p);
  7. int32_t application_uart_write(void* p);
  8. int32_t application_input_dump(void* p);
  9. int32_t u8g2_example(void* p);
  10. int32_t input_task(void* p);
  11. int32_t menu_task(void* p);
  12. int32_t coreglitch_demo_0(void* p);
  13. int32_t u8g2_qrcode(void* p);
  14. int32_t gui_task(void* p);
  15. int32_t irda(void* p);
  16. int32_t loader(void* p);
  17. int32_t nfc_task(void* p);
  18. int32_t dolphin_task(void* p);
  19. int32_t power_task(void* p);
  20. int32_t bt_task(void* p);
  21. int32_t application_vibro(void* p);
  22. int32_t app_gpio_test(void* p);
  23. int32_t app_ibutton(void* p);
  24. int32_t cli_task(void* p);
  25. int32_t music_player(void* p);
  26. int32_t sdnfc(void* p);
  27. int32_t subghz_app(void* p);
  28. int32_t gui_test(void* p);
  29. int32_t keypad_test(void* p);
  30. int32_t scene_app(void* p);
  31. int32_t passport(void* p);
  32. int32_t app_accessor(void* p);
  33. int32_t app_archive(void* p);
  34. int32_t notification_app(void* p);
  35. int32_t scened_app(void* p);
  36. int32_t lfrfid_app(void* p);
  37. int32_t lfrfid_debug_app(void* p);
  38. int32_t storage_app(void* p);
  39. int32_t storage_app_test(void* p);
  40. int32_t dialogs_app(void* p);
  41. int32_t power_observer(void* p);
  42. // On system start hooks declaration
  43. void irda_cli_init();
  44. void nfc_cli_init();
  45. void subghz_cli_init();
  46. void bt_cli_init();
  47. void lfrfid_cli_init();
  48. void ibutton_cli_init();
  49. void storage_cli_init();
  50. // Settings
  51. int32_t notification_app_settings(void* p);
  52. int32_t storage_settings(void* p);
  53. const FlipperApplication FLIPPER_SERVICES[] = {
  54. #ifdef SRV_CLI
  55. {.app = cli_task, .name = "cli_task", .stack_size = 4096, .icon = &A_Plugins_14},
  56. #endif
  57. #ifdef SRV_EXAMPLE_BLINK
  58. {.app = application_blink, .name = "blink", .stack_size = 1024, .icon = &A_Plugins_14},
  59. #endif
  60. #ifdef SRV_INPUT
  61. {.app = input_task, .name = "input_task", .stack_size = 1024, .icon = &A_Plugins_14},
  62. #endif
  63. #ifdef SRV_EXAMPLE_INPUT_DUMP
  64. {.app = application_input_dump,
  65. .name = "input dump",
  66. .stack_size = 1024,
  67. .icon = &A_Plugins_14},
  68. #endif
  69. #ifdef SRV_GUI
  70. // TODO: fix stack size when sd api will be in separate thread
  71. {.app = gui_task, .name = "gui_task", .stack_size = 8192, .icon = &A_Plugins_14},
  72. #endif
  73. #ifdef SRV_MENU
  74. {.app = menu_task, .name = "menu_task", .stack_size = 1024, .icon = &A_Plugins_14},
  75. {.app = loader, .name = "loader", .stack_size = 1024, .icon = &A_Plugins_14},
  76. #endif
  77. #ifdef SRV_DOLPHIN
  78. {.app = dolphin_task, .name = "dolphin_task", .stack_size = 1024, .icon = &A_Plugins_14},
  79. #endif
  80. #ifdef SRV_POWER
  81. {.app = power_task, .name = "power_task", .stack_size = 1024, .icon = &A_Plugins_14},
  82. #endif
  83. #ifdef SRV_POWER_OBSERVER
  84. {.app = power_observer, .name = "power_observer", .stack_size = 1024, .icon = &A_Plugins_14},
  85. #endif
  86. #ifdef SRV_BT
  87. {.app = bt_task, .name = "bt_task", .stack_size = 1024, .icon = &A_Plugins_14},
  88. #endif
  89. #ifdef SRV_LF_RFID
  90. {.app = lfrfid_app, .name = "125 kHz RFID", .stack_size = 2048, .icon = &A_Plugins_14},
  91. #endif
  92. #ifdef SRV_IRDA
  93. {.app = irda, .name = "irda", .stack_size = 1024 * 3, .icon = &A_Plugins_14},
  94. #endif
  95. #ifdef SRV_EXAMPLE_QRCODE
  96. {.app = u8g2_qrcode, .name = "u8g2_qrcode", .stack_size = 1024, .icon = &A_Plugins_14},
  97. #endif
  98. #ifdef SRV_EXAMPLE_DISPLAY
  99. {.app = u8g2_example, .name = "u8g2_example", .stack_size = 1024, .icon = &A_Plugins_14},
  100. #endif
  101. #ifdef SRV_SPEAKER_DEMO
  102. {.app = coreglitch_demo_0,
  103. .name = "coreglitch_demo_0",
  104. .stack_size = 1024,
  105. .icon = &A_Plugins_14},
  106. #endif
  107. #ifdef SRV_MUSIC_PLAYER
  108. {.app = music_player, .name = "music player", .stack_size = 1024, .icon = &A_Plugins_14},
  109. #endif
  110. #ifdef SRV_IBUTTON
  111. {.app = app_ibutton, .name = "ibutton", .stack_size = 2048, .icon = &A_Plugins_14},
  112. #endif
  113. #ifdef SRV_GPIO_DEMO
  114. {.app = app_gpio_test, .name = "gpio test", .stack_size = 1024, .icon = &A_Plugins_14},
  115. #endif
  116. #ifdef SRV_SDNFC
  117. {.app = sdnfc, .name = "sdnfc", .stack_size = 1024, .icon = &A_Plugins_14},
  118. #endif
  119. #ifdef SRV_GUI_TEST
  120. {.app = gui_test, .name = "gui_test", .stack_size = 1024, .icon = &A_Plugins_14},
  121. #endif
  122. #ifdef SRV_KEYPAD_TEST
  123. {.app = keypad_test, .name = "keypad_test", .icon = &A_Plugins_14},
  124. #endif
  125. #ifdef SRV_ACCESSOR
  126. {.app = app_accessor, .name = "accessor", .stack_size = 4096, .icon = &A_Plugins_14},
  127. #endif
  128. #ifdef SRV_NOTIFICATION
  129. {.app = notification_app, .name = "notification", .stack_size = 1024, .icon = &A_Plugins_14},
  130. #endif
  131. #ifdef SRV_STORAGE
  132. {.app = storage_app, .name = "storage", .stack_size = 4096, .icon = &A_Plugins_14},
  133. #endif
  134. #ifdef SRV_STORAGE_TEST
  135. {.app = storage_app_test, .name = "storage test", .stack_size = 1024, .icon = &A_Plugins_14},
  136. #endif
  137. #ifdef SRV_DIALOGS
  138. {.app = dialogs_app, .name = "dialogs", .stack_size = 1024, .icon = &A_Plugins_14},
  139. #endif
  140. };
  141. const size_t FLIPPER_SERVICES_COUNT = sizeof(FLIPPER_SERVICES) / sizeof(FlipperApplication);
  142. // Main menu APP
  143. const FlipperApplication FLIPPER_APPS[] = {
  144. #ifdef APP_IBUTTON
  145. {.app = app_ibutton, .name = "iButton", .stack_size = 2048, .icon = &A_iButton_14},
  146. #endif
  147. #ifdef APP_NFC
  148. {.app = nfc_task, .name = "NFC", .stack_size = 4096, .icon = &A_NFC_14},
  149. #endif
  150. #ifdef APP_SUBGHZ
  151. // TODO: decrease stack after SD API refactoring
  152. {.app = subghz_app, .name = "Sub-1 GHz", .stack_size = 4096, .icon = &A_Sub1ghz_14},
  153. #endif
  154. #ifdef APP_LF_RFID
  155. // TODO: fix stack size when sd api will be in separate thread
  156. {.app = lfrfid_app, .name = "125 kHz RFID", .stack_size = 2048, .icon = &A_125khz_14},
  157. #endif
  158. #ifdef APP_IRDA
  159. {.app = irda, .name = "Infrared", .stack_size = 1024 * 3, .icon = &A_Infrared_14},
  160. #endif
  161. #ifdef APP_GPIO_DEMO
  162. {.app = app_gpio_test, .name = "GPIO", .stack_size = 1024, .icon = &A_GPIO_14},
  163. #endif
  164. };
  165. const size_t FLIPPER_APPS_COUNT = sizeof(FLIPPER_APPS) / sizeof(FlipperApplication);
  166. // On system start hooks
  167. const FlipperOnStartHook FLIPPER_ON_SYSTEM_START[] = {
  168. irda_cli_init,
  169. #ifdef APP_NFC
  170. nfc_cli_init,
  171. #endif
  172. #ifdef APP_SUBGHZ
  173. subghz_cli_init,
  174. #endif
  175. #ifdef APP_LF_RFID
  176. lfrfid_cli_init,
  177. #endif
  178. #ifdef APP_IBUTTON
  179. ibutton_cli_init,
  180. #endif
  181. #ifdef SRV_BT
  182. bt_cli_init,
  183. #endif
  184. #ifdef SRV_STORAGE
  185. storage_cli_init,
  186. #endif
  187. };
  188. const size_t FLIPPER_ON_SYSTEM_START_COUNT =
  189. sizeof(FLIPPER_ON_SYSTEM_START) / sizeof(FlipperOnStartHook);
  190. // Plugin menu
  191. const FlipperApplication FLIPPER_PLUGINS[] = {
  192. #ifdef APP_MUSIC_PLAYER
  193. {.app = music_player, .name = "music player", .stack_size = 1024, .icon = &A_Plugins_14},
  194. #endif
  195. #ifdef APP_SPEAKER_DEMO
  196. {.app = coreglitch_demo_0,
  197. .name = "coreglitch_demo_0",
  198. .stack_size = 1024,
  199. .icon = &A_Plugins_14},
  200. #endif
  201. };
  202. const size_t FLIPPER_PLUGINS_COUNT = sizeof(FLIPPER_PLUGINS) / sizeof(FlipperApplication);
  203. // Plugin menu
  204. const FlipperApplication FLIPPER_DEBUG_APPS[] = {
  205. #ifdef APP_EXAMPLE_BLINK
  206. {.app = application_blink, .name = "blink", .stack_size = 1024, .icon = &A_Plugins_14},
  207. #endif
  208. #ifdef APP_EXAMPLE_INPUT_DUMP
  209. {.app = application_input_dump,
  210. .name = "input dump",
  211. .stack_size = 1024,
  212. .icon = &A_Plugins_14},
  213. #endif
  214. #ifdef APP_VIBRO_DEMO
  215. {.app = application_vibro, .name = "vibro", .stack_size = 1024, .icon = &A_Plugins_14},
  216. #endif
  217. #ifdef APP_SDNFC
  218. {.app = sdnfc, .name = "sdnfc", .stack_size = 1024, .icon = &A_Plugins_14},
  219. #endif
  220. #ifdef APP_GUI_TEST
  221. {.app = gui_test, .name = "gui_test", .stack_size = 1024, .icon = &A_Plugins_14},
  222. #endif
  223. #ifdef APP_KEYPAD_TEST
  224. {.app = keypad_test, .name = "keypad_test", .icon = &A_Plugins_14},
  225. #endif
  226. #ifdef APP_ACCESSOR
  227. {.app = app_accessor, .name = "accessor", .stack_size = 4096, .icon = &A_Plugins_14},
  228. #endif
  229. #ifdef APP_UNIT_TESTS
  230. {.app = flipper_test_app, .name = "Unit Tests", .stack_size = 1024, .icon = &A_Plugins_14},
  231. #endif
  232. #ifdef APP_IRDA_MONITOR
  233. {.app = irda_monitor_app, .name = "Irda Monitor", .stack_size = 1024, .icon = &A_Plugins_14},
  234. #endif
  235. #ifdef APP_VERTICAL_SCREEN
  236. {.app = application_vertical_screen,
  237. .name = "Vertical Screen",
  238. .stack_size = 1024,
  239. .icon = &A_Plugins_14},
  240. #endif
  241. #ifdef APP_SCENED
  242. {.app = scened_app, .name = "Templated Scene", .stack_size = 1024, .icon = &A_Plugins_14},
  243. #endif
  244. #ifdef APP_LF_RFID
  245. {.app = lfrfid_debug_app, .name = "LF-RFID Debug", .stack_size = 1024, .icon = &A_125khz_14},
  246. #endif
  247. };
  248. const size_t FLIPPER_DEBUG_APPS_COUNT = sizeof(FLIPPER_DEBUG_APPS) / sizeof(FlipperApplication);
  249. #ifdef APP_ARCHIVE
  250. const FlipperApplication FLIPPER_ARCHIVE =
  251. {.app = app_archive, .name = "Archive", .stack_size = 4096, .icon = &A_FileManager_14};
  252. #endif
  253. #ifdef SRV_DOLPHIN
  254. const FlipperApplication FLIPPER_SCENE =
  255. {.app = scene_app, .name = "Scenes", .stack_size = 1024, .icon = &A_Games_14};
  256. const FlipperApplication FLIPPER_SCENE_APPS[] = {
  257. {.app = passport, .name = "Passport", .stack_size = 1024, .icon = &A_Games_14},
  258. {.app = music_player, .name = "Music player", .stack_size = 1024, .icon = &A_Plugins_14},
  259. };
  260. const size_t FLIPPER_SCENE_APPS_COUNT = sizeof(FLIPPER_SCENE_APPS) / sizeof(FlipperApplication);
  261. #endif
  262. // Settings menu
  263. const FlipperApplication FLIPPER_SETTINGS_APPS[] = {
  264. #ifdef SRV_NOTIFICATION
  265. {.app = notification_app_settings, .name = "Notification", .stack_size = 1024, .icon = NULL},
  266. #endif
  267. #ifdef SRV_STORAGE
  268. {.app = storage_settings, .name = "Storage", .stack_size = 2048, .icon = NULL},
  269. #endif
  270. };
  271. const size_t FLIPPER_SETTINGS_APPS_COUNT =
  272. sizeof(FLIPPER_SETTINGS_APPS) / sizeof(FlipperApplication);