Преглед на файлове

add comment and rename run_always to run_forever

lyon преди 4 години
родител
ревизия
58529cd6f2

+ 1 - 1
examples/Task/main.py

@@ -34,5 +34,5 @@ task = STM32G0.Task()
 task.call_period_ms(rgb_task, 50)
 task.call_period_ms(led_task, 500)
 
-task.run_always()
+task.run_forever()
 

+ 9 - 2
package/PikaStdTask/PikaStdTask.py

@@ -8,23 +8,30 @@ class Task(TinyObj):
     def __init__():
         pass
 
+    # regist a function to be called always
     def call_always(fun_todo: any):
         pass
-
+    
+    # regist a function to be called when fun_when() return 'True'
     def call_when(fun_todo: any, fun_when: any):
         pass
 
+    # regist a function to be called periodically 
     def call_period_ms(fun_todo: any, period_ms: int):
         pass
 
+    # run all registed function once
     def run_once():
         pass
 
-    def run_always():
+    # run all registed function forever
+    def run_forever():
         pass
 
+    # run all registed function until time is up
     def run_until_ms(until_ms: int):
         pass
 
+    # need be overried to supply the system tick
     def platformGetTick():
         pass

+ 1 - 1
package/PikaStdTask/PikaStdTask_Task.c

@@ -259,7 +259,7 @@ void __Task_update_tick(PikaObj* self) {
     }
 }
 
-void PikaStdTask_Task_run_always(PikaObj* self) {
+void PikaStdTask_Task_run_forever(PikaObj* self) {
     while (1) {
         __Task_update_tick(self);
         PikaStdTask_Task_run_once(self);

+ 9 - 2
port/linux/package/pikascript/PikaStdTask.py

@@ -8,23 +8,30 @@ class Task(TinyObj):
     def __init__():
         pass
 
+    # regist a function to be called always
     def call_always(fun_todo: any):
         pass
-
+    
+    # regist a function to be called when fun_when() return 'True'
     def call_when(fun_todo: any, fun_when: any):
         pass
 
+    # regist a function to be called periodically 
     def call_period_ms(fun_todo: any, period_ms: int):
         pass
 
+    # run all registed function once
     def run_once():
         pass
 
-    def run_always():
+    # run all registed function forever
+    def run_forever():
         pass
 
+    # run all registed function until time is up
     def run_until_ms(until_ms: int):
         pass
 
+    # need be overried to supply the system tick
     def platformGetTick():
         pass

+ 1 - 1
port/linux/package/pikascript/pikascript-lib/PikaStdTask/PikaStdTask.py

@@ -25,7 +25,7 @@ class Task(TinyObj):
     def run_once():
         pass
 
-    def run_always():
+    def run_forever():
         pass
 
     def platformGetTick():

+ 1 - 1
port/linux/package/pikascript/pikascript-lib/PikaStdTask/PikaStdTask_Task.c

@@ -259,7 +259,7 @@ void __Task_update_tick(PikaObj* self) {
     }
 }
 
-void PikaStdTask_Task_run_always(PikaObj* self) {
+void PikaStdTask_Task_run_forever(PikaObj* self) {
     while (1) {
         __Task_update_tick(self);
         PikaStdTask_Task_run_once(self);