私信  •  关注

Elec

Elec 最近创建的主题
Elec 最近回复了
7 年前
回复了 Elec 创建的主题 » opwenwrt-使用python从spi读取字节

我自己解决了这个问题。 你必须使用操作系统库

例子:

import os

file = os.open('filename', os.O_RDWR)

#Write byte 0x1 to SPI Bus
os.write(file, chr(0x1))
#Read one byte from SPI Bus
print(str(ord(os.read(file, 1))))