flipper.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "flipper.h"
  2. #include <applications.h>
  3. #include <furi.h>
  4. #include <furi_hal_version.h>
  5. #define TAG "Flipper"
  6. static void flipper_print_version(const char* target, const Version* version) {
  7. if(version) {
  8. FURI_LOG_I(
  9. TAG,
  10. "\r\n\t%s version:\t%s\r\n"
  11. "\tBuild date:\t\t%s\r\n"
  12. "\tGit Commit:\t\t%s (%s)%s\r\n"
  13. "\tGit Branch:\t\t%s",
  14. target,
  15. version_get_version(version),
  16. version_get_builddate(version),
  17. version_get_githash(version),
  18. version_get_gitbranchnum(version),
  19. version_get_dirty_flag(version) ? " (dirty)" : "",
  20. version_get_gitbranch(version));
  21. } else {
  22. FURI_LOG_I(TAG, "No build info for %s", target);
  23. }
  24. }
  25. void flipper_init() {
  26. flipper_print_version("Firmware", furi_hal_version_get_firmware_version());
  27. FURI_LOG_I(TAG, "starting services");
  28. for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
  29. FURI_LOG_I(TAG, "starting service %s", FLIPPER_SERVICES[i].name);
  30. FuriThread* thread = furi_thread_alloc();
  31. furi_thread_set_name(thread, FLIPPER_SERVICES[i].name);
  32. furi_thread_set_stack_size(thread, FLIPPER_SERVICES[i].stack_size);
  33. furi_thread_set_callback(thread, FLIPPER_SERVICES[i].app);
  34. furi_thread_start(thread);
  35. }
  36. FURI_LOG_I(TAG, "services startup complete");
  37. }