本文整理汇总了Python中micropython.alloc_emergency_exception_buf方法的典型用法代码示例。如果您正苦于以下问题:Python micropython.alloc_emergency_exception_buf方法的具体用法?Python micropython.alloc_emergency_exception_buf怎么用?Python micropython.alloc_emergency_exception_buf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类micropython
的用法示例。
在下文中一共展示了micropython.alloc_emergency_exception_buf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import micropython [as 别名]
# 或者: from micropython import alloc_emergency_exception_buf [as 别名]
def __init__(self, os_properties):
# Read OS properties
self.os_properties = os_properties
micropython.alloc_emergency_exception_buf(100)
# Logger
self.logger = Logger(self.os_properties['log_level'])
示例2: init
# 需要导入模块: import micropython [as 别名]
# 或者: from micropython import alloc_emergency_exception_buf [as 别名]
def init():
if True:
uart = pyb.UART(6,115200)
pyb.repl_uart(uart)
print("REPL is also on UART 6 (Y1=Tx Y2=Rx)")
if True:
bufsize = 100
print("Setting alloc_emergency_exception_buf to", bufsize)
micropython.alloc_emergency_exception_buf(bufsize)
示例3: test
# 需要导入模块: import micropython [as 别名]
# 或者: from micropython import alloc_emergency_exception_buf [as 别名]
def test():
"""Test program - assumes X2 is jumpered to X1."""
micropython.alloc_emergency_exception_buf(100)
print("Starting tach")
tach = Tachometer(timer_num=2, channel_num=1, pin_name='X1')
print("Starting pulses")
t5 = pyb.Timer(5, freq=4)
oc_pin = pyb.Pin.board.X2
oc = t5.channel(2, pyb.Timer.OC_TOGGLE, pin=oc_pin)
for freq in range(0, 600, 100):
if freq == 0:
freq = 1
else:
t5.freq(freq * 4) # x 2 for toggle, x2 for 2 pulses_per_rev
pyb.delay(1000)
print("RPM =", tach.rpm(), "Freq =", freq, " as RPM =", freq * 60)
# stop the pulses
print("Stopping pulses")
oc_pin.init(pyb.Pin.OUT_PP)
# wait for 1.5 seconds
pyb.delay(1500)
print("RPM =", tach.rpm())
print("RPM =", tach.rpm())
print("Starting pulses again")
# start the pulses up again
oc = t5.channel(2, pyb.Timer.OC_TOGGLE, pin=oc_pin)
pyb.delay(2000)
print("RPM =", tach.rpm())
print("RPM =", tach.rpm())
示例4: init
# 需要导入模块: import micropython [as 别名]
# 或者: from micropython import alloc_emergency_exception_buf [as 别名]
def init():
if False:
uart = pyb.UART(6,115200)
pyb.repl_uart(uart)
print("REPL is also on UART 6 (Y1=Tx Y2=Rx)")
if False:
bufsize = 100
print("Setting alloc_emergency_exception_buf to", bufsize)
micropython.alloc_emergency_exception_buf(bufsize)