1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

[FL-3841] FuriEventLoop Pt.2 (#3703)

* Abstract primitive type from main logic in FuriEventLoop
* Remove message_queue_i.h
* Add stream buffer support for event loop
* Add semaphore support for event loop
* Add temporary unit test workaround
* Make the linter happy
* Add mutex support for event loop
* Implement event subscription and unsubscription while the event loop is running
* Implement edge events
* Fix leftover logical errors
* Add event loop timer example application
* Implement flag-based edge trigger and one-shot mode
* Add event loop mutex example application
* Only notify the event loop if stream buffer is at or above its trigger level
* Reformat comments
* Add event loop stream buffer example application
* Add event loop multiple elements example application
* Improve event loop flag names
* Remove redundant signal handler as it is already handled by the event loop
* Refactor Power service, improve ViewHolder
* Use ViewHolder instead of ViewDispatcher in About app
* Enable ViewDispatcher queue on construction, deprecate view_dispatcher_enable_queue()
* Remove all invocations of view_dispatcher_enable_queue()
* Remove app-scened-template
* Remove missing library from target.json
* Port Accessor app to ViewHolder
* Make the linter happy
* Add example_view_holder application, update ViewHolder docs
* Add example_view_dispatcher application, update ViewDispatcher docs
* Replace FuriSemaphore with FuriApiLock, remove workaround delay
* Fix logical error
* Fix another logical error
* Use the sources directive to speed up compilation
* Use constant define macro
* Improve FuriEventLoop documentation
* Improve FuriEventLoop documentation once more
* Bump API Version
* Gui: remove redundant checks from ViewDispatcher
* Gui: remove dead ifs from ViewDispatcher

Co-authored-by: Silent <CookiePLMonster@users.noreply.github.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
MX
2024-08-10 14:32:27 +03:00
parent 1e5dd001fe
commit bf6c6c231f
104 changed files with 2099 additions and 1757 deletions

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,71.0,,
Version,+,72.0,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
Header,+,applications/services/cli/cli.h,,
@@ -1108,11 +1108,13 @@ Function,+,furi_event_flag_set,uint32_t,"FuriEventFlag*, uint32_t"
Function,+,furi_event_flag_wait,uint32_t,"FuriEventFlag*, uint32_t, uint32_t, uint32_t"
Function,+,furi_event_loop_alloc,FuriEventLoop*,
Function,+,furi_event_loop_free,void,FuriEventLoop*
Function,+,furi_event_loop_message_queue_subscribe,void,"FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopMessageQueueCallback, void*"
Function,+,furi_event_loop_message_queue_unsubscribe,void,"FuriEventLoop*, FuriMessageQueue*"
Function,+,furi_event_loop_pend_callback,void,"FuriEventLoop*, FuriEventLoopPendingCallback, void*"
Function,+,furi_event_loop_run,void,FuriEventLoop*
Function,+,furi_event_loop_stop,void,FuriEventLoop*
Function,+,furi_event_loop_subscribe_message_queue,void,"FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_mutex,void,"FuriEventLoop*, FuriMutex*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_semaphore,void,"FuriEventLoop*, FuriSemaphore*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_stream_buffer,void,"FuriEventLoop*, FuriStreamBuffer*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_tick_set,void,"FuriEventLoop*, uint32_t, FuriEventLoopTickCallback, void*"
Function,+,furi_event_loop_timer_alloc,FuriEventLoopTimer*,"FuriEventLoop*, FuriEventLoopTimerCallback, FuriEventLoopTimerType, void*"
Function,+,furi_event_loop_timer_free,void,FuriEventLoopTimer*
@@ -1122,6 +1124,7 @@ Function,+,furi_event_loop_timer_is_running,_Bool,const FuriEventLoopTimer*
Function,+,furi_event_loop_timer_restart,void,FuriEventLoopTimer*
Function,+,furi_event_loop_timer_start,void,"FuriEventLoopTimer*, uint32_t"
Function,+,furi_event_loop_timer_stop,void,FuriEventLoopTimer*
Function,+,furi_event_loop_unsubscribe,void,"FuriEventLoop*, FuriEventLoopObject*"
Function,+,furi_get_tick,uint32_t,
Function,+,furi_hal_adc_acquire,FuriHalAdcHandle*,
Function,+,furi_hal_adc_configure,void,FuriHalAdcHandle*
@@ -1544,6 +1547,7 @@ Function,+,furi_semaphore_acquire,FuriStatus,"FuriSemaphore*, uint32_t"
Function,+,furi_semaphore_alloc,FuriSemaphore*,"uint32_t, uint32_t"
Function,+,furi_semaphore_free,void,FuriSemaphore*
Function,+,furi_semaphore_get_count,uint32_t,FuriSemaphore*
Function,+,furi_semaphore_get_space,uint32_t,FuriSemaphore*
Function,+,furi_semaphore_release,FuriStatus,FuriSemaphore*
Function,+,furi_stream_buffer_alloc,FuriStreamBuffer*,"size_t, size_t"
Function,+,furi_stream_buffer_bytes_available,size_t,FuriStreamBuffer*
@@ -2282,7 +2286,7 @@ Function,+,power_get_info,void,"Power*, PowerInfo*"
Function,+,power_get_pubsub,FuriPubSub*,Power*
Function,+,power_is_battery_healthy,_Bool,Power*
Function,+,power_off,void,Power*
Function,+,power_reboot,void,PowerBootMode
Function,+,power_reboot,void,"Power*, PowerBootMode"
Function,+,powf,float,"float, float"
Function,-,powl,long double,"long double, long double"
Function,+,pretty_format_bytes_hex_canonical,void,"FuriString*, size_t, const char*, const uint8_t*, size_t"
@@ -2757,11 +2761,11 @@ Function,+,view_holder_alloc,ViewHolder*,
Function,+,view_holder_attach_to_gui,void,"ViewHolder*, Gui*"
Function,+,view_holder_free,void,ViewHolder*
Function,+,view_holder_get_free_context,void*,ViewHolder*
Function,+,view_holder_send_to_back,void,ViewHolder*
Function,+,view_holder_send_to_front,void,ViewHolder*
Function,+,view_holder_set_back_callback,void,"ViewHolder*, BackCallback, void*"
Function,+,view_holder_set_free_callback,void,"ViewHolder*, FreeCallback, void*"
Function,+,view_holder_set_view,void,"ViewHolder*, View*"
Function,+,view_holder_start,void,ViewHolder*
Function,+,view_holder_stop,void,ViewHolder*
Function,+,view_holder_update,void,"View*, void*"
Function,+,view_port_alloc,ViewPort*,
Function,+,view_port_draw_callback_set,void,"ViewPort*, ViewPortDrawCallback, void*"
1 entry status name type params
2 Version + 71.0 72.0
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/bt/bt_service/bt_keys_storage.h
5 Header + applications/services/cli/cli.h
1108 Function + furi_event_flag_wait uint32_t FuriEventFlag*, uint32_t, uint32_t, uint32_t
1109 Function + furi_event_loop_alloc FuriEventLoop*
1110 Function + furi_event_loop_free void FuriEventLoop*
Function + furi_event_loop_message_queue_subscribe void FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopMessageQueueCallback, void*
Function + furi_event_loop_message_queue_unsubscribe void FuriEventLoop*, FuriMessageQueue*
1111 Function + furi_event_loop_pend_callback void FuriEventLoop*, FuriEventLoopPendingCallback, void*
1112 Function + furi_event_loop_run void FuriEventLoop*
1113 Function + furi_event_loop_stop void FuriEventLoop*
1114 Function + furi_event_loop_subscribe_message_queue void FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1115 Function + furi_event_loop_subscribe_mutex void FuriEventLoop*, FuriMutex*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1116 Function + furi_event_loop_subscribe_semaphore void FuriEventLoop*, FuriSemaphore*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1117 Function + furi_event_loop_subscribe_stream_buffer void FuriEventLoop*, FuriStreamBuffer*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1118 Function + furi_event_loop_tick_set void FuriEventLoop*, uint32_t, FuriEventLoopTickCallback, void*
1119 Function + furi_event_loop_timer_alloc FuriEventLoopTimer* FuriEventLoop*, FuriEventLoopTimerCallback, FuriEventLoopTimerType, void*
1120 Function + furi_event_loop_timer_free void FuriEventLoopTimer*
1124 Function + furi_event_loop_timer_restart void FuriEventLoopTimer*
1125 Function + furi_event_loop_timer_start void FuriEventLoopTimer*, uint32_t
1126 Function + furi_event_loop_timer_stop void FuriEventLoopTimer*
1127 Function + furi_event_loop_unsubscribe void FuriEventLoop*, FuriEventLoopObject*
1128 Function + furi_get_tick uint32_t
1129 Function + furi_hal_adc_acquire FuriHalAdcHandle*
1130 Function + furi_hal_adc_configure void FuriHalAdcHandle*
1547 Function + furi_semaphore_alloc FuriSemaphore* uint32_t, uint32_t
1548 Function + furi_semaphore_free void FuriSemaphore*
1549 Function + furi_semaphore_get_count uint32_t FuriSemaphore*
1550 Function + furi_semaphore_get_space uint32_t FuriSemaphore*
1551 Function + furi_semaphore_release FuriStatus FuriSemaphore*
1552 Function + furi_stream_buffer_alloc FuriStreamBuffer* size_t, size_t
1553 Function + furi_stream_buffer_bytes_available size_t FuriStreamBuffer*
2286 Function + power_get_pubsub FuriPubSub* Power*
2287 Function + power_is_battery_healthy _Bool Power*
2288 Function + power_off void Power*
2289 Function + power_reboot void PowerBootMode Power*, PowerBootMode
2290 Function + powf float float, float
2291 Function - powl long double long double, long double
2292 Function + pretty_format_bytes_hex_canonical void FuriString*, size_t, const char*, const uint8_t*, size_t
2761 Function + view_holder_attach_to_gui void ViewHolder*, Gui*
2762 Function + view_holder_free void ViewHolder*
2763 Function + view_holder_get_free_context void* ViewHolder*
2764 Function + view_holder_send_to_back void ViewHolder*
2765 Function + view_holder_send_to_front void ViewHolder*
2766 Function + view_holder_set_back_callback void ViewHolder*, BackCallback, void*
2767 Function + view_holder_set_free_callback void ViewHolder*, FreeCallback, void*
2768 Function + view_holder_set_view void ViewHolder*, View*
Function + view_holder_start void ViewHolder*
Function + view_holder_stop void ViewHolder*
2769 Function + view_holder_update void View*, void*
2770 Function + view_port_alloc ViewPort*
2771 Function + view_port_draw_callback_set void ViewPort*, ViewPortDrawCallback, void*

View File

@@ -22,7 +22,6 @@
"signal_reader",
"microtar",
"usb_stm32",
"appframe",
"assets",
"one_wire",
"music_worker",

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,71.0,,
Version,+,72.0,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
@@ -1243,11 +1243,13 @@ Function,+,furi_event_flag_set,uint32_t,"FuriEventFlag*, uint32_t"
Function,+,furi_event_flag_wait,uint32_t,"FuriEventFlag*, uint32_t, uint32_t, uint32_t"
Function,+,furi_event_loop_alloc,FuriEventLoop*,
Function,+,furi_event_loop_free,void,FuriEventLoop*
Function,+,furi_event_loop_message_queue_subscribe,void,"FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopMessageQueueCallback, void*"
Function,+,furi_event_loop_message_queue_unsubscribe,void,"FuriEventLoop*, FuriMessageQueue*"
Function,+,furi_event_loop_pend_callback,void,"FuriEventLoop*, FuriEventLoopPendingCallback, void*"
Function,+,furi_event_loop_run,void,FuriEventLoop*
Function,+,furi_event_loop_stop,void,FuriEventLoop*
Function,+,furi_event_loop_subscribe_message_queue,void,"FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_mutex,void,"FuriEventLoop*, FuriMutex*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_semaphore,void,"FuriEventLoop*, FuriSemaphore*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_subscribe_stream_buffer,void,"FuriEventLoop*, FuriStreamBuffer*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*"
Function,+,furi_event_loop_tick_set,void,"FuriEventLoop*, uint32_t, FuriEventLoopTickCallback, void*"
Function,+,furi_event_loop_timer_alloc,FuriEventLoopTimer*,"FuriEventLoop*, FuriEventLoopTimerCallback, FuriEventLoopTimerType, void*"
Function,+,furi_event_loop_timer_free,void,FuriEventLoopTimer*
@@ -1257,6 +1259,7 @@ Function,+,furi_event_loop_timer_is_running,_Bool,const FuriEventLoopTimer*
Function,+,furi_event_loop_timer_restart,void,FuriEventLoopTimer*
Function,+,furi_event_loop_timer_start,void,"FuriEventLoopTimer*, uint32_t"
Function,+,furi_event_loop_timer_stop,void,FuriEventLoopTimer*
Function,+,furi_event_loop_unsubscribe,void,"FuriEventLoop*, FuriEventLoopObject*"
Function,+,furi_get_tick,uint32_t,
Function,+,furi_hal_adc_acquire,FuriHalAdcHandle*,
Function,+,furi_hal_adc_configure,void,FuriHalAdcHandle*
@@ -1797,6 +1800,7 @@ Function,+,furi_semaphore_acquire,FuriStatus,"FuriSemaphore*, uint32_t"
Function,+,furi_semaphore_alloc,FuriSemaphore*,"uint32_t, uint32_t"
Function,+,furi_semaphore_free,void,FuriSemaphore*
Function,+,furi_semaphore_get_count,uint32_t,FuriSemaphore*
Function,+,furi_semaphore_get_space,uint32_t,FuriSemaphore*
Function,+,furi_semaphore_release,FuriStatus,FuriSemaphore*
Function,+,furi_stream_buffer_alloc,FuriStreamBuffer*,"size_t, size_t"
Function,+,furi_stream_buffer_bytes_available,size_t,FuriStreamBuffer*
@@ -2954,7 +2958,7 @@ Function,+,power_get_info,void,"Power*, PowerInfo*"
Function,+,power_get_pubsub,FuriPubSub*,Power*
Function,+,power_is_battery_healthy,_Bool,Power*
Function,+,power_off,void,Power*
Function,+,power_reboot,void,PowerBootMode
Function,+,power_reboot,void,"Power*, PowerBootMode"
Function,-,power_trigger_ui_update,void,Power*
Function,+,powf,float,"float, float"
Function,-,powl,long double,"long double, long double"
@@ -3671,11 +3675,11 @@ Function,+,view_holder_alloc,ViewHolder*,
Function,+,view_holder_attach_to_gui,void,"ViewHolder*, Gui*"
Function,+,view_holder_free,void,ViewHolder*
Function,+,view_holder_get_free_context,void*,ViewHolder*
Function,+,view_holder_send_to_back,void,ViewHolder*
Function,+,view_holder_send_to_front,void,ViewHolder*
Function,+,view_holder_set_back_callback,void,"ViewHolder*, BackCallback, void*"
Function,+,view_holder_set_free_callback,void,"ViewHolder*, FreeCallback, void*"
Function,+,view_holder_set_view,void,"ViewHolder*, View*"
Function,+,view_holder_start,void,ViewHolder*
Function,+,view_holder_stop,void,ViewHolder*
Function,+,view_holder_update,void,"View*, void*"
Function,+,view_port_alloc,ViewPort*,
Function,+,view_port_draw_callback_set,void,"ViewPort*, ViewPortDrawCallback, void*"
1 entry status name type params
2 Version + 71.0 72.0
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/bt/bt_service/bt.h
5 Header + applications/services/bt/bt_service/bt_keys_storage.h
1243 Function + furi_event_flag_wait uint32_t FuriEventFlag*, uint32_t, uint32_t, uint32_t
1244 Function + furi_event_loop_alloc FuriEventLoop*
1245 Function + furi_event_loop_free void FuriEventLoop*
Function + furi_event_loop_message_queue_subscribe void FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopMessageQueueCallback, void*
Function + furi_event_loop_message_queue_unsubscribe void FuriEventLoop*, FuriMessageQueue*
1246 Function + furi_event_loop_pend_callback void FuriEventLoop*, FuriEventLoopPendingCallback, void*
1247 Function + furi_event_loop_run void FuriEventLoop*
1248 Function + furi_event_loop_stop void FuriEventLoop*
1249 Function + furi_event_loop_subscribe_message_queue void FuriEventLoop*, FuriMessageQueue*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1250 Function + furi_event_loop_subscribe_mutex void FuriEventLoop*, FuriMutex*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1251 Function + furi_event_loop_subscribe_semaphore void FuriEventLoop*, FuriSemaphore*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1252 Function + furi_event_loop_subscribe_stream_buffer void FuriEventLoop*, FuriStreamBuffer*, FuriEventLoopEvent, FuriEventLoopEventCallback, void*
1253 Function + furi_event_loop_tick_set void FuriEventLoop*, uint32_t, FuriEventLoopTickCallback, void*
1254 Function + furi_event_loop_timer_alloc FuriEventLoopTimer* FuriEventLoop*, FuriEventLoopTimerCallback, FuriEventLoopTimerType, void*
1255 Function + furi_event_loop_timer_free void FuriEventLoopTimer*
1259 Function + furi_event_loop_timer_restart void FuriEventLoopTimer*
1260 Function + furi_event_loop_timer_start void FuriEventLoopTimer*, uint32_t
1261 Function + furi_event_loop_timer_stop void FuriEventLoopTimer*
1262 Function + furi_event_loop_unsubscribe void FuriEventLoop*, FuriEventLoopObject*
1263 Function + furi_get_tick uint32_t
1264 Function + furi_hal_adc_acquire FuriHalAdcHandle*
1265 Function + furi_hal_adc_configure void FuriHalAdcHandle*
1800 Function + furi_semaphore_alloc FuriSemaphore* uint32_t, uint32_t
1801 Function + furi_semaphore_free void FuriSemaphore*
1802 Function + furi_semaphore_get_count uint32_t FuriSemaphore*
1803 Function + furi_semaphore_get_space uint32_t FuriSemaphore*
1804 Function + furi_semaphore_release FuriStatus FuriSemaphore*
1805 Function + furi_stream_buffer_alloc FuriStreamBuffer* size_t, size_t
1806 Function + furi_stream_buffer_bytes_available size_t FuriStreamBuffer*
2958 Function + power_get_pubsub FuriPubSub* Power*
2959 Function + power_is_battery_healthy _Bool Power*
2960 Function + power_off void Power*
2961 Function + power_reboot void PowerBootMode Power*, PowerBootMode
2962 Function - power_trigger_ui_update void Power*
2963 Function + powf float float, float
2964 Function - powl long double long double, long double
3675 Function + view_holder_attach_to_gui void ViewHolder*, Gui*
3676 Function + view_holder_free void ViewHolder*
3677 Function + view_holder_get_free_context void* ViewHolder*
3678 Function + view_holder_send_to_back void ViewHolder*
3679 Function + view_holder_send_to_front void ViewHolder*
3680 Function + view_holder_set_back_callback void ViewHolder*, BackCallback, void*
3681 Function + view_holder_set_free_callback void ViewHolder*, FreeCallback, void*
3682 Function + view_holder_set_view void ViewHolder*, View*
Function + view_holder_start void ViewHolder*
Function + view_holder_stop void ViewHolder*
3683 Function + view_holder_update void View*, void*
3684 Function + view_port_alloc ViewPort*
3685 Function + view_port_draw_callback_set void ViewPort*, ViewPortDrawCallback, void*

View File

@@ -34,7 +34,6 @@
"microtar",
"usb_stm32",
"infrared",
"appframe",
"assets",
"one_wire",
"ibutton",