2020-08-17 09:45:53 +00:00
|
|
|
#include "flipper.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
extern "C" {
|
2020-09-29 23:18:30 +00:00
|
|
|
#include "startup.h"
|
|
|
|
#include "furi.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "tty_uart.h"
|
2020-08-17 09:45:53 +00:00
|
|
|
}
|
2020-08-07 06:58:20 +00:00
|
|
|
|
|
|
|
extern "C" void app() {
|
2020-08-26 18:32:22 +00:00
|
|
|
register_tty_uart();
|
|
|
|
|
|
|
|
FuriRecordSubscriber* log = get_default_log();
|
|
|
|
fuprintf(log, "\n=== Welcome to Flipper Zero! ===\n\n");
|
|
|
|
|
2020-08-24 15:31:22 +00:00
|
|
|
// FURI startup
|
2020-09-29 23:18:30 +00:00
|
|
|
FuriApp* handlers[sizeof(FLIPPER_STARTUP) / sizeof(FLIPPER_STARTUP[0])];
|
2020-08-17 09:45:53 +00:00
|
|
|
|
2020-09-29 23:18:30 +00:00
|
|
|
for(size_t i = 0; i < sizeof(FLIPPER_STARTUP) / sizeof(FLIPPER_STARTUP[0]); i++) {
|
2020-08-24 15:31:22 +00:00
|
|
|
handlers[i] = furiac_start(FLIPPER_STARTUP[i].app, FLIPPER_STARTUP[i].name, NULL);
|
2020-08-07 06:58:20 +00:00
|
|
|
}
|
2020-08-24 15:31:22 +00:00
|
|
|
|
|
|
|
bool is_alive = false;
|
|
|
|
do {
|
|
|
|
is_alive = false;
|
2020-09-29 23:18:30 +00:00
|
|
|
for(size_t i = 0; i < sizeof(FLIPPER_STARTUP) / sizeof(FLIPPER_STARTUP[0]); i++) {
|
2020-08-24 15:31:22 +00:00
|
|
|
if(handlers[i]->handler != NULL) {
|
|
|
|
is_alive = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delay(500);
|
|
|
|
// TODO add deferred event queue here
|
|
|
|
} while(is_alive);
|
2020-08-07 06:58:20 +00:00
|
|
|
}
|