TRX-2: TRX-2 (maybe TRX-1) cross platform API.

Status
Not open for further replies.

strcpy

Member
Joined
Aug 2, 2015
Messages
21
Location
Cambridge, MA
NOTE: this is not a "ANY SOFTWARE FOR TRX?" post.


I took an hour this morning to write a C header-only TRX API. (Meaning all you have to do is #include "libtrx.h"). Some of the RCIP documentation is wrong, so I had to figure out little things.

It needs some work, and the USB can get funky you have to reset. This will be fixed eventually. Like I said, this was an hour or so. I figure I'll finish it up this upcoming weekend.

Code: https://gist.github.com/ellzey/57f5943fca14263e80bb50d92117ec0d#file-libtrx-h
Usage: https://gist.github.com/ellzey/57f5943fca14263e80bb50d92117ec0d#file-example_usage-c

All you should need is libusb-1.0 and a compiler.

gcc example_usage.c -o example_usage -lusb-1.0

I *THINK* this is the first non-whistler display, and if so, HAVE FUN!
 
Last edited:

ecarvalho

Member
Joined
Feb 23, 2005
Messages
759
can you create a java app based on this? would be cool


Sent from my iPhone using Tapatalk Pro
 

JSTARS03

Monitor
Premium Subscriber
Joined
Jun 10, 2003
Messages
159
Location
Sunny Florida
When I try and Compile it I get the following error:
\trx.c In function 'int main(int, char**)':
\trx.c [Error] 'printf' was not declared in this scope

from Line 55
printf("line1: %.*s\n", 16, led_resp.line1);

Thanks
JSTARS
 

strcpy

Member
Joined
Aug 2, 2015
Messages
21
Location
Cambridge, MA
What compiler, OS, and compile flags are you using? It isn't compatible with c99, heck; even ansi standards, without printf.

The fact it says just "main(char *)" instead of "main(int argc, char ** argv, char ** envp)" is throwing up red flags.
 

jdolina

Member
Premium Subscriber
Joined
Jul 4, 2006
Messages
486
Location
Lorain Ohio
What would you want the java program to do? I know someone mentioned logging and I have debated on doing something like that.
 

JSTARS03

Monitor
Premium Subscriber
Joined
Jun 10, 2003
Messages
159
Location
Sunny Florida
Windows

What compiler, OS, and compile flags are you using? It isn't compatible with c99, heck; even ansi standards, without printf.

The fact it says just "main(char *)" instead of "main(int argc, char ** argv, char ** envp)" is throwing up red flags.

Dev-C++ Compiler on a Windows 7 64 Bit Machine
I used all the default flags and settings for compiling for Windows

Thanks
JSTARS
 

DonS

Member
Joined
Jun 17, 2003
Messages
4,102
Location
Franktown, CO
When I try and Compile it I get the following error:
\trx.c In function 'int main(int, char**)':
\trx.c [Error] 'printf' was not declared in this scope

from Line 55
printf("line1: %.*s\n", 16, led_resp.line1);

Thanks
JSTARS

Try adding:
#include <stdio.h>

example_usage.c doesn't #include stdio.h, but references printf().
 

JSTARS03

Monitor
Premium Subscriber
Joined
Jun 10, 2003
Messages
159
Location
Sunny Florida
libusb

Thank you but now it gives me a few "undefined reference to `libusb..." errors
I downloaded libusb 1.0.21 and updated the #include <libusb-1.0.21/libusb.h>
but I think this maybe out of my primitive C++ skill level.

.c:(.text+0x178): undefined reference to `libusb_bulk_transfer@24'

Thanks

JSTARS
 

strcpy

Member
Joined
Aug 2, 2015
Messages
21
Location
Cambridge, MA
Oh, and for all those having issues; I have them too.

Take OSX for example, somewhere around El Capitano apple created their own FTDI/CDC driver that doesn't work. It then takes an exclusive lock on the USB interface. In this case no further operations can happen.

Though I'm speaking CDC, I have to (initially) remove the cable, load the FTDI driver, insert the cable, then unload the FTDI driver before it functions.

So, if anyone is interested, I can just pass on a statically linked binary (of the terminal program I posted a video of above) for windows, macos, and linux.
 

strcpy

Member
Joined
Aug 2, 2015
Messages
21
Location
Cambridge, MA
I have to be out on the east coast on a business trip for a few weeks. So I went and purchased a TRX-1 so I could continue development on the road.

Here is a slightly short video of everything working on the TRX-1.

http://l.cfg.sh/NO7wmw

I have another video uploading that explains, in detail, the steps for running your libtrx code on MacOS (up to sierra), FreeBSD, and Ubuntu 14.04 (ARM).

I should probably push up the updated software at some point :)
 
Status
Not open for further replies.
Top