AIWIBoardContext.py 文件源码

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

项目:RPiNWR 作者: ke4roh 项目源码 文件源码
def reset_radio(self):
        """
        Reset the Si4707 chip
        """
        # Ref https://github.com/AIWIndustries/Pi_4707/blob/master/firmware/NWRSAME_v2.py
        if self.gpio_started:
            gpio.cleanup()
        self.gpio_started = True
        gpio.setmode(gpio.BCM)  # Use board pin numbering

        gpio.setup(17, gpio.OUT)  # Setup the reset pin
        gpio.output(17, gpio.LOW)  # Reset the Si4707.
        sleep(0.4)
        gpio.output(17, gpio.HIGH)

        gpio.setup(23, gpio.IN, pull_up_down=gpio.PUD_UP)
        gpio.add_event_detect(23, gpio.FALLING)

        # Initialize the onboard relays
        for pin in self.relay_gpio_pins:
            gpio.setup(pin, gpio.OUT)  # setup gpio pin for relay
            gpio.output(pin, gpio.LOW)  # boot to disabled state

        # set up the LED
        # https://www.reddit.com/r/raspberry_pi/comments/3641ug/blinking_an_onboard_led_on_the_pi_2_model_b/
        # http://raspberrypi.stackexchange.com/questions/697/how-do-i-control-the-system-leds-using-my-
        # sudo echo none >/sys/class/leds/led0/trigger
        # GPIO 16 LOW is on, HIGH is off
        gpio.setup(16, gpio.OUT)
        gpio.output(16, gpio.HIGH)

        sleep(1.5)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号