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:
Vadim Kaushan
2020-10-26 12:26:15 +03:00
committed by GitHub
parent 69d97afea8
commit bb68fca20b
24 changed files with 641 additions and 96 deletions

View File

@@ -1,6 +1,6 @@
#include "flipper.h"
#include "flipper_v2.h"
static void event_cb(const void* value, size_t size, void* ctx) {
static void event_cb(const void* value, void* ctx) {
xSemaphoreGive((SemaphoreHandle_t*)ctx);
}
@@ -14,7 +14,9 @@ void backlight_control(void* p) {
SemaphoreHandle_t update = xSemaphoreCreateCountingStatic(255, 0, &event_descriptor);
// open record
furi_open_deprecated("input_events", false, false, event_cb, NULL, (void*)update);
PubSub* event_record = furi_open("input_events");
assert(event_record != NULL);
subscribe_pubsub(event_record, event_cb, (void*)update);
// we ready to work
furiac_ready();