I've got a small chunk of libticables ported to a python module (send/receive are coded, reset, check, probe, etc... aren't ) The rest shouldn't take TOO long, as it is much simpler stuff (for example, check is a small function, and something like show_handle is pretty much worthless)
Anyway, here is the source:
http://www.kllrnohj.com/cemetech/gCn2/py_ticables/ticables_module.c
To compile it you need to make a setup.py script, then do "python setup.py build" (the compiled module will be in build/lib*), mine is as follows:
Code:
Note: Change include_dirs (location of ticables.h) and library_dirs (location of libticables.so) for your system (i have yet to try this in windows)
Here is a small example that does a simple RDY?/ACK send/recv over the silverlink cable on port 1 for an 83+/84+
Code:
I need to port the rest (or most) of the ticables.h functions over, then create a python wrapper script to make it easier to use send/recv (for example, make it so it can send/recv a list instead of a string - which is much harder to do from the C side as far as I can tell...)
If you find any errors please send me the code you were trying to run AND all the output's (including all of the ticables outputs)
Anyway, here is the source:
http://www.kllrnohj.com/cemetech/gCn2/py_ticables/ticables_module.c
To compile it you need to make a setup.py script, then do "python setup.py build" (the compiled module will be in build/lib*), mine is as follows:
Code:
from distutils.core import setup, Extension
ticables = Extension('ticables',
define_macros = [('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0')],
include_dirs = ['/usr/include/tilp2'],
libraries = ['ticables2'],
library_dirs = ['/usr/lib'],
sources = ['ticables_module.c'])
setup (name = 'PackageName',
version = '1.0',
description = 'TiCables linking module (beta)',
author = 'Kllrnohj',
author_email = 'kllrnohj@gmail.com',
url = '',
long_description = '''
Beta of libticables. Only partially implemented
''',
ext_modules = [ticables])
Note: Change include_dirs (location of ticables.h) and library_dirs (location of libticables.so) for your system (i have yet to try this in windows)
Here is a small example that does a simple RDY?/ACK send/recv over the silverlink cable on port 1 for an 83+/84+
Code:
import ticables
c = ticables.Cable(4,1) #SilverLink, Port1
c.open() #open the connection
buf = "#h\x00\x00" #similar to "uint8_t buf[] = {0x23,0x68,0x00,0x00}" - 0x23 = PC->83+/84+, 0x68 = RDY? command
err = c.send(buf) #err = 0 on success
data = c.recv(4) #4 = length, data will be (err, buf), err = 0, buf = "sV\x00\x08" on success
I need to port the rest (or most) of the ticables.h functions over, then create a python wrapper script to make it easier to use send/recv (for example, make it so it can send/recv a list instead of a string - which is much harder to do from the C side as far as I can tell...)
If you find any errors please send me the code you were trying to run AND all the output's (including all of the ticables outputs)