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:
@@ -1,10 +1,9 @@
|
||||
#include "file_browser.h"
|
||||
#include "assets_icons.h"
|
||||
#include "cmsis_os2.h"
|
||||
#include "file_browser_worker.h"
|
||||
#include "furi/check.h"
|
||||
#include "furi/common_defines.h"
|
||||
#include "furi/log.h"
|
||||
#include <core/check.h>
|
||||
#include <core/common_defines.h>
|
||||
#include <core/log.h>
|
||||
#include "furi_hal_resources.h"
|
||||
#include "m-string.h"
|
||||
#include <m-array.h>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "file_browser_worker.h"
|
||||
#include "furi/check.h"
|
||||
#include "furi/common_defines.h"
|
||||
#include <core/check.h>
|
||||
#include <core/common_defines.h>
|
||||
#include "m-string.h"
|
||||
#include "storage/filesystem_api_defines.h"
|
||||
#include <m-array.h>
|
||||
@@ -262,8 +262,9 @@ static int32_t browser_worker(void* context) {
|
||||
furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtConfigChange);
|
||||
|
||||
while(1) {
|
||||
uint32_t flags = furi_thread_flags_wait(WORKER_FLAGS_ALL, osFlagsWaitAny, osWaitForever);
|
||||
furi_assert((flags & osFlagsError) == 0);
|
||||
uint32_t flags =
|
||||
furi_thread_flags_wait(WORKER_FLAGS_ALL, FuriFlagWaitAny, FuriWaitForever);
|
||||
furi_assert((flags & FuriFlagError) == 0);
|
||||
|
||||
if(flags & WorkerEvtConfigChange) {
|
||||
// If start path is a path to the file - try finding index of this file in a folder
|
||||
|
@@ -7,7 +7,7 @@ struct Popup {
|
||||
void* context;
|
||||
PopupCallback callback;
|
||||
|
||||
osTimerId_t timer;
|
||||
FuriTimer* timer;
|
||||
uint32_t timer_period_in_ms;
|
||||
bool timer_enabled;
|
||||
};
|
||||
@@ -93,10 +93,11 @@ static bool popup_view_input_callback(InputEvent* event, void* context) {
|
||||
void popup_start_timer(void* context) {
|
||||
Popup* popup = context;
|
||||
if(popup->timer_enabled) {
|
||||
uint32_t timer_period = popup->timer_period_in_ms / (1000.0f / osKernelGetTickFreq());
|
||||
uint32_t timer_period =
|
||||
popup->timer_period_in_ms / (1000.0f / furi_kernel_get_tick_frequency());
|
||||
if(timer_period == 0) timer_period = 1;
|
||||
|
||||
if(osTimerStart(popup->timer, timer_period) != osOK) {
|
||||
if(furi_timer_start(popup->timer, timer_period) != FuriStatusOk) {
|
||||
furi_assert(0);
|
||||
};
|
||||
}
|
||||
@@ -104,13 +105,13 @@ void popup_start_timer(void* context) {
|
||||
|
||||
void popup_stop_timer(void* context) {
|
||||
Popup* popup = context;
|
||||
osTimerStop(popup->timer);
|
||||
furi_timer_stop(popup->timer);
|
||||
}
|
||||
|
||||
Popup* popup_alloc() {
|
||||
Popup* popup = malloc(sizeof(Popup));
|
||||
popup->view = view_alloc();
|
||||
popup->timer = osTimerNew(popup_timer_callback, osTimerOnce, popup, NULL);
|
||||
popup->timer = furi_timer_alloc(popup_timer_callback, FuriTimerTypeOnce, popup);
|
||||
furi_assert(popup->timer);
|
||||
popup->timer_period_in_ms = 1000;
|
||||
popup->timer_enabled = false;
|
||||
@@ -146,7 +147,7 @@ Popup* popup_alloc() {
|
||||
|
||||
void popup_free(Popup* popup) {
|
||||
furi_assert(popup);
|
||||
osTimerDelete(popup->timer);
|
||||
furi_timer_free(popup->timer);
|
||||
view_free(popup->view);
|
||||
free(popup);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
struct TextInput {
|
||||
View* view;
|
||||
osTimerId_t timer;
|
||||
FuriTimer* timer;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -310,7 +310,7 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, b
|
||||
(!model->validator_callback(
|
||||
model->text_buffer, model->validator_text, model->validator_callback_context))) {
|
||||
model->valadator_message_visible = true;
|
||||
osTimerStart(text_input->timer, osKernelGetTickFreq() * 4);
|
||||
furi_timer_start(text_input->timer, furi_kernel_get_tick_frequency() * 4);
|
||||
} else if(model->callback != 0 && text_length > 0) {
|
||||
model->callback(model->callback_context);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ TextInput* text_input_alloc() {
|
||||
view_set_draw_callback(text_input->view, text_input_view_draw_callback);
|
||||
view_set_input_callback(text_input->view, text_input_view_input_callback);
|
||||
|
||||
text_input->timer = osTimerNew(text_input_timer_callback, osTimerOnce, text_input, NULL);
|
||||
text_input->timer = furi_timer_alloc(text_input_timer_callback, FuriTimerTypeOnce, text_input);
|
||||
|
||||
with_view_model(
|
||||
text_input->view, (TextInputModel * model) {
|
||||
@@ -460,11 +460,11 @@ void text_input_free(TextInput* text_input) {
|
||||
});
|
||||
|
||||
// Send stop command
|
||||
osTimerStop(text_input->timer);
|
||||
furi_timer_stop(text_input->timer);
|
||||
// Wait till timer stop
|
||||
while(osTimerIsRunning(text_input->timer)) osDelay(1);
|
||||
while(furi_timer_is_running(text_input->timer)) furi_delay_tick(1);
|
||||
// Release allocated memory
|
||||
osTimerDelete(text_input->timer);
|
||||
furi_timer_free(text_input->timer);
|
||||
|
||||
view_free(text_input->view);
|
||||
|
||||
|
Reference in New Issue
Block a user