admin管理员组文章数量:1516870
#!/mnt/run/tools/loran
print("-- Test i2c tools --")
local tmp = nil
local detect_bus = function(bus)
for chip = 0x0, 0x7F do
tmp = driver.i2cdev(bus, chip)
if tmp:init() == 0 then
if tmp:read_byte() >= 0 then
print(string.format("find i2c chip device %x ack: %d", chip,tmp:read_byte()))
tmp:release()
end
end
end
end
for bus = 0,1 do
bus = "/dev/i2c-"..bus
print("detect bus: "..bus)
detect_bus(bus)
end
版权声明:本文标题:linux 嵌入式 开发 lua 调试 i2c 脚本 i2c 总线 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.betaflare.com/biancheng/1725890753a1025686.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论