def test_pins_AUX():
    """ Set and read back AUX pin """
    bb = BitBang()
    bb.outputs = PIN_AUX
    bb.pins = 0
    sleep(0.2)
    assert bb.outputs == 0
    assert bb.pins == 0
    sleep(0.2)
    bb.pins = PIN_AUX
    assert bb.outputs == PIN_AUX
    assert bb.pins == PIN_AUX
    bb.hw_reset()
def test_pins_MOSI():
    """ Set and read back MOSI pin """
    bb = BitBang()
    bb.outputs = PIN_MOSI
    bb.pins = 0
    sleep(0.5)
    assert bb.outputs == 0
    assert bb.pins == 0
    bb.pins = PIN_MOSI
    sleep(0.2)
    assert bb.outputs == PIN_MOSI
    assert bb.pins == PIN_MOSI
    bb.hw_reset()
def test_pins_CLK():
    """ Set and read back CLK pin """
    bb = BitBang()
    bb.outputs = PIN_CLK
    bb.pins = 0
    sleep(0.2)
    assert bb.outputs == 0
    assert bb.pins == 0
    bb.pins = PIN_CLK
    sleep(0.2)
    assert bb.outputs == PIN_CLK
    assert bb.pins == PIN_CLK
    bb.hw_reset()
def test_pins_MISO():
    """ Set and read back MISO pin """
    bb = BitBang()
    bb.outputs = PIN_MISO
    bb.pins = 0
    sleep(0.2)
    assert bb.outputs == 0
    assert bb.pins == 0
    bb.pins = PIN_MISO
    sleep(0.2)
    assert bb.outputs == PIN_MISO
    assert bb.pins == PIN_MISO
    bb.hw_reset()
def test_connect():
    bb = BitBang(connect=False)
    bb.connect()
    assert bb.portname != ''
def test_selftest_complete():
    bb = BitBang()
    errors = bb.selftest(complete=True)
    assert errors == 6
def test_selftest():
    bb = BitBang()
    errors = bb.selftest()
    assert errors == 0
def test_enter():
    bb = BitBang(connect=False)
    bb.connect()
    bb.enter()
    assert bb.mode == 'bb'
def test_outputs():
    """ Test if exception is raised when nothing is set yet """
    bb = BitBang()
    bb.outputs
    bb.disconnect()
    bb.hw_reset()
Beispiel #10
0
def test_init():
    bb = BitBang(connect=False)
    assert bb.portname == ''
Beispiel #11
0
def test_connect():
    bb = BitBang(connect=False)
    bb.connect()
    assert bb.portname != ''
Beispiel #12
0
def test_selftest_complete():
    bb = BitBang()
    errors = bb.selftest(complete=True)
    assert errors == 6
Beispiel #13
0
def test_selftest():
    bb = BitBang()
    errors = bb.selftest()
    assert errors == 0
Beispiel #14
0
def test_adc():
    bb = BitBang()
    value = bb.adc
    assert 0.0 <= value <= 5.0
Beispiel #15
0
def test_connect_on_init():
    bb = BitBang()
    assert bb.mode == 'bb'
Beispiel #16
0
def test_enter():
    bb = BitBang(connect=False)
    bb.connect()
    bb.enter()
    assert bb.mode == 'bb'