from random import randint from time import sleep import pytest from pynq import Overlay from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import Pmod_ADC from pynq.iop import Pmod_DAC from pynq.tests.util import user_answer_yes from pynq.tests.util import get_pmod_id flag = user_answer_yes("\nPmod ADC and DAC attached (straight cable)?") if flag: global adc_id, dac_id pmod_id = get_pmod_id('Pmod DAC') if pmod_id == 'A': dac_id = PMODA elif pmod_id == 'B': dac_id = PMODB else: raise ValueError("Please type in A or B.") pmod_id = get_pmod_id('Pmod ADC') if pmod_id == 'A': adc_id = PMODA elif pmod_id == 'B': adc_id = PMODB else: raise ValueError("Please type in A or B.")
__email__ = "*****@*****.**" import pytest from time import sleep from pynq import Overlay from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import Pmod_ALS from pynq.tests.util import user_answer_yes from pynq.tests.util import get_pmod_id flag = user_answer_yes("\nPmod ALS attached to the board?") if flag: global als_id pmod_id = get_pmod_id('Pmod ALS') if pmod_id == 'A': als_id = PMODA elif pmod_id == 'B': als_id = PMODB else: raise ValueError("Please type in A or B.") @pytest.mark.run(order=29) @pytest.mark.skipif(not flag, reason="need ALS attached in order to run") def test_readlight(): """Test for the ALS class. This test reads the ALS and asks the user to dim light manually. Then verify that a lower reading is displayed.
import select import termios from time import sleep import pytest from pynq import Overlay from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import Pmod_LED8 from pynq.tests.util import user_answer_yes from pynq.tests.util import get_pmod_id flag = user_answer_yes("\nPmod LED8 attached to the board?") if flag: global led_id pmod_id = get_pmod_id('Pmod LED8') if pmod_id == 'A': led_id = PMODA elif pmod_id == 'B': led_id = PMODB else: raise ValueError("Please type in A or B.") @pytest.mark.run(order=22) @pytest.mark.skipif(not flag, reason="need LED8 attached in order to run") def test_led0(): """Test for a single LED8. Instantiates an LED8 object on index 0 and performs some actions on it, requesting user confirmation.
from random import randint from time import sleep import pytest from pynq import Overlay from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import Pmod_Cable from pynq.tests.util import user_answer_yes from pynq.tests.util import get_pmod_id flag = user_answer_yes("\nTwo Pmod interfaces connected by a cable?") if flag: global TX_PORT, RX_PORT send_id = get_pmod_id('sender') if send_id == 'A': TX_PORT = PMODA elif send_id == 'B': TX_PORT = PMODB else: raise ValueError("Please type in A or B.") recv_id = get_pmod_id('receiver') if recv_id == 'A': RX_PORT = PMODA elif recv_id == 'B': RX_PORT = PMODB else: raise ValueError("Please type in A or B.")
__copyright__ = "Copyright 2016, Xilinx" __email__ = "*****@*****.**" import pytest from pynq import Overlay from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import Pmod_OLED from pynq.tests.util import user_answer_yes from pynq.tests.util import get_pmod_id flag = user_answer_yes("\nPmod OLED attached to the board?") if flag: global oled_id pmod_id = get_pmod_id('Pmod OLED') if pmod_id == 'A': oled_id = PMODA elif pmod_id == 'B': oled_id = PMODB else: raise ValueError("Please type in A or B.") @pytest.mark.run(order=25) @pytest.mark.skipif(not flag, reason="need OLED attached in order to run") def test_write_string(): """Test for the OLED Pmod. Writes on the OLED the string 'Welcome to PYNQ.' and asks the user to confirm if it is shown on the OLED. After that, it clears the screen.