controller_rpi.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:SX127x_driver_for_MicroPython_on_ESP8266 作者: Wei1234c 项目源码 文件源码
def get_spi(self):             
        spi = None

        try: 
            spi = spidev.SpiDev()
            bus = 0
            device = 0
            spi.open(bus, device)            
            spi.max_speed_hz = 10000000
            spi.mode = 0b00
            spi.lsbfirst = False

        except Exception as e:
            print(e)
            GPIO.cleanup()
            if spi:
                spi.close()
                spi = None

        return spi


    # https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
    # https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=19489
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号