Rčtol
www.electronics.cat

mini6410

3 [ca] - Programa Qt de codi obert de control de leds del mini6410
3 [en] - Open source Qt application to control mini6410's leds
3 [es] - Programa Qt de código abierto de control de leds del mini6410


Files at mini6410 :

/etc/init.d/rcS
/root/Applications/electronics.cat/proves/qtLeds-mini6410
In the zip file there is open source code and a binary (qtLeds-mini6410) for quick test. This application do system calls to /root/Applications/electronics.cat/proves/leds
(leds is a sample in the DVD provided by the board seller)

Same application controlling leds through ioctl functions :
/root/Applications/electronics.cat/proves/qtLeds-mini6410



Key lines in /etc/init.d/rcS (variable setup) :
export PATH=/opt/Qtopia/bin:$PATH
export LD_LIBRARY_PATH=/opt/Qtopia/lib:$LD_LIBRARY_PATH
export QTDIR=/usr/local/Trolltech/QtEmbedded-4.6.1-arm
export QPEDIR=/usr/local/Trolltech/QtEmbedded-4.6.1-arm
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export QT_QWS_FONTDIR=/usr/local/Trolltech/QtEmbedded-4.6.1-arm/lib/fonts
export QWS_MOUSE_PROTO="TSLIB:/dev/input/event0 USB:/dev/input/mice"
export QWS_SIZE='480x272'
export QWS_KEYBOARD=TTY:/dev/tty1
#Call to /root/Applications/electronics.cat/proves/qtLeds-mini6410 should be followed by -qws :
echo "                                  " > /dev/tty1
echo "Starting qtLeds-mini6410, please wait ..." > /dev/tty1
/root/Applications/electronics.cat/proves/qtLeds-mini6410 -qws

Key lines in /root/Applications/electronics.cat/proves/qtLeds-mini6410 :
#include <fcntl.h>
#include <sys/ioctl.h>

In the constructor :
#if defined(Q_WS_QWS)
    leds_fd = ::open("/dev/leds0", 0);
    if (leds_fd < 0) {
        leds_fd = ::open("/dev/leds", 0);
    }
    if (leds_fd < 0) {
        QMessageBox::warning(0,
                             "qtLeds",
                             "Can't open device leds");
    }
#endif

Sample controlling led 3 :
void qtLeds::on_checkBoxLed3_toggled(bool checked)
{
    if(checked){
#if defined(Q_WS_QWS)
        ::ioctl(leds_fd, 1, 3); // Lit led 3 on
#endif
    }else{
#if defined(Q_WS_QWS)
        ::ioctl(leds_fd, 0, 3); // Lit led 3 off
#endif
    }
}


<<