From 09c7da92fe504c32955e80dd1e95fb6f9c6fbdcf Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Wed, 4 Nov 2009 22:09:18 +0000 Subject: [PATCH] Changed option name to 'bitmode' to avoid clash with serial mode option. Version incremented Signed-off-by: Pat Thoyts --- makefile.vc | 12 ++++++++---- tclftd2xx.c | 11 ++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/makefile.vc b/makefile.vc index 4f204b7..ceb32e9 100644 --- a/makefile.vc +++ b/makefile.vc @@ -164,7 +164,7 @@ PROJECT = tclftd2xx #PROJECT_REQUIRES_TK=1 !include "rules.vc" -DOTVERSION = 1.0.1 +DOTVERSION = 1.0.2 VERSION = $(DOTVERSION:.=) STUBPREFIX = $(PROJECT)stub @@ -175,11 +175,15 @@ DLLOBJS = \ !endif # We need the location of the FTDI header and library files. -FTDI_INCLUDES =-ID2XX\WHQL +!ifndef FTDI_DIR +FTDI_DIR =D2XX\WHQL +!endif + +FTDI_INCLUDES =-I$(FTDI_DIR) !if "$(MACHINE)" == "AMD64" -FTDI_LIBS =-libpath:D2XX\WHQL\amd64 +FTDI_LIBS =-libpath:$(FTDI_DIR)\amd64 !else -FTDI_LIBS =-libpath:D2XX\WHQL\i386 +FTDI_LIBS =-libpath:$(FTDI_DIR)\i386 !endif #------------------------------------------------------------------------- diff --git a/tclftd2xx.c b/tclftd2xx.c index 884d962..2f6333c 100644 --- a/tclftd2xx.c +++ b/tclftd2xx.c @@ -280,12 +280,13 @@ ChannelSetOption(ClientData instance, Tcl_Interp *interp, if (r == TCL_OK) { fts = procs.FT_SetLatencyTimer(instPtr->handle, (UCHAR)tmp); } - } else if (!strcmp("-mode", optionName)) { + } else if (!strcmp("-bitmode", optionName)) { + int tmp = 1; r = Tcl_GetInt(interp, newValue, &tmp); if (r == TCL_OK) { fts = procs.FT_SetBitmode(instPtr->handle, (UCHAR)(tmp >> 8), (UCHAR)(tmp & 0xff)); } - } + } if (fts != FT_OK) { Tcl_AppendResult(interp, "error setting ", optionName, @@ -307,7 +308,7 @@ ChannelGetOption(ClientData instance, Tcl_Interp *interp, const char *optionName, Tcl_DString *optionValue) { Channel *instPtr = instance; - const char *options[] = {"readtimeout", "writetimeout", "latency", NULL}; + const char *options[] = {"readtimeout", "writetimeout", "latency", "bitmode", NULL}; int r = TCL_OK; if (optionName == NULL) { @@ -348,11 +349,11 @@ ChannelGetOption(ClientData instance, Tcl_Interp *interp, ConvertError(fts), NULL); r = TCL_ERROR; } - } else if (!strcmp("-mode", optionName)) { + } else if (!strcmp("-bitmode", optionName)) { UCHAR bmode = 0; - Tcl_DStringSetLength(&ds, TCL_INTEGER_SPACE); fts = procs.FT_GetBitmode(instPtr->handle, &bmode); if (fts == FT_OK) { + Tcl_DStringSetLength(&ds, TCL_INTEGER_SPACE); sprintf(Tcl_DStringValue(&ds), "%d", bmode); } else { Tcl_AppendResult(interp, "failed to read ", optionName, ": ", -- 2.23.0