2024-12-24 14:50:03 +00:00
|
|
|
#ifndef _INCLUDE_EXINT_EVENT_
|
|
|
|
#define _INCLUDE_EXINT_EVENT_
|
|
|
|
|
|
|
|
#define EXINT_EVENT
|
2024-12-02 15:16:25 +00:00
|
|
|
|
2024-12-14 06:39:28 +00:00
|
|
|
#include <stdint.h>
|
2024-12-02 15:16:25 +00:00
|
|
|
#include <stddef.h>
|
2024-12-24 14:50:03 +00:00
|
|
|
#include "external_interface_event.h"
|
2024-12-02 15:16:25 +00:00
|
|
|
|
|
|
|
#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);
|
2024-12-14 06:39:28 +00:00
|
|
|
void exint_event_thread_start(uint8_t num);
|
|
|
|
void exint_event_thread_stop();
|
2024-12-02 15:16:25 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|