mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
redirect PikaStdDevice.Time to time, fix msc
This commit is contained in:
parent
1610574158
commit
8021938826
@ -98,8 +98,8 @@ class GPIO(BaseDev):
|
||||
def platformRead(self): ...
|
||||
|
||||
|
||||
# class Time(BaseDev):
|
||||
# use time module instead
|
||||
def Time() -> time:
|
||||
""" # use time module instead """
|
||||
|
||||
|
||||
class ADC(BaseDev):
|
||||
|
@ -3,7 +3,7 @@
|
||||
extern PikaEventListener* g_pika_device_event_listener;
|
||||
void _PikaStdDevice_event_handler(pika_dev* dev, int signal) {
|
||||
pks_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
|
||||
signal);
|
||||
signal);
|
||||
}
|
||||
|
||||
void _PikaStdDevice_setCallBack(PikaObj* self,
|
||||
@ -17,3 +17,14 @@ void _PikaStdDevice_setCallBack(PikaObj* self,
|
||||
/* regist event to event listener */
|
||||
pks_eventListener_registEvent(g_pika_device_event_listener, eventId, self);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ class GPIO(BaseDev):
|
||||
def platformRead(self): ...
|
||||
|
||||
|
||||
# def Time() -> time:
|
||||
# """ # use time module instead """
|
||||
def Time() -> time:
|
||||
""" # use time module instead """
|
||||
|
||||
|
||||
class ADC(BaseDev):
|
||||
|
@ -20,5 +20,11 @@ void _PikaStdDevice_setCallBack(PikaObj* self,
|
||||
|
||||
extern volatile PikaObj* __pikaMain;
|
||||
PikaObj* PikaStdDevice_Time(PikaObj* self) {
|
||||
return obj_getPtr((PikaObj*)__pikaMain, "time");
|
||||
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;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
Binary file not shown.
@ -397,11 +397,11 @@ impl Compiler {
|
||||
|
||||
/* analyse function define */
|
||||
if line.starts_with("def ") {
|
||||
let package_now_name = match compiler.package_name_now.clone() {
|
||||
let package_now_name = file_name.clone();
|
||||
let package_now = match compiler.class_list.get_mut(&package_now_name) {
|
||||
Some(s) => s,
|
||||
None => return compiler,
|
||||
};
|
||||
let package_now = compiler.class_list.get_mut(&package_now_name).unwrap();
|
||||
package_now.push_method(line, compiler.decorator_list_now.clone());
|
||||
compiler.decorator_list_now.clear();
|
||||
return compiler;
|
||||
|
Loading…
x
Reference in New Issue
Block a user