mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-01 01:27:48 +03:00
f5b342abbe
* initial gpio layer * move temlplate.c to template.c.example in preparing to applications.mk rework * separate arduino layer * separate flipper_hal.x * prepare to switch applications on v2 core gpio api * swithch applications to v2 gpio api * gpio api for local target * better gpio_disable handling * remove pwm functions from local target * inline gpio funcs * common function to init all api's * fix local example blink * move delay us to hal api folder * move pwm_set/pwm_stop to hal api folder * update applications to use hal pwm api * remove gpio mode case warning * add speaker demo to build Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#include <stdio.h>
|
|
|
|
extern "C" {
|
|
#include "flipper.h"
|
|
#include "flipper_v2.h"
|
|
#include "log.h"
|
|
#include "applications.h"
|
|
#include "tty_uart.h"
|
|
}
|
|
|
|
// for testing purpose
|
|
uint32_t exitcode = 0;
|
|
extern "C" void set_exitcode(uint32_t _exitcode) {
|
|
exitcode = _exitcode;
|
|
}
|
|
|
|
extern "C" int app() {
|
|
init_flipper_api();
|
|
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);
|
|
} while(is_alive);
|
|
|
|
fuprintf(log, "\n=== Bye from Flipper Zero! ===\n\n");
|
|
|
|
return (int)exitcode;
|
|
} |