2021-02-12 20:24:34 +03:00
|
|
|
#include "flipper.h"
|
|
|
|
#include <applications.h>
|
|
|
|
#include <furi.h>
|
2021-04-19 19:30:25 +03:00
|
|
|
#include <api-hal-version.h>
|
|
|
|
|
2021-04-30 14:20:33 +03:00
|
|
|
static void flipper_print_version(const char* target, const Version* version) {
|
2021-04-19 19:30:25 +03:00
|
|
|
if(version) {
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I(
|
|
|
|
"FLIPPER",
|
|
|
|
"\r\n\t%s version:\t%s\r\n"
|
|
|
|
"\tBuild date:\t\t%s\r\n"
|
|
|
|
"\tGit Commit:\t\t%s (%s)\r\n"
|
|
|
|
"\tGit Branch:\t\t%s",
|
|
|
|
target,
|
|
|
|
version_get_version(version),
|
|
|
|
version_get_builddate(version),
|
2021-04-19 19:30:25 +03:00
|
|
|
version_get_githash(version),
|
2021-04-30 14:20:33 +03:00
|
|
|
version_get_gitbranchnum(version),
|
|
|
|
version_get_gitbranch(version));
|
2021-04-19 19:30:25 +03:00
|
|
|
} else {
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I("FLIPPER", "No build info for %s", target);
|
2021-04-19 19:30:25 +03:00
|
|
|
}
|
|
|
|
}
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
void flipper_init() {
|
2021-04-19 19:30:25 +03:00
|
|
|
const Version* version;
|
|
|
|
|
|
|
|
version = (const Version*)api_hal_version_get_boot_version();
|
2021-04-30 14:20:33 +03:00
|
|
|
flipper_print_version("Bootloader", version);
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-07-02 03:58:31 +03:00
|
|
|
version = (const Version*)api_hal_version_get_firmware_version();
|
2021-04-30 14:20:33 +03:00
|
|
|
flipper_print_version("Firmware", version);
|
2021-02-12 20:24:34 +03:00
|
|
|
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I("FLIPPER", "starting services");
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I("FLIPPER", "starting service %s", FLIPPER_SERVICES[i].name);
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
FuriThread* thread = furi_thread_alloc();
|
|
|
|
|
|
|
|
furi_thread_set_name(thread, FLIPPER_SERVICES[i].name);
|
|
|
|
furi_thread_set_stack_size(thread, FLIPPER_SERVICES[i].stack_size);
|
|
|
|
furi_thread_set_callback(thread, FLIPPER_SERVICES[i].app);
|
|
|
|
|
|
|
|
furi_thread_start(thread);
|
|
|
|
}
|
|
|
|
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I("FLIPPER", "services startup complete");
|
2021-04-19 19:30:25 +03:00
|
|
|
}
|