Beispiel #1
0
def test_init_6x8():
    ht1621(gpio)

    assert gpio.get_pin_states() == {
        11: gpio.OUT,
        10: gpio.OUT,
        8: gpio.OUT}

    assert gpio.get_data() == [
        gpio.command(0x30),  # Internal RC oscillator @ 256KHz
        gpio.command(0x52),  # 1/2 Bias and 4 commons
        gpio.command(0x02),  # System enable
        gpio.data(0),        # Column Data
        gpio.data(0),        # "
        gpio.data(0),        #
        gpio.data(0),        #
        gpio.data(0),        #
        gpio.data(0),        #
        gpio.command(0x06)]  # Display On
Beispiel #2
0
def test_display():
    device = ht1621(gpio)
    gpio.reset_mock()

    sevensegment(device).text = "HELLO"

    assert gpio.get_data() == [
        gpio.data(0), gpio.data(0), gpio.data(0),     # _ _ _
        gpio.data(0), gpio.data(0), gpio.data(0),     # _ _ _
        gpio.data(0), gpio.data(125), gpio.data(13),  # _ O L
        gpio.data(13), gpio.data(31), gpio.data(103)  # L E H
    ]
Beispiel #3
0
def test_display():
    device = ht1621(gpio)
    gpio.reset_mock()

    sevensegment(device).text = "HELLO"

    assert gpio.get_data() == [
        gpio.data(0), gpio.data(0), gpio.data(0),     # _ _ _
        gpio.data(0), gpio.data(0), gpio.data(0),     # _ _ _
        gpio.data(0), gpio.data(125), gpio.data(13),  # _ O L
        gpio.data(13), gpio.data(31), gpio.data(103)  # L E H
    ]
Beispiel #4
0
import time

from luma.core.virtual import sevensegment
from luma.lcd.device import ht1621

device = ht1621()
seg = sevensegment(device)

seg.text = 'HELLO'

time.sleep(10)
Beispiel #5
0
def test_show():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.show()
    assert gpio.get_data() == [gpio.command(0x06)]  # Display On
Beispiel #6
0
def test_hide():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.hide()
    assert gpio.get_data() == [gpio.command(0x04)]  # Display Off
Beispiel #7
0
def test_cleanup():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.cleanup()
    assert gpio.get_data() == []  # No activity unless persist is True
Beispiel #8
0
def test_show():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.show()
    assert gpio.get_data() == [gpio.command(0x06)]  # Display On
Beispiel #9
0
def test_hide():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.hide()
    assert gpio.get_data() == [gpio.command(0x04)]  # Display Off
Beispiel #10
0
def test_cleanup():
    device = ht1621(gpio)
    gpio.reset_mock()
    device.cleanup()
    assert gpio.get_data() == []  # No activity unless persist is True