2022-12-24 14:54:46 +08:00
|
|
|
#include "PikaStdDevice_common.h"
|
|
|
|
|
|
|
|
extern PikaEventListener* g_pika_device_event_listener;
|
|
|
|
void _PikaStdDevice_event_handler(pika_dev* dev, int signal) {
|
2022-12-27 16:07:22 +08:00
|
|
|
pks_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
|
2023-01-09 21:55:57 +08:00
|
|
|
signal);
|
2022-12-24 14:54:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void _PikaStdDevice_setCallBack(PikaObj* self,
|
|
|
|
Arg* eventCallback,
|
|
|
|
uint32_t eventId) {
|
|
|
|
obj_setArg(self, "eventCallBack", eventCallback);
|
|
|
|
/* init event_listener for the first time */
|
|
|
|
if (NULL == g_pika_device_event_listener) {
|
2022-12-27 16:07:22 +08:00
|
|
|
pks_eventListener_init(&g_pika_device_event_listener);
|
2022-12-24 14:54:46 +08:00
|
|
|
}
|
|
|
|
/* regist event to event listener */
|
2022-12-27 16:07:22 +08:00
|
|
|
pks_eventListener_registEvent(g_pika_device_event_listener, eventId, self);
|
2022-12-24 14:54:46 +08:00
|
|
|
}
|
2023-01-09 21:55:57 +08:00
|
|
|
|
|
|
|
extern volatile PikaObj* __pikaMain;
|
|
|
|
PikaObj* PikaStdDevice_Time(PikaObj* self) {
|
|
|
|
return obj_getPtr((PikaObj*)__pikaMain, "time");
|
|
|
|
}
|