fprime_gds.common.communication.adapters.uart

uart.py:

This is the adapter for projects that would choose to use a serial UART interface for sending data from an F prime deployment. This handles sending and receiving data from the things like ‘LinuxSerialDriver’ and other standard UART drivers.

@author lestarch

Module Contents

Classes

SerialAdapter(device, baud)

Supplies a data source adapter that is pulling data off from a UART wire using PySerial. This is setup using a

fprime_gds.common.communication.adapters.uart.LOGGER[source]
class fprime_gds.common.communication.adapters.uart.SerialAdapter(device, baud)[source]

Bases: fprime_gds.common.communication.adapters.base.BaseAdapter

Supplies a data source adapter that is pulling data off from a UART wire using PySerial. This is setup using a device handle and a baudrate for the given serial device.

BAUDS = [50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000][source]
open(self)[source]

Opens the serial port based on previously supplied settings. If the port is already open, then close it first. Then open the port up again.

close(self)[source]

Close the serial device, and ignore any errors that might arrive when attempting that closure.

write(self, frame)[source]

Send a given framed bit of data by sending it out the serial interface. It will attempt to reconnect if there is was a problem previously. This function will return true on success, or false on error.

Parameters

frame – framed data packet to send out

Returns

True, when data was sent through the UART. False otherwise.

read(self, timeout=0.5)[source]

Read up to a given count in bytes from the UART adapter. This may return less than the full requested size but is expected to return some data.

Parameters

timeout – timeout for reading data from the serial.

Returns

data successfully read

classmethod get_arguments(cls)[source]

Returns a dictionary of flag to argparse-argument dictionaries for use with argparse to setup arguments.

Returns

dictionary of flag to argparse arguments for use with argparse

classmethod check_arguments(cls, args)[source]

Code that should check arguments of this adapter. If there is a problem with this code, then a “ValueError” should be raised describing the problem with these arguments.

Parameters

args – arguments as dictionary

Build: 1.4.1