예제 #1
0
#!/usr/bin/env python

from common import create_serial, create_interface

from coax import Control, read_address_counter_hi, read_address_counter_lo, load_address_counter_hi, load_address_counter_lo, write_data, load_control_register

DIGIT_MAP = [
    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x80, 0x81,
    0x82, 0x83, 0x84, 0x85
]

with create_serial() as serial:
    interface = create_interface(serial)

    load_control_register(interface, Control(cursor_inhibit=True))

    load_address_counter_hi(interface, 0)
    load_address_counter_lo(interface, 80)

    buffer = b'\x00' * 4

    # Header Row
    for lo in range(16):
        buffer += bytes([0x2f, DIGIT_MAP[lo]]) + (b'\x00' * 2)

    buffer += b'\x00' * 12

    # Rows
    for hi in range(16):
        buffer += bytes([DIGIT_MAP[hi], 0x2f]) + (b'\x00' * 2)
예제 #2
0
파일: 01_reset.py 프로젝트: markbirss/coax
#!/usr/bin/env python

from common import create_serial, create_interface

with create_serial() as serial:
    interface = create_interface(serial, reset=False, poll_flush=False)

    print('Resetting interface...')

    version = interface.reset()

    print(f'Firmware version is {version}')