quecpython.helios-service/demo/watchdog_demo.py
2021-09-02 19:37:05 +08:00

28 lines
530 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import sys_bus
from machine import Pin, ExtInt
from usr.bin.third_party.ql_interrupter import WatchDog
def topic1_cb(topic, msg):
print("topic1_cb topic = {} msg = {}".format(topic, msg))
def topic2_cb(topic, msg):
print("topic2_cb topic = {} msg = {}".format(topic, msg))
# 订阅喂狗后硬件狗拉GPIO 告知模块喂狗成功
sys_bus.subscribe("WDT_KICK_TOPIC", topic1_cb)
# 订阅喂狗后的回调
sys_bus.subscribe("WDT_KICK_TOPIC_FEED", topic2_cb)
wd = WatchDog(Pin.GPIO17, 1, 10000)
wd.start()