STM32F的NRST是异步复位脚。当NRST输入低电平的时候(NRST内置上拉),MCU处于复位状态,重设所有的内部寄存器,及片内几十KB的SRAM。 当NRST从低电平变高时,PC指针从0开始。 但是复位的时候不会将STM32F片内RTC的寄存器以及后备存储器重置,因为它们是用电池通过专门的VBAT脚供电。

参考资料:
https://www.cnblogs.com/yeshenmeng/p/10481406.html
https://www.amobbs.com/thread-5556341-1-1.html?_dsign=f2e95db1

结构化日志方便查询

package main

import (
    "errors"

    "go.uber.org/zap"
)

func main() {
    // logger, err := zap.NewProduction()
    logger, err := zap.NewDevelopment()
    if err != nil {
        panic(err.Error())
    }
    logger.Info("hello world", zap.String("user", "咪了个猫"), zap.Int("age", 666))

    err = errors.New("我是一个错误")
    logger.Error("报错啦", zap.Error(err), zap.String("xxx", "我是一个参数"))

    logger.Info("hello world", zap.String("user", "咪了个猫"), zap.Error(err))
}


2020-09-22T16:51:33.156+0800    INFO    xxx3/main.go:15 hello world     {"user": "咪了个猫", "age": 666}
2020-09-22T16:51:33.156+0800    ERROR   xxx3/main.go:18 报错啦  {"error": "我是一个错误", "xxx": "我是一个参数"}
main.main
        /Users/wameidemao/Desktop/xxx3/main.go:18
runtime.main
        /usr/local/go/src/runtime/proc.go:204
2020-09-22T16:51:33.156+0800    INFO    xxx3/main.go:20 hello world     {"user": "咪了个猫", "error": "我是一个错误"}

智能家居

hc

https://github.com/brutella/hc

hc is a lightweight framework to develop HomeKit accessories in Go. It abstracts the HomeKit Accessory Protocol (HAP) and makes it easy to work with services and characteristics.

hc handles the underlying communication between HomeKit accessories and clients. You can focus on implementing the business logic for your accessory, without having to worry about the protocol.

https://luaunit.readthedocs.io/en/latest/

local lu = require("luaunit")

-- 注册单元测试函数 (函数必须以test开头)

function test_fun1()

end

function test_fun2()

end

-- 注册单元测试模块 (模块必须以test开头)

test_mod = {}

function test_mod:setUp()
    -- 调用模块测试函数前执行
end

function test_mod:tearDown()
    -- 调用模块测试函数后执行
end

function test_mod:test_fun1() -- 测试函数必须以test开头,并且使用:调用模式

end

function test_mod:test_fun2()

end

lu.LuaUnit.verbosity = 2
os.exit(lu.LuaUnit.run())

断言方法:
lu.assertEquals(a, b) -- 深度对比,包括 table
lu.assertNotEquals(a, b)
lu.assertEvalToTrue(a)
lu.assertEvalToFalse(a)
lu.assertTrue(a)
lu.assertFalse(b)
error(a)
assert(a)