[FL-872] Furi, API-HAL, App-Loader cleanup and improvements (#334)
* Furi: replace obsolete furiac_exit with osThreadExit, drop obsolete apis and test. Rename systemd to flipper and move to separate file, cleanup. ApiHal: Rename timebase to os and move freertos hooks there, move insomnia api to power module. * Furi: new thread helper * Furi: cleanup thread documentation * Flipper, AppLoader: update to use FuriThread. Update tasks signatures to match FuriThreadCallback signature. * F4: rename API_HAL_TIMEBASE_DEBUG to API_HAL_OS_DEBUG * Applications: rename FuriApplication to FlipperApplication, use FuriThreadCallback signature for apps. * C++ app template sample, new exit method
This commit is contained in:
30
core/furi.c
30
core/furi.c
@@ -1,12 +1,4 @@
|
||||
#include "furi.h"
|
||||
#include <applications.h>
|
||||
|
||||
// for testing purpose
|
||||
uint32_t exitcode = 0;
|
||||
|
||||
void set_exitcode(uint32_t _exitcode) {
|
||||
exitcode = _exitcode;
|
||||
}
|
||||
|
||||
void furi_init() {
|
||||
gpio_api_init();
|
||||
@@ -14,25 +6,3 @@ void furi_init() {
|
||||
furi_record_init();
|
||||
furi_stdglue_init();
|
||||
}
|
||||
|
||||
int systemd() {
|
||||
furi_init();
|
||||
printf("[systemd] furi initialized\r\n");
|
||||
// FURI startup
|
||||
for(size_t i = 0; i < FLIPPER_SERVICES_size(); i++) {
|
||||
printf("[systemd] starting service %s\r\n", FLIPPER_SERVICES[i].name);
|
||||
osThreadAttr_t* attr = furi_alloc(sizeof(osThreadAttr_t));
|
||||
attr->name = FLIPPER_SERVICES[i].name;
|
||||
attr->stack_size = FLIPPER_SERVICES[i].stack_size;
|
||||
osThreadNew(FLIPPER_SERVICES[i].app, NULL, attr);
|
||||
}
|
||||
printf("[systemd] all services started\r\n");
|
||||
|
||||
while(1) {
|
||||
osThreadSuspend(osThreadGetId());
|
||||
}
|
||||
|
||||
printf("[systemd] === Bye from Flipper Zero! ===\r\n");
|
||||
|
||||
return (int)exitcode;
|
||||
}
|
Reference in New Issue
Block a user