serialhdl: Add a wrapper around the results of lookup_command()

Add a lookup_command() method to the SerialReader class that provides
a wrapper that stores the serial and commandqueue references.  This
makes it easier to run the send() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-02-27 14:16:16 -05:00
parent 8518da9824
commit b139a8561f
6 changed files with 110 additions and 106 deletions

View file

@ -108,7 +108,7 @@ class MessageFormat:
self.param_types = [MessageTypes[fmt] for name, fmt in argparts]
self.param_names = [(name, MessageTypes[fmt]) for name, fmt in argparts]
self.name_to_type = dict(self.param_names)
def encode(self, *params):
def encode(self, params):
out = []
out.append(self.msgid)
for i, t in enumerate(self.param_types):