flipperzero-firmware/applications/app_example/app_example.c
coreglitch 1759787334
Furi (#24)
* furiac start and thread create implementation"

* create and kill task

* rename debug, add header

* remove write.c

* kill itself

* furi exit/switch

* success switch and exit

* WIP furi records

* add furi record interface

* rename furi app control file

* record implementation in progress

* wip furi implementation

* add automatic tests for FURI AC

* differ build tests

* small changes

* FURI record tests description

* change furi statuses

* FURI record test blank

* exit after all application ends

* delay: print then wait

* fix FURI implementatnion building

* pipe record test

* concurrent access

* uncomplete mute-test

* update FURI documentation
2020-08-24 18:31:22 +03:00

81 lines
1.6 KiB
C

#include <stdio.h>
#include "flipper.h"
#include "debug.h"
void furi_widget(void* param);
void furi_test_app(void* param);
void furi_next_test_app(void* param);
/*
widget simply print ping message
*/
void furi_widget(void* param) {
FILE* debug_uart = get_debug();
fprintf(debug_uart, "start furi widget: %s\n", (char*)param);
while(1) {
fprintf(debug_uart, "furi widget\n");
delay(10);
}
}
/*
it simply start, then start child widget, wait about 1 sec (with ping evey 200 ms),
kill the widget, continue with 500 ms ping.
*/
void furi_test_app(void* param) {
uint8_t cnt = 0;
while(1) {
fprintf(debug_uart, "furi test app %d\n", cnt);
delay(10);
if(cnt == 2) {
fprintf(debug_uart, "go to next app\n");
furiac_switch(furi_next_test_app, "next_test", NULL);
fprintf(debug_uart, "unsuccessful switch\n");
while(1) {
delay(1000);
}
}
cnt++;
}
}
void furi_next_test_app(void* param) {
FILE* debug_uart = get_debug();
fprintf(debug_uart, "start next test app\n");
delay(10);
fprintf(debug_uart, "exit next app\n");
furiac_exit(NULL);
while(1) {
// this code must not be called
fprintf(debug_uart, "next app: something went wrong\n");
delay(10);
}
}
/*
FILE* debug_uart = get_debug();
fprintf(debug_uart, "hello Flipper!\n");
GpioPin red_led = {LED_RED_GPIO_Port, LED_RED_Pin};
app_gpio_init(red_led, GpioModeOutput);
while(1) {
delay(100);
app_gpio_write(red_led, true);
delay(100);
app_gpio_write(red_led, false);
}
*/