Implement ValueManager and ValueComposer (#183)
* Fix ValueManager implementation * Implement ValueComposer * Add constructor for ValueManager * Add value-expanders.h to flipper_v2.h set * Move COPY_COMPOSE body into a .c file * Add test for ValueManager * Add destructors for ValueMutex, ValueManager and ValueComposer * Use destructors in tests * Move composition logic into perform_compose() * Add docs for perform_compose() * Add test for ValueComposer * Replace atomic_bool with bool as g++ compiler doesn't support C11 atomics * Add Event type * Add semaphore support to the local target * Add test for Event * Update input records and relevant examples * Rename Event to AppEvent in the cc1101-workaround example * Rename Event to AppEvent in the irda example * Use Event in ValueComposer to wait for update request * Add perform_compose_internal() function * fix Event/AppEvent Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
#include "gui_event.h"
|
||||
|
||||
#include <flipper.h>
|
||||
#include <flipper_v2.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define GUI_EVENT_MQUEUE_SIZE 8
|
||||
|
||||
struct GuiEvent {
|
||||
FuriRecordSubscriber* input_event_record;
|
||||
PubSub* input_event_record;
|
||||
osMessageQueueId_t mqueue;
|
||||
osMutexId_t lock_mutex;
|
||||
};
|
||||
|
||||
void gui_event_input_events_callback(const void* value, size_t size, void* ctx) {
|
||||
void gui_event_input_events_callback(const void* value, void* ctx) {
|
||||
assert(ctx);
|
||||
GuiEvent* gui_event = ctx;
|
||||
|
||||
@@ -29,9 +29,10 @@ GuiEvent* gui_event_alloc() {
|
||||
assert(gui_event->mqueue);
|
||||
|
||||
// Input
|
||||
gui_event->input_event_record = furi_open_deprecated(
|
||||
"input_events", false, false, gui_event_input_events_callback, NULL, gui_event);
|
||||
gui_event->input_event_record = furi_open("input_events");
|
||||
assert(gui_event->input_event_record != NULL);
|
||||
subscribe_pubsub(gui_event->input_event_record, gui_event_input_events_callback, gui_event);
|
||||
|
||||
// Lock mutex
|
||||
gui_event->lock_mutex = osMutexNew(NULL);
|
||||
assert(gui_event->lock_mutex);
|
||||
|
Reference in New Issue
Block a user