mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
27 lines
900 B
C
27 lines
900 B
C
#include "PikaStdDevice_common.h"
|
|
|
|
extern PikaEventListener* g_pika_device_event_listener;
|
|
void _PikaStdDevice_event_handler(pika_dev* dev, int signal) {
|
|
pika_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
|
|
signal);
|
|
}
|
|
|
|
void _PikaStdDevice_setCallBack(PikaObj* self,
|
|
Arg* eventCallback,
|
|
uint32_t eventId) {
|
|
obj_setEventCallBack(self, eventId, eventCallback,
|
|
&g_pika_device_event_listener);
|
|
}
|
|
|
|
extern volatile PikaObj* __pikaMain;
|
|
PikaObj* PikaStdDevice_Time(PikaObj* self) {
|
|
PikaObj* time = obj_getPtr((PikaObj*)__pikaMain, "time");
|
|
if (NULL == time) {
|
|
obj_setErrorCode(self, -1);
|
|
obj_setSysOut(self, "Error: please install and import 'time' module");
|
|
return NULL;
|
|
}
|
|
obj_refcntInc(time);
|
|
return time;
|
|
}
|