Furi: core refactoring and CMSIS removal part 2 (#1410)

* Furi: rename and move core
* Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest
* Furi: CMSIS_OS drop and refactoring.
* Furi: refactoring, remove cmsis legacy
* Furi: fix incorrect assert on queue deallocation, cleanup timer
* Furi: improve delay api, get rid of floats
* hal: dropped furi_hal_crc
* Furi: move DWT based delay to cortex HAL
* Furi: update core documentation

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2022-07-20 13:56:33 +03:00
committed by GitHub
parent f9c2287ea7
commit e3c7201a20
264 changed files with 2569 additions and 3883 deletions

View File

@@ -44,7 +44,7 @@ struct AnimationManager {
FuriPubSubSubscription* pubsub_subscription_dolphin;
BubbleAnimationView* animation_view;
OneShotView* one_shot_view;
osTimerId_t idle_animation_timer;
FuriTimer* idle_animation_timer;
StorageAnimation* current_animation;
AnimationManagerInteractCallback interact_callback;
AnimationManagerSetNewIdleAnimationCallback new_idle_callback;
@@ -198,7 +198,7 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(animation_manager->current_animation);
animation_manager->state = AnimationManagerStateIdle;
osTimerStart(animation_manager->idle_animation_timer, bubble_animation->duration * 1000);
furi_timer_start(animation_manager->idle_animation_timer, bubble_animation->duration * 1000);
}
static bool animation_manager_check_blocking(AnimationManager* animation_manager) {
@@ -246,7 +246,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
}
if(blocking_animation) {
osTimerStop(animation_manager->idle_animation_timer);
furi_timer_stop(animation_manager->idle_animation_timer);
animation_manager_replace_current_animation(animation_manager, blocking_animation);
/* no timer starting because this is blocking animation */
animation_manager->state = AnimationManagerStateBlocked;
@@ -283,7 +283,7 @@ AnimationManager* animation_manager_alloc(void) {
string_init(animation_manager->freezed_animation_name);
animation_manager->idle_animation_timer =
osTimerNew(animation_manager_timer_callback, osTimerOnce, animation_manager, NULL);
furi_timer_alloc(animation_manager_timer_callback, FuriTimerTypeOnce, animation_manager);
bubble_animation_view_set_interact_callback(
animation_manager->animation_view, animation_manager_interact_callback, animation_manager);
@@ -322,7 +322,7 @@ void animation_manager_free(AnimationManager* animation_manager) {
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
view_stack_remove_view(animation_manager->view_stack, animation_view);
bubble_animation_view_free(animation_manager->animation_view);
osTimerDelete(animation_manager->idle_animation_timer);
furi_timer_free(animation_manager->idle_animation_timer);
}
View* animation_manager_get_animation_view(AnimationManager* animation_manager) {
@@ -449,7 +449,7 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
if(animation_manager->freezed_animation_time_left < 0) {
animation_manager->freezed_animation_time_left = 0;
}
osTimerStop(animation_manager->idle_animation_timer);
furi_timer_stop(animation_manager->idle_animation_timer);
} else {
furi_assert(0);
}
@@ -504,13 +504,13 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
animation_manager->state = AnimationManagerStateIdle;
if(animation_manager->freezed_animation_time_left) {
osTimerStart(
furi_timer_start(
animation_manager->idle_animation_timer,
animation_manager->freezed_animation_time_left);
} else {
const BubbleAnimation* animation = animation_storage_get_bubble_animation(
animation_manager->current_animation);
osTimerStart(
furi_timer_start(
animation_manager->idle_animation_timer, animation->duration * 1000);
}
}

View File

@@ -2,7 +2,7 @@
#include <stdint.h>
#include <flipper_format/flipper_format.h>
#include <furi.h>
#include <furi/dangerous_defines.h>
#include <core/dangerous_defines.h>
#include <storage/storage.h>
#include <gui/icon_i.h>
#include <m-string.h>

View File

@@ -11,9 +11,7 @@
#include <gui/icon_i.h>
#include <input/input.h>
#include <stdint.h>
#include <FreeRTOS.h>
#include <timers.h>
#include <furi/dangerous_defines.h>
#include <core/dangerous_defines.h>
#define ACTIVE_SHIFT 2
@@ -31,7 +29,7 @@ typedef struct {
struct BubbleAnimationView {
View* view;
osTimerId_t timer;
FuriTimer* timer;
BubbleAnimationInteractCallback interact_callback;
void* interact_callback_context;
};
@@ -192,7 +190,7 @@ static void bubble_animation_activate_right_now(BubbleAnimationView* view) {
view_commit_model(view->view, true);
if(frame_rate) {
osTimerStart(view->timer, 1000 / frame_rate);
furi_timer_start(view->timer, 1000 / frame_rate);
}
}
@@ -294,21 +292,21 @@ static void bubble_animation_enter(void* context) {
view_commit_model(view->view, false);
if(frame_rate) {
osTimerStart(view->timer, 1000 / frame_rate);
furi_timer_start(view->timer, 1000 / frame_rate);
}
}
static void bubble_animation_exit(void* context) {
furi_assert(context);
BubbleAnimationView* view = context;
osTimerStop(view->timer);
furi_timer_stop(view->timer);
}
BubbleAnimationView* bubble_animation_view_alloc(void) {
BubbleAnimationView* view = malloc(sizeof(BubbleAnimationView));
view->view = view_alloc();
view->interact_callback = NULL;
view->timer = osTimerNew(bubble_animation_timer_callback, osTimerPeriodic, view, NULL);
view->timer = furi_timer_alloc(bubble_animation_timer_callback, FuriTimerTypePeriodic, view);
view_allocate_model(view->view, ViewModelTypeLocking, sizeof(BubbleAnimationViewModel));
view_set_context(view->view, view);
@@ -369,7 +367,7 @@ void bubble_animation_view_set_animation(
model->active_cycle = 0;
view_commit_model(view->view, true);
osTimerStart(view->timer, 1000 / new_animation->icon_animation.frame_rate);
furi_timer_start(view->timer, 1000 / new_animation->icon_animation.frame_rate);
}
void bubble_animation_freeze(BubbleAnimationView* view) {
@@ -381,7 +379,7 @@ void bubble_animation_freeze(BubbleAnimationView* view) {
model->freeze_frame = bubble_animation_clone_first_frame(&model->current->icon_animation);
model->current = NULL;
view_commit_model(view->view, false);
osTimerStop(view->timer);
furi_timer_stop(view->timer);
}
void bubble_animation_unfreeze(BubbleAnimationView* view) {
@@ -395,7 +393,7 @@ void bubble_animation_unfreeze(BubbleAnimationView* view) {
frame_rate = model->current->icon_animation.frame_rate;
view_commit_model(view->view, true);
osTimerStart(view->timer, 1000 / frame_rate);
furi_timer_start(view->timer, 1000 / frame_rate);
bubble_animation_activate(view, false);
}

View File

@@ -93,12 +93,12 @@ static void desktop_auto_lock_timer_callback(void* context) {
}
static void desktop_start_auto_lock_timer(Desktop* desktop) {
osTimerStart(
desktop->auto_lock_timer, furi_hal_ms_to_ticks(desktop->settings.auto_lock_delay_ms));
furi_timer_start(
desktop->auto_lock_timer, furi_ms_to_ticks(desktop->settings.auto_lock_delay_ms));
}
static void desktop_stop_auto_lock_timer(Desktop* desktop) {
osTimerStop(desktop->auto_lock_timer);
furi_timer_stop(desktop->auto_lock_timer);
}
static void desktop_auto_lock_arm(Desktop* desktop) {
@@ -232,7 +232,7 @@ Desktop* desktop_alloc() {
desktop->input_events_subscription = NULL;
desktop->auto_lock_timer =
osTimerNew(desktop_auto_lock_timer_callback, osTimerOnce, desktop, NULL);
furi_timer_alloc(desktop_auto_lock_timer_callback, FuriTimerTypeOnce, desktop);
return desktop;
}
@@ -283,7 +283,7 @@ void desktop_free(Desktop* desktop) {
furi_record_close("menu");
osTimerDelete(desktop->auto_lock_timer);
furi_timer_free(desktop->auto_lock_timer);
free(desktop);
}

View File

@@ -67,7 +67,7 @@ struct Desktop {
FuriPubSubSubscription* app_start_stop_subscription;
FuriPubSub* input_events_pubsub;
FuriPubSubSubscription* input_events_subscription;
osTimerId_t auto_lock_timer;
FuriTimer* auto_lock_timer;
};
Desktop* desktop_alloc();

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <furi/check.h>
#include <core/check.h>
#include <gui/scene_manager.h>
#include "../../helpers/pin_lock.h"
#include "../desktop_settings_app.h"

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <furi/check.h>
#include <core/check.h>
#include <gui/scene_manager.h>
#include <gui/modules/popup.h>

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <furi/check.h>
#include <core/check.h>
#include <gui/scene_manager.h>
#include "desktop/desktop_settings/desktop_settings.h"

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <furi/check.h>
#include <core/check.h>
#include <gui/scene_manager.h>
#include "../desktop_settings_app.h"

View File

@@ -4,7 +4,7 @@
#include <storage/storage.h>
#include <gui/icon.h>
#include <gui/icon_i.h>
#include <furi/dangerous_defines.h>
#include <core/dangerous_defines.h>
#define SLIDESHOW_MAGIC 0x72676468
#define SLIDESHOW_MAX_SUPPORTED_VERSION 1
@@ -118,4 +118,4 @@ void slideshow_draw(Slideshow* slideshow, Canvas* canvas, uint8_t x, uint8_t y)
slideshow->icon.width,
slideshow->icon.height,
slideshow->icon.frames[slideshow->current_frame]);
}
}

View File

@@ -150,7 +150,7 @@ void desktop_scene_pin_input_on_exit(void* context) {
desktop->scene_manager, DesktopScenePinInput);
xTimerStop(state->timer, portMAX_DELAY);
while(xTimerIsTimerActive(state->timer)) {
furi_hal_delay_ms(1);
furi_delay_tick(1);
}
xTimerDelete(state->timer, portMAX_DELAY);
free(state);

View File

@@ -206,7 +206,7 @@ DesktopViewLocked* desktop_view_locked_alloc() {
void desktop_view_locked_free(DesktopViewLocked* locked_view) {
furi_assert(locked_view);
osTimerDelete(locked_view->timer);
furi_timer_free(locked_view->timer);
view_free(locked_view->view);
free(locked_view);
}

View File

@@ -99,6 +99,6 @@ DesktopMainView* desktop_main_alloc() {
void desktop_main_free(DesktopMainView* main_view) {
furi_assert(main_view);
view_free(main_view->view);
osTimerDelete(main_view->poweroff_timer);
furi_timer_free(main_view->poweroff_timer);
free(main_view);
}

View File

@@ -214,7 +214,7 @@ void desktop_view_pin_input_free(DesktopViewPinInput* pin_input) {
xTimerStop(pin_input->timer, portMAX_DELAY);
while(xTimerIsTimerActive(pin_input->timer)) {
furi_hal_delay_ms(1);
furi_delay_tick(1);
}
xTimerDelete(pin_input->timer, portMAX_DELAY);