diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-10-14 13:44:56 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-10-14 13:44:56 -0500 |
commit | 7997af3f4f6d8ca680e381cb1bee4ebe3b82e175 (patch) | |
tree | f88cd6c4fa54fdf8c9d76506b9cf03cfa0142763 /clients/tde | |
parent | e9bed7d3af54c11f1174b73daa8d8b838448b27f (diff) | |
download | ulab-7997af3f4f6d8ca680e381cb1bee4ebe3b82e175.tar.gz ulab-7997af3f4f6d8ca680e381cb1bee4ebe3b82e175.zip |
Fix 7-segment LED display and add sample driver for the same
Diffstat (limited to 'clients/tde')
-rw-r--r-- | clients/tde/configure.in | 142 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaview/part.cpp | 51 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaview/part.h | 11 |
3 files changed, 33 insertions, 171 deletions
diff --git a/clients/tde/configure.in b/clients/tde/configure.in deleted file mode 100644 index c8f9931..0000000 --- a/clients/tde/configure.in +++ /dev/null @@ -1,142 +0,0 @@ -dnl ======================================================= -dnl FILE: ./admin/configure.in.min -dnl ======================================================= - -dnl This file is part of the KDE libraries/packages -dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org) - -dnl This file is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Library General Public -dnl License as published by the Free Software Foundation; either -dnl version 2 of the License, or (at your option) any later version. - -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Library General Public License for more details. - -dnl You should have received a copy of the GNU Library General Public License -dnl along with this library; see the file COPYING.LIB. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -dnl Boston, MA 02110-1301, USA. - -# Original Author was Kalle@kde.org -# I lifted it in some mater. (Stephan Kulow) -# I used much code from Janos Farkas - -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(acinclude.m4) dnl a source file from your sub dir - -dnl This is so we can use kde-common -AC_CONFIG_AUX_DIR(admin) - -dnl This ksh/zsh feature conflicts with `cd blah ; pwd` -unset CDPATH - -dnl Checking host/target/build systems, for make, install etc. -AC_CANONICAL_SYSTEM -dnl Perform program name transformation -AC_ARG_PROGRAM - -dnl Automake doc recommends to do this only here. (Janos) -AM_INIT_AUTOMAKE(tde, "3.5.10") dnl searches for some needed programs - -KDE_SET_PREFIX - -dnl generate the config header -AM_CONFIG_HEADER(config.h) dnl at the distribution this done - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_CHECK_COMPILERS -AC_ENABLE_SHARED(yes) -AC_ENABLE_STATIC(no) -KDE_PROG_LIBTOOL - -dnl for NLS support. Call them in this order! -dnl WITH_NLS is for the po files -AM_KDE_WITH_NLS - -KDE_USE_QT(3.2) -AC_PATH_KDE -dnl ======================================================= -dnl FILE: configure.in.in -dnl ======================================================= - -#MIN_CONFIG(3.2) -CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS" - -if test "$build_arts" = "yes"; then - AC_DEFINE(USE_ARTS, 1, [If we use arts volume]) - LIB_ARTS="-lartskde" - AC_SUBST(LIB_ARTS) -fi - -KDE_INIT_DOXYGEN([The API Reference], [Version $VERSION]) - -KDE_CREATE_SUBDIRSLIST -AC_CONFIG_FILES([ Makefile ]) -AC_CONFIG_FILES([ doc/Makefile ]) -AC_CONFIG_FILES([ misc/Makefile ]) -AC_CONFIG_FILES([ po/Makefile ]) -AC_CONFIG_FILES([ src/Makefile ]) -AC_CONFIG_FILES([ src/app/Makefile ]) -AC_CONFIG_FILES([ src/app/views/Makefile ]) -AC_CONFIG_FILES([ src/dialogs/Makefile ]) -AC_CONFIG_FILES([ src/part/Makefile ]) -AC_CONFIG_FILES([ src/part/adminconsole/Makefile ]) -AC_CONFIG_FILES([ src/part/adminusermgmt/Makefile ]) -AC_CONFIG_FILES([ src/part/commanalyzer/Makefile ]) -AC_CONFIG_FILES([ src/part/fpgaprogram/Makefile ]) -AC_CONFIG_FILES([ src/part/fpgaview/Makefile ]) -AC_CONFIG_FILES([ src/part/scope/Makefile ]) -AC_CONFIG_FILES([ src/part/sensormonitor/Makefile ]) -AC_CONFIG_FILES([ src/widgets/Makefile ]) -AC_OUTPUT -# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure -if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then - # And if so, warn when they don't match - if test "$kde_libs_prefix" != "$given_prefix"; then - # And if kde doesn't know about the prefix yet - echo ":"`tde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null - if test $? -ne 0; then - echo "" - echo "Warning: you chose to install this package in $given_prefix," - echo "but KDE was found in $kde_libs_prefix." - echo "For this to work, you will need to tell KDE about the new prefix, by ensuring" - echo "that TDEDIRS contains it, e.g. export TDEDIRS=$given_prefix:$kde_libs_prefix" - echo "Then restart KDE." - echo "" - fi - fi -fi - -if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then - echo "" - echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility" - echo "was not included. Therefore, GCC symbol visibility support remains disabled." - echo "" - echo "For better performance, consider including the Qt visibility supporting patch" - echo "located at:" - echo "" - echo "http://bugs.kde.org/show_bug.cgi?id=109386" - echo "" - echo "and recompile all of Qt and KDE. Note, this is entirely optional and" - echo "everything will continue to work just fine without it." - echo "" -fi - -if test "$all_tests" = "bad"; then - if test ! "$cache_file" = "/dev/null"; then - echo "" - echo "Please remove the file $cache_file after changing your setup" - echo "so that configure will find the changes next time." - echo "" - fi -else - echo "" - echo "Good - your configure finished. Start make now" - echo "" -fi diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp index c312c66..dc5c9d9 100644 --- a/clients/tde/src/part/fpgaview/part.cpp +++ b/clients/tde/src/part/fpgaview/part.cpp @@ -140,6 +140,7 @@ FPGA7Segment::~FPGA7Segment() { void FPGA7Segment::init() { setFrameStyle(TQFrame::Box | TQFrame::Raised); + prevSegments = 0; val = 0; smallPoint = TRUE; setSegmentStyle(Flat); @@ -147,34 +148,32 @@ void FPGA7Segment::init() { m_currentSegments = (char*)malloc(sizeof(char)*9); m_prevSegments[0] = 99; m_currentSegments[0] = 99; - d = 0; setSizePolicy(TQSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum)); } -void FPGA7Segment::setLitSegments(unsigned int segs) { +void FPGA7Segment::setLitSegments(unsigned char segs) { // This produces an array of up to 10 chars, with each char being the number of a lit segment, and the list being terminated with the number 99 // The bit input in segs is active high // The bit sequence, MSB to LSB, is dp a b c d e f g // Segment letters are taken from ug130.pdf - // 0: a - // 1: f - // 2: d - // 3: g - // 4: e - // 5: c - // 6: b - // 7: dp - - int i = 0; - if (segs & 0x80) { m_currentSegments[i] = 7; i++; } - if (segs & 0x40) { m_currentSegments[i] = 0; i++; } - if (segs & 0x20) { m_currentSegments[i] = 6; i++; } - if (segs & 0x10) { m_currentSegments[i] = 5; i++; } - if (segs & 0x08) { m_currentSegments[i] = 2; i++; } - if (segs & 0x04) { m_currentSegments[i] = 4; i++; } - if (segs & 0x02) { m_currentSegments[i] = 1; i++; } - if (segs & 0x01) { m_currentSegments[i] = 3; i++; } - m_currentSegments[i] = 99; + + if (prevSegments != segs) { + int i = 0; + if (segs & 0x80) { m_currentSegments[i] = 7; i++; } + if (segs & 0x40) { m_currentSegments[i] = 0; i++; } + if (segs & 0x20) { m_currentSegments[i] = 2; i++; } + if (segs & 0x10) { m_currentSegments[i] = 5; i++; } + if (segs & 0x08) { m_currentSegments[i] = 6; i++; } + if (segs & 0x04) { m_currentSegments[i] = 4; i++; } + if (segs & 0x02) { m_currentSegments[i] = 1; i++; } + if (segs & 0x01) { m_currentSegments[i] = 3; i++; } + + m_currentSegments[i] = 99; + + update(); + } + + prevSegments = segs; } void FPGA7Segment::drawContents( TQPainter *p ) @@ -230,7 +229,7 @@ void FPGA7Segment::drawDigit(const TQPoint &pos, TQPainter &p, int segLen, const const char erase = 0; const char draw = 1; - const char leaveAlone = 2; +// const char leaveAlone = 2; segs = m_prevSegments; for ( nErases=0; segs[nErases] != 99; nErases++ ) { @@ -242,8 +241,12 @@ void FPGA7Segment::drawDigit(const TQPoint &pos, TQPainter &p, int segLen, const for(i = 0 ; segs[i] != 99 ; i++) { for ( j=0; j<nErases; j++ ) { if ( segs[i] == updates[j][1] ) { // Same segment ? +// FIXME +// Always redraw segments for now, as dragging windows in front of the LED display currently erases the occluded portion(s) of the display! +#if 0 updates[j][0] = leaveAlone; // yes, already on screen break; +#endif } } if ( j == nErases ) { // If not already on screen @@ -584,8 +587,8 @@ K_EXPORT_COMPONENT_FACTORY(libremotelab_fpgaviewer, RemoteLab::Factory) FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&) : RemoteInstrumentPart( parent, name ), m_base(NULL), m_interfaceMode(BasicInterfaceMode), m_commHandlerState(0), m_commHandlerMode(0), m_commHandlerNextState(0), m_commHandlerNextMode(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0), - m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xffffffff), - m_7segDigit2OutputValue(0xffffffff), m_7segDigit1OutputValue(0xffffffff), m_7segDigit0OutputValue(0xffffffff), + m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xff), + m_7segDigit2OutputValue(0xff), m_7segDigit1OutputValue(0xff), m_7segDigit0OutputValue(0xff), m_batchOutputFile(NULL), m_dataOutputFile(NULL), m_inputImageViewer(NULL), m_outputImageViewer(NULL) { diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h index 26e70ec..b49ace2 100644 --- a/clients/tde/src/part/fpgaview/part.h +++ b/clients/tde/src/part/fpgaview/part.h @@ -105,7 +105,7 @@ class TQ_EXPORT FPGA7Segment : public TQFrame SegmentStyle segmentStyle() const; virtual void setSegmentStyle(SegmentStyle); - void setLitSegments(unsigned int); + void setLitSegments(unsigned char); TQSize sizeHint() const; @@ -120,6 +120,7 @@ class TQ_EXPORT FPGA7Segment : public TQFrame char* m_prevSegments; char* m_currentSegments; + unsigned int prevSegments; double val; uint smallPoint : 1; uint fill : 1; @@ -231,10 +232,10 @@ namespace RemoteLab unsigned int m_16bitInputValue; unsigned int m_16bitOutputValue; TQCString m_LCDOutputValue; - unsigned int m_7segDigit3OutputValue; - unsigned int m_7segDigit2OutputValue; - unsigned int m_7segDigit1OutputValue; - unsigned int m_7segDigit0OutputValue; + unsigned char m_7segDigit3OutputValue; + unsigned char m_7segDigit2OutputValue; + unsigned char m_7segDigit1OutputValue; + unsigned char m_7segDigit0OutputValue; UnsignedIntegerList m_batchInputValueList; UnsignedIntegerList m_batchOutputValueList; |