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:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <flipper.h>
|
||||
#include <assert.h>
|
||||
#include <flipper_v2.h>
|
||||
|
||||
Icon* icon_alloc(const IconData* data) {
|
||||
Icon* icon = furi_alloc(sizeof(Icon));
|
||||
@@ -12,12 +12,12 @@ Icon* icon_alloc(const IconData* data) {
|
||||
}
|
||||
|
||||
void icon_free(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
free(icon);
|
||||
}
|
||||
|
||||
const uint8_t* icon_get_data(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
if(icon->tick) {
|
||||
uint32_t now = osKernelGetTickCount();
|
||||
if(now < icon->tick) {
|
||||
@@ -32,32 +32,32 @@ const uint8_t* icon_get_data(Icon* icon) {
|
||||
}
|
||||
|
||||
void icon_next_frame(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
icon->frame = (icon->frame + 1) % icon->data->frame_count;
|
||||
}
|
||||
|
||||
uint8_t icon_get_width(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
return icon->data->width;
|
||||
}
|
||||
|
||||
uint8_t icon_get_height(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
return icon->data->height;
|
||||
}
|
||||
|
||||
bool icon_is_animated(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
return icon->data->frame_count > 1;
|
||||
}
|
||||
|
||||
void icon_start_animation(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
icon->tick = osKernelGetTickCount();
|
||||
}
|
||||
|
||||
void icon_stop_animation(Icon* icon) {
|
||||
assert(icon);
|
||||
furi_assert(icon);
|
||||
icon->tick = 0;
|
||||
icon->frame = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user