#ifndef _INCLUDE_EXINT_EVENT_ #define _INCLUDE_EXINT_EVENT_ #define EXINT_EVENT #include #include #include "external_interface_event.h" #define CONCAT_(prefix, suffix) prefix##suffix /// Concatenate `prefix, suffix` into `prefixsuffix` #define CONCAT(prefix, suffix) CONCAT_(prefix, suffix) /// Register event handler #define ON_EVENT_EX(name, func, data) \ static void func (const char* event_name, size_t args_size, void *args, void* user_data); \ int CONCAT(func, _register_ret) = exint_event_register(#name, func, data);\ static void func (const char* event_name, size_t args_size, void *args, void* user_data) #define ON_EVENT(name) ON_EVENT_EX(name, CONCAT(_event_ ## name ## _handle_line_, __LINE__), NULL) #ifdef __cplusplus extern "C" { #endif void exint_event(const char *event_name, size_t args_size, void *args); int exint_event_register(const char *event_name, event_callback callback, void* user_data); int exint_event_unregister(const char *event_name, event_callback callback, void* user_data); void exint_event_thread_start(uint8_t num); void exint_event_thread_stop(); #ifdef __cplusplus } #endif #endif