X2Cscope / pyx2cscope

python implementation of x2cscope
Other
1 stars 0 forks source link

Simplify serial support by lnet 1. #9

Closed MarkWendler closed 7 months ago

MarkWendler commented 11 months ago

We were using serial connection in 99% of the cases, would make sense to simplify its usage by LNET

For a simple serial connection I do not see a reason to use InterfaceFactory. Why not support like this:

import serial
ser = serial.Serial('COM3', 115200)
l_net = LNet(serial_connection)

Currently looks too complex for me than it is actually neccesary:

from mchplnet.interfaces.factory import InterfaceFactory
from mchplnet.interfaces.factory import InterfaceType as IType

# Initialize serial communication
serial_port = "COM8"
baud_rate = 115200
serial_connection = InterfaceFactory.get_interface(
    IType.SERIAL, port=serial_port, baudrate=baud_rate
    )

# Initialize LNet and VariableFactory
l_net = LNet(serial_connection)
yashagarwal-314 commented 11 months ago

I and Edras came up with this idea to make it easier for the future, once we start CAN and TCP/IP.

but if we should have a more straightforward implementation, I will make it by the next release.

edras commented 7 months ago

This functionality is implemented on version 0.1.0 of pyx2cscope.

from pyx2cscope.xc2scope import X2CScope x2cScope = X2CScope(port="COM16", elf_file="elf_file_path")

15