Furi, FuriHal: remove FreeRTOS headers leaks (#3179)

* Furi: remove direct FreeRTOS timers use
* Furi: eliminate FreeRTOS headers leak. What did it cost? Everything...
* SubGhz: proper public api for protocols. Format Sources.
* Furi: slightly less redundant declarations
* Desktop: proper types in printf
* Sync API Symbols
* Furi: add timer reset and fix dolphin service, fix unit tests
* Furi: proper timer restart method naming and correct behavior in timer stopped state.

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2023-11-01 16:24:11 +09:00
committed by GitHub
parent 7bd3bd7ea4
commit aa06328516
68 changed files with 316 additions and 472 deletions

View File

@@ -23,7 +23,7 @@ typedef struct {
uint8_t active_bubbles;
uint8_t passive_bubbles;
uint8_t active_shift;
TickType_t active_ended_at;
uint32_t active_ended_at;
Icon* freeze_frame;
} BubbleAnimationViewModel;
@@ -154,7 +154,7 @@ static void bubble_animation_activate(BubbleAnimationView* view, bool force) {
if(model->current != NULL) {
if(!force) {
if((model->active_ended_at + model->current->active_cooldown * 1000) >
xTaskGetTickCount()) {
furi_get_tick()) {
activate = false;
} else if(model->active_shift) {
activate = false;
@@ -215,7 +215,7 @@ static void bubble_animation_next_frame(BubbleAnimationViewModel* model) {
model->active_cycle = 0;
model->current_frame = 0;
model->current_bubble = bubble_animation_pick_bubble(model, false);
model->active_ended_at = xTaskGetTickCount();
model->active_ended_at = furi_get_tick();
}
if(model->current_bubble) {
@@ -355,7 +355,7 @@ void bubble_animation_view_set_animation(
furi_assert(model);
model->current = new_animation;
model->active_ended_at = xTaskGetTickCount() - (model->current->active_cooldown * 1000);
model->active_ended_at = furi_get_tick() - (model->current->active_cooldown * 1000);
model->active_bubbles = 0;
model->passive_bubbles = 0;
for(int i = 0; i < new_animation->frame_bubble_sequences_count; ++i) {

View File

@@ -1,7 +1,6 @@
#include "one_shot_animation_view.h"
#include <furi.h>
#include <portmacro.h>
#include <gui/canvas.h>
#include <gui/view.h>
#include <gui/icon_i.h>
@@ -11,7 +10,7 @@ typedef void (*OneShotInteractCallback)(void*);
struct OneShotView {
View* view;
TimerHandle_t update_timer;
FuriTimer* update_timer;
OneShotInteractCallback interact_callback;
void* interact_callback_context;
};
@@ -22,8 +21,8 @@ typedef struct {
bool block_input;
} OneShotViewModel;
static void one_shot_view_update_timer_callback(TimerHandle_t xTimer) {
OneShotView* view = (void*)pvTimerGetTimerID(xTimer);
static void one_shot_view_update_timer_callback(void* context) {
OneShotView* view = context;
OneShotViewModel* model = view_get_model(view->view);
if((model->index + 1) < model->icon->frame_count) {
@@ -81,7 +80,7 @@ OneShotView* one_shot_view_alloc(void) {
OneShotView* view = malloc(sizeof(OneShotView));
view->view = view_alloc();
view->update_timer =
xTimerCreate(NULL, 1000, pdTRUE, view, one_shot_view_update_timer_callback);
furi_timer_alloc(one_shot_view_update_timer_callback, FuriTimerTypePeriodic, view);
view_allocate_model(view->view, ViewModelTypeLocking, sizeof(OneShotViewModel));
view_set_context(view->view, view);
@@ -94,7 +93,7 @@ OneShotView* one_shot_view_alloc(void) {
void one_shot_view_free(OneShotView* view) {
furi_assert(view);
xTimerDelete(view->update_timer, portMAX_DELAY);
furi_timer_free(view->update_timer);
view_free(view->view);
view->view = NULL;
free(view);
@@ -120,7 +119,7 @@ void one_shot_view_start_animation(OneShotView* view, const Icon* icon) {
model->icon = icon;
model->block_input = true;
view_commit_model(view->view, true);
xTimerChangePeriod(view->update_timer, 1000 / model->icon->frame_rate, portMAX_DELAY);
furi_timer_start(view->update_timer, 1000 / model->icon->frame_rate);
}
View* one_shot_view_get_view(OneShotView* view) {