【完善】miropython 自动补全优化
This commit is contained in:
parent
977d41f0cb
commit
3780c39c6c
|
|
@ -79,6 +79,7 @@ Usage Model::
|
|||
MED_POWER = ... # type: int
|
||||
HIGH_POWER = ... # type: int
|
||||
OUT_PP = ... # type: int
|
||||
OUT_OD = ... # type: int
|
||||
|
||||
def __init__(self, id: Any, mode: int = -1, pull: int = -1, *,
|
||||
value: Optional[int] = None,
|
||||
|
|
@ -677,7 +678,7 @@ class Timer(object):
|
|||
:param id: Timer ID.
|
||||
"""
|
||||
|
||||
def init(mode : Timer.PERIODIC, period : int, callback : func) -> None:
|
||||
def init(self, mode : Timer.PERIODIC, period : int, callback : func) -> None:
|
||||
"""
|
||||
Init the timer. Start the timer, and enable the timer peripheral.
|
||||
"""
|
||||
|
|
@ -700,7 +701,7 @@ class ADC(object):
|
|||
"""
|
||||
"""
|
||||
|
||||
def init(channel) -> None:
|
||||
def init(self, channel : int) -> None:
|
||||
"""
|
||||
根据输入的层参数初始化 ADC 对象,入参为使用的 ADC 对象通道号;
|
||||
"""
|
||||
|
|
@ -712,7 +713,7 @@ class ADC(object):
|
|||
"""
|
||||
...
|
||||
|
||||
def read() -> None:
|
||||
def read(self) -> None:
|
||||
"""
|
||||
用于获取并返回当前 ADC 对象的采样值。例如当前采样值为 2048,对应设备的分辨率为 12位,当前设备参考电压为 3.3V ,则该 ADC 对象通道上实际电压值的计算公式为:采样值 * 参考电压 / (1 << 分辨率位数),即 vol = 2048 / 4096 * 3.3 V = 1.15V。
|
||||
"""
|
||||
|
|
@ -734,7 +735,7 @@ class PWM(object):
|
|||
"""
|
||||
"""
|
||||
|
||||
def init(channel, freq, duty) -> None:
|
||||
def init(self, channel : int, freq : int, duty : int) -> None:
|
||||
"""
|
||||
根据输入的参数初始化 PWM 对象。
|
||||
"""
|
||||
|
|
@ -746,13 +747,13 @@ class PWM(object):
|
|||
"""
|
||||
...
|
||||
|
||||
def freq(freq)-> None:
|
||||
def freq(self, freq : int)-> None:
|
||||
"""
|
||||
用于获取或者设置 PWM 对象的频率,频率的范围为 [1, 156250]。如果参数为空,返回当前 PWM 对象的频率;如果参数非空,则使用该参数设置当前 PWM 对象的频率。
|
||||
"""
|
||||
...
|
||||
|
||||
def duty(duty) -> None:
|
||||
def duty(self, duty : int) -> None:
|
||||
"""
|
||||
用于获取或者设置 PWM 对象的占空比数值,占空比数值的范围为 [0, 255],例如 duty = 100,表示当前设备占空比为 100/255 = 39.22% 。如果参数为空,返回当前 PWM 对象的占空比数值;如果参数非空,则使用该参数设置当前 PWM 对象的占空比数值。
|
||||
"""
|
||||
|
|
@ -840,7 +841,7 @@ class LCD(object):
|
|||
|
||||
class WDT(object):
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, timeout : int) -> None:
|
||||
"""
|
||||
Construct a new watchdog object.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
utime 模块提供获取当前时间和日期、测量时间间隔和延迟的功能。
|
||||
"""
|
||||
|
||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
def localtime(secs : int) -> None:
|
||||
"""
|
||||
从初始时间的秒转换为元组: (年, 月, 日, 时, 分, 秒, 星期, yearday) 。如果 secs 是空或者 None,那么使用当前时间。
|
||||
|
|
@ -33,7 +35,7 @@ def sleep_us(us) -> None:
|
|||
"""延时指定微秒,参数不能小于0。"""
|
||||
...
|
||||
|
||||
def ticks_ms() -> None:
|
||||
def ticks_ms() -> int:
|
||||
"""
|
||||
返回不断递增的毫秒计数器,在某些值后会重新计数(未指定)。
|
||||
计数值本身无特定意义,只适合用在ticks_diff()。
|
||||
|
|
@ -42,7 +44,7 @@ def ticks_ms() -> None:
|
|||
"""
|
||||
...
|
||||
|
||||
def ticks_us() -> None:
|
||||
def ticks_us() -> int:
|
||||
"""
|
||||
返回不断递增的微秒计数器,在某些值后会重新计数(未指定)。
|
||||
计数值本身无特定意义,只适合用在ticks_diff()。
|
||||
|
|
@ -55,7 +57,7 @@ def ticks_cpu() -> None:
|
|||
"""与 ticks_ms() 和 ticks_us() 类似,具有更高精度 (使用 CPU 时钟),并非每个端口都实现此功能。"""
|
||||
...
|
||||
|
||||
def ticks_add(ticks, delta) -> None:
|
||||
def ticks_add(ticks, delta) -> int:
|
||||
"""
|
||||
给定一个数字作为节拍的偏移值 delta,这个数字的值是正数或者负数都可以。
|
||||
给定一个 ticks 节拍值,本函数允许根据节拍值的模算数定义来计算给定节拍值之前或者之后 delta 个节拍的节拍值 。
|
||||
|
|
@ -65,7 +67,7 @@ def ticks_add(ticks, delta) -> None:
|
|||
"""
|
||||
...
|
||||
|
||||
def ticks_diff(ticks1, ticks2) -> None:
|
||||
def ticks_diff(ticks1, ticks2) -> int :
|
||||
"""
|
||||
计算两次调用 ticksms(), ticks_us(), 或 ticks_cpu()之间的时间。
|
||||
因为这些函数的计数值可能会回绕,所以不能直接相减,需要使用 ticks_diff() 函数。
|
||||
|
|
@ -82,7 +84,7 @@ def ticks_diff(ticks1, ticks2) -> None:
|
|||
"""
|
||||
...
|
||||
|
||||
def time() -> None:
|
||||
def time() -> int:
|
||||
"""
|
||||
返回从开始时间的秒数(整数),假设 RTC 已经按照前面方法设置好。
|
||||
如果 RTC 没有设置,函数将返回参考点开始计算的秒数 (对于 RTC 没有后备电池的板子,上电或复位后的情况)。
|
||||
|
|
|
|||
Loading…
Reference in New Issue