[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:
@@ -12,7 +12,7 @@ void rgb_set(
|
||||
gpio_write(led_b, !b);
|
||||
}
|
||||
|
||||
void application_blink(void* p) {
|
||||
int32_t application_blink(void* p) {
|
||||
// TODO open record
|
||||
const GpioPin* led_r_record = &led_gpio[0];
|
||||
const GpioPin* led_g_record = &led_gpio[1];
|
||||
@@ -41,4 +41,6 @@ void application_blink(void* p) {
|
||||
rgb_set(0, 0, 0, led_r_record, led_g_record, led_b_record);
|
||||
delay(500);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -13,7 +13,7 @@ static void event_cb(const void* value, void* ctx) {
|
||||
printf("event: %02x %s\r\n", event->key, event->type ? "pressed" : "released");
|
||||
}
|
||||
|
||||
void application_input_dump(void* p) {
|
||||
int32_t application_input_dump(void* p) {
|
||||
// open record
|
||||
PubSub* event_record = furi_record_open("input_events");
|
||||
subscribe_pubsub(event_record, event_cb, NULL);
|
||||
@@ -23,4 +23,6 @@ void application_input_dump(void* p) {
|
||||
for(;;) {
|
||||
delay(100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "u8g2/u8g2.h"
|
||||
#include <furi.h>
|
||||
|
||||
void u8g2_example(void* p) {
|
||||
int32_t u8g2_example(void* p) {
|
||||
// open record
|
||||
u8g2_t* fb = furi_record_open("u8g2_fb");
|
||||
u8g2_SetFont(fb, u8g2_font_6x10_mf);
|
||||
@@ -10,5 +10,5 @@ void u8g2_example(void* p) {
|
||||
u8g2_DrawStr(fb, 2, 12, "hello world!");
|
||||
furi_record_close("u8g2_fb");
|
||||
|
||||
furiac_exit(NULL);
|
||||
return 0;
|
||||
}
|
@@ -13,7 +13,7 @@ void u8g2_DrawPixelSize(u8g2_t* u8g2, uint8_t x, uint8_t y, uint8_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
void u8g2_qrcode(void* p) {
|
||||
int32_t u8g2_qrcode(void* p) {
|
||||
// open record
|
||||
FuriRecordSubscriber* fb_record =
|
||||
furi_open_deprecated("u8g2_fb", false, false, NULL, NULL, NULL);
|
||||
@@ -38,7 +38,7 @@ void u8g2_qrcode(void* p) {
|
||||
|
||||
if(fb_record == NULL) {
|
||||
printf("[view_port] cannot create fb record\r\n");
|
||||
furiac_exit(NULL);
|
||||
return 255;
|
||||
}
|
||||
|
||||
u8g2_t* fb = furi_take(fb_record);
|
||||
@@ -63,12 +63,14 @@ void u8g2_qrcode(void* p) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
furiac_exit(NULL);
|
||||
return 255;
|
||||
}
|
||||
|
||||
furi_commit(fb_record);
|
||||
|
||||
delay(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
@@ -1,7 +1,7 @@
|
||||
#include <furi.h>
|
||||
#include <string.h>
|
||||
|
||||
void application_uart_write(void* p) {
|
||||
int32_t application_uart_write(void* p) {
|
||||
// Red led for showing progress
|
||||
GpioPin led = {.pin = GPIO_PIN_8, .port = GPIOA};
|
||||
// TODO open record
|
||||
@@ -29,4 +29,6 @@ void application_uart_write(void* p) {
|
||||
// delay with overall perion of 1s
|
||||
delay(950);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -21,7 +21,7 @@ static void button_handler(const void* value, void* _ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
void application_vibro(void* p) {
|
||||
int32_t application_vibro(void* p) {
|
||||
Ctx ctx = {.led = (GpioPin*)&led_gpio[1], .vibro = (GpioPin*)&vibro_gpio};
|
||||
|
||||
gpio_init(ctx.led, GpioModeOutputOpenDrain);
|
||||
@@ -37,4 +37,6 @@ void application_vibro(void* p) {
|
||||
while(1) {
|
||||
osDelay(osWaitForever);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user