32 #include <LLUI_INPUT_impl.h> 35 #include "microui_event_decoder.h" 37 #ifdef MICROUIEVENTDECODER_ENABLED 46 #define QUEUE_LOG_MAX_SIZE 100 55 static MICROUI_EVENT_DECODER_decode_event_data fct_decode_data;
60 static uint8_t queue_log[QUEUE_LOG_MAX_SIZE];
65 static bool queue_is_first_element;
70 static uint32_t dump_current_event;
76 void LLUI_INPUT_IMPL_log_queue_init(uint32_t length) {
77 assert(length <= (uint32_t)QUEUE_LOG_MAX_SIZE);
78 (void)memset((
void*)queue_log, 0, length);
79 queue_is_first_element =
true;
82 void LLUI_INPUT_IMPL_log_queue_full(uint32_t data) {
87 void LLUI_INPUT_IMPL_log_queue_add(uint32_t data, uint32_t index, uint32_t remaining_elements, uint32_t queue_length) {
91 if (queue_is_first_element) {
93 queue_log[index] = (uint8_t)(remaining_elements + (uint32_t)1);
101 queue_is_first_element = remaining_elements == (uint32_t)0;
104 void LLUI_INPUT_IMPL_log_queue_replace(uint32_t old, uint32_t data, uint32_t index, uint32_t queue_length) {
112 void LLUI_INPUT_IMPL_log_queue_read(uint32_t data, uint32_t index) {
118 void LLUI_INPUT_IMPL_log_dump(
bool log_type, uint32_t log, uint32_t index) {
122 if ((uint32_t)0 != queue_log[index]) {
124 dump_current_event = log;
127 fct_decode_data = NULL;
130 MICROUI_EVENT_DECODER_decode_event(log, index, &fct_decode_data);
132 else if (NULL != fct_decode_data) {
134 fct_decode_data(dump_current_event, log, index);
138 MICROUI_EVENT_DECODER_drop_data(log, index);
148 MICROUI_EVENT_DECODER_describe_dump_start();
149 MICROUI_EVENT_DECODER_describe_dump_past();
152 fct_decode_data = NULL;
157 MICROUI_EVENT_DECODER_describe_dump_future();
162 MICROUI_EVENT_DECODER_describe_dump_events_objects();
168 MICROUI_EVENT_DECODER_describe_dump_end();
174 #endif // MICROUIEVENTDECODER_ENABLED