unleashed-firmware/core/app.cpp
DrZlo13 59513b05ee
Simple sd card driver (#162)
* fixed inline functions for modern C standart

* more stack for application

* added library

* init fatfs library

* fatfs example application

* Merge with current master

* fix typo and delete old files

* cmsis os 2 reentrance fix

* Reworked dependency wait to support multiple dependency

* Build FatFS on local target, syscall.c is target-specific.

* run local target ok

* testcase for fatfs

Co-authored-by: aanper <mail@s3f.ru>
2020-10-08 17:37:19 +03:00

40 lines
No EOL
1.1 KiB
C++

#include "flipper.h"
#include <stdio.h>
extern "C" {
#include "furi.h"
#include "log.h"
#include "startup.h"
#include "tty_uart.h"
}
extern "C" void app() {
register_tty_uart();
FuriRecordSubscriber* log = get_default_log();
fuprintf(log, "\n=== Welcome to Flipper Zero! ===\n\n");
// FURI startup
const size_t flipper_app_count = sizeof(FLIPPER_STARTUP) / sizeof(FLIPPER_STARTUP[0]);
FuriApp* handlers[flipper_app_count];
for(size_t i = 0; i < flipper_app_count; i++) {
// TODO create a dependency tree and run tasks in the desired order
furiac_wait_libs(&FLIPPER_STARTUP[i].libs);
handlers[i] = furiac_start(FLIPPER_STARTUP[i].app, FLIPPER_STARTUP[i].name, NULL);
}
bool is_alive = false;
do {
is_alive = false;
for(size_t i = 0; i < flipper_app_count; i++) {
if(handlers[i]->handler != NULL) {
is_alive = true;
}
}
delay(500);
// TODO add deferred event queue here
} while(is_alive);
fuprintf(log, "\n=== Bye from Flipper Zero! ===\n\n");
}