applications.c 9.4 KB

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