ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
tmboy
Date:
Tue Jul 18 09:08:52 2017 +0000
Revision:
50:9ecaa144d1f3
Parent:
47:9e361da97763
add .json

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 // Copyright (2016) Baidu Inc. All rights reserved.
TMBOY 47:9e361da97763 2
TMBOY 47:9e361da97763 3 #ifndef BAIDU_IOT_TINYDU_DEMO_EVENTS_H
TMBOY 47:9e361da97763 4 #define BAIDU_IOT_TINYDU_DEMO_EVENTS_H
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 #include <mbed.h>
TMBOY 47:9e361da97763 7
TMBOY 47:9e361da97763 8 namespace duer {
TMBOY 47:9e361da97763 9
TMBOY 47:9e361da97763 10 enum Events {
TMBOY 47:9e361da97763 11 EVT_KEY_REC_PRESS,
TMBOY 47:9e361da97763 12 EVT_KEY_REC_RELEASE,
TMBOY 47:9e361da97763 13 EVT_KEY_PAUSE,
TMBOY 47:9e361da97763 14 EVT_TOTAL
TMBOY 47:9e361da97763 15 };
TMBOY 47:9e361da97763 16
TMBOY 47:9e361da97763 17 #ifdef MBED_HEAP_STATS_ENABLED
TMBOY 47:9e361da97763 18 extern void memory_statistics(const char* tag);
TMBOY 47:9e361da97763 19 #define MEMORY_STATISTICS(...) memory_statistics(__VA_ARGS__)
TMBOY 47:9e361da97763 20 #else
TMBOY 47:9e361da97763 21 #define MEMORY_STATISTICS(...)
TMBOY 47:9e361da97763 22 #endif
TMBOY 47:9e361da97763 23
TMBOY 47:9e361da97763 24 typedef mbed::Callback<void ()> event_handle_func;
TMBOY 47:9e361da97763 25
TMBOY 47:9e361da97763 26 void event_set_handler(uint32_t evt_id, event_handle_func handler);
TMBOY 47:9e361da97763 27
TMBOY 47:9e361da97763 28 template<typename T, typename M>
TMBOY 47:9e361da97763 29 void event_set_handler(uint32_t evt_id, T* obj, M method) {
TMBOY 47:9e361da97763 30 event_set_handler(evt_id, event_handle_func(obj, method));
TMBOY 47:9e361da97763 31 }
TMBOY 47:9e361da97763 32
TMBOY 47:9e361da97763 33 void event_trigger(uint32_t evt_id);
TMBOY 47:9e361da97763 34
TMBOY 47:9e361da97763 35 void event_loop();
TMBOY 47:9e361da97763 36
TMBOY 47:9e361da97763 37 } // namespace duer
TMBOY 47:9e361da97763 38
TMBOY 47:9e361da97763 39 #endif // BAIDU_IOT_TINYDU_DEMO_EVENTS_H