#!/usr/bin/env python3
"""
Created on 19 Mar 2019

@author: Bruno Beloff ([email protected])

https://www.raspberrypi.org/documentation/configuration/uart.md
"""

from scs_host.sys.host_serial import HostSerial

# --------------------------------------------------------------------------------------------------------------------

serial = None

try:
    serial = HostSerial(0, 9600, False)
    serial.open(4, 2)
    print(serial)

    for line in serial.read_lines(timeout=10):
        print(line)

except KeyboardInterrupt:
    print()

finally:
    if serial:
        serial.close()
Пример #2
0
#!/usr/bin/env python3
"""
Created on 26 Dec 2016

@author: Bruno Beloff ([email protected])
"""

from scs_host.sys.host_serial import HostSerial

# --------------------------------------------------------------------------------------------------------------------

serial = HostSerial(4, 115200, True)
print(serial)

try:
    serial.open(1.0, 1.0)
    print(serial)

    serial.write_line("hello world!")
    serial.write_line("goodbye world!")

finally:
    serial.close()
    print(serial)
Пример #3
0
 def __init__(self, uart):
     self.__io = IO()
     self.__serial = HostSerial(uart, self.__BAUD_RATE, False)
Пример #4
0
 def setup_serial(self):
     self.__serial = HostSerial(GE910.__UART, GE910.__BAUD_RATE, True)
Пример #5
0
 def __init__(self, uart):
     """
     Constructor
     """
     self._serial = HostSerial(uart, self.__BAUD_RATE, False)
Пример #6
0
#!/usr/bin/env python3
"""
Created on 26 Dec 2016

@author: Bruno Beloff ([email protected])
"""

from scs_host.sys.host_serial import HostSerial

# --------------------------------------------------------------------------------------------------------------------

serial = HostSerial(1, 9600)  # the PAM7 GPS receiver
print(serial)

try:
    serial.open(2.0, 2.0)
    print(serial)

    while True:
        text = serial.read_line(eol="\r\n", timeout=4.0)
        print("text:[%s]" % text)

except KeyboardInterrupt:
    print("host_serial_read_test: KeyboardInterrupt")

finally:
    serial.close()
    print(serial)
Пример #7
0
 def __init__(self, uart):
     """
     Constructor
     """
     self._serial = HostSerial(uart, self.baud_rate())
Пример #8
0
#!/usr/bin/env python3
"""
Created on 26 Dec 2016

@author: Bruno Beloff ([email protected])
"""

from scs_host.sys.host_serial import HostSerial

# --------------------------------------------------------------------------------------------------------------------

serial = HostSerial(1, 9600, False)  # the PAM7 GPS receiver
print(serial)

try:
    serial.open(2.0, 2.0)
    print(serial)

    while True:
        text = serial.read_line(eol="\r\n", timeout=4.0)
        print("text:[%s]" % text)

except KeyboardInterrupt:
    print("host_serial_read_test: KeyboardInterrupt")

finally:
    serial.close()
    print(serial)