furi_check - a new way to asserting (#204)

* hal-related task_is_isr_context function
* furi_check implementation
* change application to use furi_check
* add second level of assertion
* add TODO about ISR context
* Applications: refactor furi_check and furi_assert.
* Apploader: propwer widget usage. Menu: check on furi resource request.
* refactor furi_check

Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
Co-authored-by: coreglitch <mail@s3f.ru>
This commit is contained in:
DrZlo13
2020-10-29 09:27:17 +03:00
committed by GitHub
parent c9b921f6ce
commit 8aeafd8179
24 changed files with 292 additions and 136 deletions

View File

@@ -1,6 +1,5 @@
#include "nfc.h"
#include <assert.h>
#include <flipper_v2.h>
#include <gui/gui.h>
@@ -152,7 +151,9 @@ void nfc_worker_task(void* context) {
}
void nfc_draw_callback(CanvasApi* canvas, void* context) {
assert(context);
furi_assert(canvas);
furi_assert(context);
Nfc* nfc = context;
dispatcher_lock(nfc->dispatcher);
@@ -187,7 +188,8 @@ void nfc_draw_callback(CanvasApi* canvas, void* context) {
}
void nfc_input_callback(InputEvent* event, void* context) {
assert(context);
furi_assert(event);
furi_assert(context);
Nfc* nfc = context;
if(!event->state) return;
@@ -196,7 +198,7 @@ void nfc_input_callback(InputEvent* event, void* context) {
}
void nfc_test_callback(void* context) {
assert(context);
furi_assert(context);
Nfc* nfc = context;
dispatcher_lock(nfc->dispatcher);
@@ -213,21 +215,21 @@ void nfc_test_callback(void* context) {
}
void nfc_read_callback(void* context) {
assert(context);
furi_assert(context);
Nfc* nfc = context;
nfc->screen = 1;
widget_enabled_set(nfc->widget, true);
}
void nfc_write_callback(void* context) {
assert(context);
furi_assert(context);
Nfc* nfc = context;
nfc->screen = 1;
widget_enabled_set(nfc->widget, true);
}
void nfc_bridge_callback(void* context) {
assert(context);
furi_assert(context);
Nfc* nfc = context;
nfc->screen = 1;
widget_enabled_set(nfc->widget, true);
@@ -244,7 +246,7 @@ Nfc* nfc_alloc() {
widget_input_callback_set(nfc->widget, nfc_input_callback, nfc);
nfc->menu_vm = furi_open("menu");
assert(nfc->menu_vm);
furi_check(nfc->menu_vm);
nfc->menu = menu_item_alloc_menu("NFC", nfc->icon);
menu_item_subitem_add(
@@ -266,9 +268,9 @@ void nfc_task(void* p) {
Nfc* nfc = nfc_alloc();
FuriRecordSubscriber* gui_record = furi_open_deprecated("gui", false, false, NULL, NULL, NULL);
assert(gui_record);
furi_check(gui_record);
GuiApi* gui = furi_take(gui_record);
assert(gui);
furi_check(gui);
widget_enabled_set(nfc->widget, false);
gui->add_widget(gui, nfc->widget, GuiLayerFullscreen);
furi_commit(gui_record);