more work on ESP events
This commit is contained in:
parent
bbb007f6c4
commit
e3e76f57b3
3 changed files with 18 additions and 2 deletions
|
@ -2,7 +2,7 @@ set(REQUIRES "")
|
|||
set(SRCS "src/configulator.c")
|
||||
|
||||
if(${ESP_PLATFORM})
|
||||
list(APPEND REQUIRES nvs_flash)
|
||||
list(APPEND REQUIRES nvs_flash esp_event)
|
||||
list(APPEND SRCS src/cfglr_nvs.c src/cfglr_signal_idf_event.c)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#ifndef __IDF_EVENT_H__
|
||||
#define __IDF_EVENT_H__
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "esp_event.h"
|
||||
#include "configulator.h"
|
||||
|
||||
ESP_EVENT_DECLARE_BASE(CFGLR_EVENT_BASE);
|
||||
|
||||
uint8_t cfglr_signaler_idf_init(cfglr_signaler_t *signaler, cfglr_handle_t *handle);
|
||||
uint8_t cfglr_signaler_idf_dispatch(cfglr_signaler_t *signaler, cfglr_element_t *element, cfglr_signal_e sig);
|
||||
|
||||
|
@ -11,3 +15,4 @@ uint8_t cfglr_signaler_idf_dispatch(cfglr_signaler_t *signaler, cfglr_element_t
|
|||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
#include "configulator.h"
|
||||
#include "cfglr_log.h"
|
||||
#include "cfglr_signaler_idf_event.h"
|
||||
|
||||
ESP_EVENT_DEFINE_BASE(CFGLR_EVENT_BASE);
|
||||
|
||||
#define TAG "CFGLR_SIG_IDF"
|
||||
|
||||
const char* cfglr_signal_names[] = {
|
||||
"CFGLR_SIGNAL_LOADED",
|
||||
"CFGLR_SIGNAL_CHANGE",
|
||||
"CFGLR_SIGNAL_DELETE",
|
||||
};
|
||||
|
||||
uint8_t cfglr_signaler_idf_dispatch(cfglr_signaler_t *signaler, cfglr_element_t *element, cfglr_signal_e sig) {
|
||||
CFGLR_LOGI(TAG, "Dispatch!: %d", sig);
|
||||
CFGLR_LOGI(TAG, "dispatch: %s", cfglr_signal_names[sig]);
|
||||
|
||||
esp_event_post(CFGLR_EVENT_BASE, sig, element->data, element->datatype_size, portMAX_DELAY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue