mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2024-12-05 04:31:52 +02:00
Updating prototype of SIE code generator.
This commit is contained in:
parent
d302857917
commit
9d578912b7
23
Examples/ADC/Test-QT-src/ADC1.pro
Normal file
23
Examples/ADC/Test-QT-src/ADC1.pro
Normal file
@ -0,0 +1,23 @@
|
||||
# #####################################################################
|
||||
# Automatically generated by qmake (2.01a) Sat Apr 3 14:28:42 2010
|
||||
# #####################################################################
|
||||
TEMPLATE = app
|
||||
TARGET = TestADC
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
|
||||
# Input
|
||||
HEADERS += mainwindow.h \
|
||||
jz47xx_mmap.h \
|
||||
signaldisplay.h \
|
||||
ADCw.h \
|
||||
jz_adc_peripheral.h \
|
||||
jz47xx_gpio.h
|
||||
FORMS += mainwindow.ui
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
signaldisplay.cpp \
|
||||
ADCw.cpp \
|
||||
jz_adc_peripheral.cpp \
|
||||
jz47xx_gpio.cpp \
|
||||
jz47xx_mmap.cpp
|
214
Examples/ADC/Test-QT-src/ADC1.pro.user
Normal file
214
Examples/ADC/Test-QT-src/ADC1.pro.user
Normal file
@ -0,0 +1,214 @@
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>RunConfiguration0-Arguments</variable>
|
||||
<valuelist type="QVariantList"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-BaseEnvironmentBase</variable>
|
||||
<value type="int">2</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-Executable</variable>
|
||||
<value type="QString">/home/juan64bits/Desktop/nn-usb-fpga/Examples/ADC/Scope-QT-src/ADC</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-RunConfiguration.name</variable>
|
||||
<value type="QString">Run /home/juan64bits/Desktop/nn-usb-fpga/Examples/ADC/Scope-QT-src/ADC</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UseTerminal</variable>
|
||||
<value type="bool">false</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UserEnvironmentChanges</variable>
|
||||
<valuelist type="QVariantList"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UserName</variable>
|
||||
<value type="QString"></value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UserSetName</variable>
|
||||
<value type="bool">false</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-WorkingDirectory</variable>
|
||||
<value type="QString">$BUILDDIR</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-type</variable>
|
||||
<value type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>activeRunConfiguration</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>activebuildconfiguration</variable>
|
||||
<value type="QString">Debug</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildConfiguration-Debug</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<value key="QtVersionId" type="int">2</value>
|
||||
<value key="ToolChain" type="int">0</value>
|
||||
<value key="addQDumper" type=""></value>
|
||||
<value key="buildConfiguration" type="int">2</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildconfiguration-Debug-buildstep0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<valuelist key="abstractProcess.Environment" type="QVariantList">
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-R9oeYpdn1v,guid=bf98b5220eae3f73ac0e2cd74ccd76a4</value>
|
||||
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
|
||||
<value type="QString">DESKTOP_SESSION=gnome</value>
|
||||
<value type="QString">DISPLAY=:0.0</value>
|
||||
<value type="QString">GDMSESSION=gnome</value>
|
||||
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
|
||||
<value type="QString">GDM_LANG=en_US.utf8</value>
|
||||
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-78MfHT</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1538</value>
|
||||
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
|
||||
<value type="QString">HOME=/home/juan64bits</value>
|
||||
<value type="QString">LANG=en_US.utf8</value>
|
||||
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
|
||||
<value type="QString">LOGNAME=juan64bits</value>
|
||||
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
|
||||
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-juan64bits</value>
|
||||
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||
<value type="QString">PWD=/home/juan64bits</value>
|
||||
<value type="QString">QTDIR=/usr/share/qt4</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1556,unix/Maximus:/tmp/.ICE-unix/1556</value>
|
||||
<value type="QString">SHELL=/bin/bash</value>
|
||||
<value type="QString">SPEECHD_PORT=7560</value>
|
||||
<value type="QString">SSH_AGENT_PID=1592</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-78MfHT/ssh</value>
|
||||
<value type="QString">USER=juan64bits</value>
|
||||
<value type="QString">USERNAME=juan64bits</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-mGObKq/database</value>
|
||||
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
|
||||
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1288533667.711046-1067046560</value>
|
||||
</valuelist>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList">
|
||||
<value type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga2/Examples/ADC/Test-QT-src/ADC1.pro</value>
|
||||
<value type="QString">-spec</value>
|
||||
<value type="QString">linux-g++</value>
|
||||
<value type="QString">-r</value>
|
||||
<value type="QString">CONFIG+=debug</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
|
||||
<value key="abstractProcess.enabled" type="bool">true</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga2/Examples/ADC/Test-QT-src</value>
|
||||
<value key="buildConfiguration" type=""></value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildconfiguration-Debug-buildstep1</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<valuelist key="abstractProcess.Environment" type="QVariantList">
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-R9oeYpdn1v,guid=bf98b5220eae3f73ac0e2cd74ccd76a4</value>
|
||||
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
|
||||
<value type="QString">DESKTOP_SESSION=gnome</value>
|
||||
<value type="QString">DISPLAY=:0.0</value>
|
||||
<value type="QString">GDMSESSION=gnome</value>
|
||||
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
|
||||
<value type="QString">GDM_LANG=en_US.utf8</value>
|
||||
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-78MfHT</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1538</value>
|
||||
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
|
||||
<value type="QString">HOME=/home/juan64bits</value>
|
||||
<value type="QString">LANG=en_US.utf8</value>
|
||||
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
|
||||
<value type="QString">LOGNAME=juan64bits</value>
|
||||
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
|
||||
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-juan64bits</value>
|
||||
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||
<value type="QString">PWD=/home/juan64bits</value>
|
||||
<value type="QString">QTDIR=/usr/share/qt4</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1556,unix/Maximus:/tmp/.ICE-unix/1556</value>
|
||||
<value type="QString">SHELL=/bin/bash</value>
|
||||
<value type="QString">SPEECHD_PORT=7560</value>
|
||||
<value type="QString">SSH_AGENT_PID=1592</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-78MfHT/ssh</value>
|
||||
<value type="QString">USER=juan64bits</value>
|
||||
<value type="QString">USERNAME=juan64bits</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-mGObKq/database</value>
|
||||
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
|
||||
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1288533667.711046-1067046560</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList">
|
||||
<value type="QString">-w</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
|
||||
<value key="abstractProcess.enabled" type="bool">true</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga2/Examples/ADC/Test-QT-src</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildconfiguration-Debug-cleanstep0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<value key="cleanConfig" type="bool">true</value>
|
||||
<valuelist key="makeargs" type="QVariantList">
|
||||
<value type="QString">clean</value>
|
||||
</valuelist>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildconfigurations</variable>
|
||||
<valuelist type="QVariantList">
|
||||
<value type="QString">Debug</value>
|
||||
</valuelist>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildstep0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
|
||||
<value key="mkspec" type="QString"></value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildstep1</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>buildsteps</variable>
|
||||
<valuelist type="QVariantList">
|
||||
<value type="QString">trolltech.qt4projectmanager.qmake</value>
|
||||
<value type="QString">trolltech.qt4projectmanager.make</value>
|
||||
</valuelist>
|
||||
</data>
|
||||
<data>
|
||||
<variable>cleanstep0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
|
||||
<value key="clean" type="bool">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>cleansteps</variable>
|
||||
<valuelist type="QVariantList">
|
||||
<value type="QString">trolltech.qt4projectmanager.make</value>
|
||||
</valuelist>
|
||||
</data>
|
||||
<data>
|
||||
<variable>defaultFileEncoding</variable>
|
||||
<value type="QByteArray">System</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>project</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
</qtcreator>
|
103
Examples/ADC/Test-QT-src/ADCw.cpp
Normal file
103
Examples/ADC/Test-QT-src/ADCw.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
#include "ADCw.h"
|
||||
|
||||
ADCw::ADCw()
|
||||
{
|
||||
BUFFER_OFFSET = 8; //Ignore first 16 samples
|
||||
ADC_SPI_CLKDIV=ADC_SPI_CLKDIV_MAX; //Set clock to minimum speed
|
||||
BUFFER_LEN=16;
|
||||
MUX_CHANNELS =0;
|
||||
|
||||
ADCBuffer = jz_adc_init();
|
||||
|
||||
//Clean FPGA RAM memory
|
||||
for (int i = 0; i < 512; i++) //RAMB16_s9_s9 has 2048 bytes 8-bit
|
||||
{
|
||||
ADCBuffer[i] = 0x00000000; //Clean 4 register by cicle
|
||||
}
|
||||
|
||||
adcConfig(ADC_CMD_SET_SPI_CLKDIV);
|
||||
adcConfig(ADC_CMD_SET_FAST_CONV);
|
||||
printf("\nADC in Fast Convertion Mode (10us) and Fs=9.8KHz (Min)\n");
|
||||
}
|
||||
|
||||
void ADCw::testADC()
|
||||
{
|
||||
int aggregate=0; float errorT=0;
|
||||
/******************************* TEST 1 ***********************************/
|
||||
printf("\nINIT TEST1: Autoselft {(Vref+) - (Vref-)}/2 -> Return 0x0200 \n");
|
||||
adcConfig(ADC_CMD_SET_AUTOSELFT_1);
|
||||
adcConfig(ADC_CMD_READ_AUTOSELFT_1);
|
||||
for(int i=BUFFER_OFFSET; i< BUFFER_LEN/2+BUFFER_OFFSET; i++)
|
||||
{
|
||||
aggregate += (ADCBuffer[i]&0xFFFF + ((ADCBuffer[i]>>16)&0x0FFF));
|
||||
printf("[%08X]", ADCBuffer[i]);
|
||||
}
|
||||
errorT=(aggregate/16)*100/0x200;
|
||||
if((errorT<95)||(errorT>105))
|
||||
printf("\n**WARNING** Test FAILED.\n\n");
|
||||
else
|
||||
printf("\nTest OK\n\n");
|
||||
|
||||
aggregate=0;
|
||||
fflush (stdout);
|
||||
|
||||
/******************************* TEST 2 ***********************************/
|
||||
printf("\n\nINIT TEST2: Autoselft (Vref-) -> Return 0x0000 \n");
|
||||
adcConfig(ADC_CMD_SET_AUTOSELFT_2);
|
||||
adcConfig(ADC_CMD_READ_AUTOSELFT_2);
|
||||
for(int i=BUFFER_OFFSET; i< BUFFER_LEN/2+BUFFER_OFFSET; i++)
|
||||
{
|
||||
aggregate += (ADCBuffer[i]&0xFFFF + ((ADCBuffer[i]>>16)&0x0FFF));
|
||||
printf("[%08X]", ADCBuffer[i]);
|
||||
}
|
||||
if(aggregate!=0)
|
||||
printf("\n**WARNING** Test FAILED. Expected value=0x0000.\n\n");
|
||||
else
|
||||
printf("\nTest OK\n\n");
|
||||
|
||||
aggregate=0;
|
||||
fflush (stdout);
|
||||
|
||||
/******************************* TEST 3 ***********************************/
|
||||
printf("\n\nINIT TEST3: Autoselft (Vref+) -> Return 0x03FF \n");
|
||||
adcConfig(ADC_CMD_SET_AUTOSELFT_3);
|
||||
adcConfig(ADC_CMD_READ_AUTOSELFT_3);
|
||||
for(int i=BUFFER_OFFSET; i< BUFFER_LEN/2+BUFFER_OFFSET; i++)
|
||||
{
|
||||
aggregate += (ADCBuffer[i]&0xFFFF + ((ADCBuffer[i]>>16)&0x0FFF));
|
||||
printf("[%08X]", ADCBuffer[i]);
|
||||
}
|
||||
errorT=(aggregate/16)*100/0x3FF;
|
||||
if((errorT<95)||(errorT>105))
|
||||
printf("\n**WARNING** Test FAILED.\n\n");
|
||||
else
|
||||
printf("\nTest OK\n\n");
|
||||
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
void ADCw::powerDownADC()
|
||||
{
|
||||
adcConfig(ADC_CMD_SET_POWER_DOWN);
|
||||
printf("\nADC in Power Down Mode \n");
|
||||
}
|
||||
|
||||
JZ_REG* ADCw::takeSamplesADC(int CHANNEL)
|
||||
{
|
||||
adcConfig(ADC_CMD_SET_CHANNEL0+CHANNEL);
|
||||
adcConfig(ADC_CMD_READ_CHANNEL0+CHANNEL);
|
||||
return (JZ_REG*)(ADCBuffer+BUFFER_OFFSET);
|
||||
}
|
||||
|
||||
void ADCw::adcConfig(uchar CMD)
|
||||
{
|
||||
ADCBuffer[0] = (((MUX_CHANNELS<<6) + CMD)<<24) + \
|
||||
((BUFFER_LEN+BUFFER_OFFSET*2) << 8) + \
|
||||
(ADC_SPI_CLKDIV);
|
||||
while(adcCheckBufferFull()) usleep (10);
|
||||
}
|
||||
|
||||
int ADCw::adcCheckBufferFull()
|
||||
{
|
||||
return ADCBuffer[0]&0x20000000;
|
||||
}
|
31
Examples/ADC/Test-QT-src/ADCw.h
Normal file
31
Examples/ADC/Test-QT-src/ADCw.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef ADCW_H
|
||||
#define ADCW_H
|
||||
|
||||
#include "jz_adc_peripheral.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
class ADCw
|
||||
{
|
||||
public:
|
||||
ADCw();
|
||||
~ADCw(){}
|
||||
|
||||
void testADC();
|
||||
void powerDownADC();
|
||||
JZ_REG * takeSamplesADC(int CHANNEL);
|
||||
void setClockDiv(uchar value){ ADC_SPI_CLKDIV = value;}
|
||||
void setBufferLen(int value){ BUFFER_LEN = value;}
|
||||
void setMuxChannels(uchar value){ MUX_CHANNELS = value;}
|
||||
private:
|
||||
void adcConfig(uchar CMD);
|
||||
int adcCheckBufferFull();
|
||||
|
||||
JZ_REG * ADCBuffer;
|
||||
uchar ADC_SPI_CLKDIV;
|
||||
int BUFFER_LEN;
|
||||
int BUFFER_OFFSET;
|
||||
uchar MUX_CHANNELS;
|
||||
};
|
||||
|
||||
#endif // ADCW_H
|
BIN
Examples/ADC/Test-QT-src/ADCw.o
Normal file
BIN
Examples/ADC/Test-QT-src/ADCw.o
Normal file
Binary file not shown.
259
Examples/ADC/Test-QT-src/Makefile
Normal file
259
Examples/ADC/Test-QT-src/Makefile
Normal file
@ -0,0 +1,259 @@
|
||||
#############################################################################
|
||||
# Makefile for building: TestADC
|
||||
# Generated by qmake (2.01a) (Qt 4.6.2) on: Sun Oct 31 11:42:42 2010
|
||||
# Project: ADC1.pro
|
||||
# Template: app
|
||||
# Command: /usr/bin/qmake -unix -o Makefile ADC1.pro
|
||||
#############################################################################
|
||||
|
||||
####### Compiler, tools and options
|
||||
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
|
||||
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
|
||||
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
|
||||
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
|
||||
LINK = g++
|
||||
LFLAGS = -Wl,-O1
|
||||
LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread
|
||||
AR = ar cqs
|
||||
RANLIB =
|
||||
QMAKE = /usr/bin/qmake
|
||||
TAR = tar -cf
|
||||
COMPRESS = gzip -9f
|
||||
COPY = cp -f
|
||||
SED = sed
|
||||
COPY_FILE = $(COPY)
|
||||
COPY_DIR = $(COPY) -r
|
||||
STRIP = strip
|
||||
INSTALL_FILE = install -m 644 -p
|
||||
INSTALL_DIR = $(COPY_DIR)
|
||||
INSTALL_PROGRAM = install -m 755 -p
|
||||
DEL_FILE = rm -f
|
||||
SYMLINK = ln -f -s
|
||||
DEL_DIR = rmdir
|
||||
MOVE = mv -f
|
||||
CHK_DIR_EXISTS= test -d
|
||||
MKDIR = mkdir -p
|
||||
|
||||
####### Output directory
|
||||
|
||||
OBJECTS_DIR = ./
|
||||
|
||||
####### Files
|
||||
|
||||
SOURCES = main.cpp \
|
||||
mainwindow.cpp \
|
||||
signaldisplay.cpp \
|
||||
ADCw.cpp \
|
||||
jz_adc_peripheral.cpp \
|
||||
jz47xx_gpio.cpp \
|
||||
jz47xx_mmap.cpp moc_mainwindow.cpp
|
||||
OBJECTS = main.o \
|
||||
mainwindow.o \
|
||||
signaldisplay.o \
|
||||
ADCw.o \
|
||||
jz_adc_peripheral.o \
|
||||
jz47xx_gpio.o \
|
||||
jz47xx_mmap.o \
|
||||
moc_mainwindow.o
|
||||
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
|
||||
/usr/share/qt4/mkspecs/common/unix.conf \
|
||||
/usr/share/qt4/mkspecs/common/linux.conf \
|
||||
/usr/share/qt4/mkspecs/qconfig.pri \
|
||||
/usr/share/qt4/mkspecs/features/qt_functions.prf \
|
||||
/usr/share/qt4/mkspecs/features/qt_config.prf \
|
||||
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
|
||||
/usr/share/qt4/mkspecs/features/default_pre.prf \
|
||||
/usr/share/qt4/mkspecs/features/release.prf \
|
||||
/usr/share/qt4/mkspecs/features/default_post.prf \
|
||||
/usr/share/qt4/mkspecs/features/warn_on.prf \
|
||||
/usr/share/qt4/mkspecs/features/qt.prf \
|
||||
/usr/share/qt4/mkspecs/features/unix/thread.prf \
|
||||
/usr/share/qt4/mkspecs/features/moc.prf \
|
||||
/usr/share/qt4/mkspecs/features/resources.prf \
|
||||
/usr/share/qt4/mkspecs/features/uic.prf \
|
||||
/usr/share/qt4/mkspecs/features/yacc.prf \
|
||||
/usr/share/qt4/mkspecs/features/lex.prf \
|
||||
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
|
||||
ADC1.pro
|
||||
QMAKE_TARGET = TestADC
|
||||
DESTDIR =
|
||||
TARGET = TestADC
|
||||
|
||||
first: all
|
||||
####### Implicit rules
|
||||
|
||||
.SUFFIXES: .o .c .cpp .cc .cxx .C
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||
|
||||
.cc.o:
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||
|
||||
.cxx.o:
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||
|
||||
.C.o:
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
|
||||
|
||||
####### Build rules
|
||||
|
||||
all: Makefile $(TARGET)
|
||||
|
||||
$(TARGET): ui_mainwindow.h $(OBJECTS)
|
||||
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
|
||||
|
||||
Makefile: ADC1.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
|
||||
/usr/share/qt4/mkspecs/common/unix.conf \
|
||||
/usr/share/qt4/mkspecs/common/linux.conf \
|
||||
/usr/share/qt4/mkspecs/qconfig.pri \
|
||||
/usr/share/qt4/mkspecs/features/qt_functions.prf \
|
||||
/usr/share/qt4/mkspecs/features/qt_config.prf \
|
||||
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
|
||||
/usr/share/qt4/mkspecs/features/default_pre.prf \
|
||||
/usr/share/qt4/mkspecs/features/release.prf \
|
||||
/usr/share/qt4/mkspecs/features/default_post.prf \
|
||||
/usr/share/qt4/mkspecs/features/warn_on.prf \
|
||||
/usr/share/qt4/mkspecs/features/qt.prf \
|
||||
/usr/share/qt4/mkspecs/features/unix/thread.prf \
|
||||
/usr/share/qt4/mkspecs/features/moc.prf \
|
||||
/usr/share/qt4/mkspecs/features/resources.prf \
|
||||
/usr/share/qt4/mkspecs/features/uic.prf \
|
||||
/usr/share/qt4/mkspecs/features/yacc.prf \
|
||||
/usr/share/qt4/mkspecs/features/lex.prf \
|
||||
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
|
||||
/usr/lib/libQtGui.prl \
|
||||
/usr/lib/libQtCore.prl
|
||||
$(QMAKE) -unix -o Makefile ADC1.pro
|
||||
/usr/share/qt4/mkspecs/common/g++.conf:
|
||||
/usr/share/qt4/mkspecs/common/unix.conf:
|
||||
/usr/share/qt4/mkspecs/common/linux.conf:
|
||||
/usr/share/qt4/mkspecs/qconfig.pri:
|
||||
/usr/share/qt4/mkspecs/features/qt_functions.prf:
|
||||
/usr/share/qt4/mkspecs/features/qt_config.prf:
|
||||
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
|
||||
/usr/share/qt4/mkspecs/features/default_pre.prf:
|
||||
/usr/share/qt4/mkspecs/features/release.prf:
|
||||
/usr/share/qt4/mkspecs/features/default_post.prf:
|
||||
/usr/share/qt4/mkspecs/features/warn_on.prf:
|
||||
/usr/share/qt4/mkspecs/features/qt.prf:
|
||||
/usr/share/qt4/mkspecs/features/unix/thread.prf:
|
||||
/usr/share/qt4/mkspecs/features/moc.prf:
|
||||
/usr/share/qt4/mkspecs/features/resources.prf:
|
||||
/usr/share/qt4/mkspecs/features/uic.prf:
|
||||
/usr/share/qt4/mkspecs/features/yacc.prf:
|
||||
/usr/share/qt4/mkspecs/features/lex.prf:
|
||||
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
|
||||
/usr/lib/libQtGui.prl:
|
||||
/usr/lib/libQtCore.prl:
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -unix -o Makefile ADC1.pro
|
||||
|
||||
dist:
|
||||
@$(CHK_DIR_EXISTS) .tmp/TestADC1.0.0 || $(MKDIR) .tmp/TestADC1.0.0
|
||||
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/TestADC1.0.0/ && $(COPY_FILE) --parents mainwindow.h jz47xx_mmap.h signaldisplay.h ADCw.h jz_adc_peripheral.h jz47xx_gpio.h .tmp/TestADC1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp signaldisplay.cpp ADCw.cpp jz_adc_peripheral.cpp jz47xx_gpio.cpp jz47xx_mmap.cpp .tmp/TestADC1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/TestADC1.0.0/ && (cd `dirname .tmp/TestADC1.0.0` && $(TAR) TestADC1.0.0.tar TestADC1.0.0 && $(COMPRESS) TestADC1.0.0.tar) && $(MOVE) `dirname .tmp/TestADC1.0.0`/TestADC1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/TestADC1.0.0
|
||||
|
||||
|
||||
clean:compiler_clean
|
||||
-$(DEL_FILE) $(OBJECTS)
|
||||
-$(DEL_FILE) *~ core *.core
|
||||
|
||||
|
||||
####### Sub-libraries
|
||||
|
||||
distclean: clean
|
||||
-$(DEL_FILE) $(TARGET)
|
||||
-$(DEL_FILE) Makefile
|
||||
|
||||
|
||||
mocclean: compiler_moc_header_clean compiler_moc_source_clean
|
||||
|
||||
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
|
||||
|
||||
compiler_moc_header_make_all: moc_mainwindow.cpp
|
||||
compiler_moc_header_clean:
|
||||
-$(DEL_FILE) moc_mainwindow.cpp
|
||||
moc_mainwindow.cpp: ADCw.h \
|
||||
jz_adc_peripheral.h \
|
||||
jz47xx_mmap.h \
|
||||
jz47xx_gpio.h \
|
||||
mainwindow.h
|
||||
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
|
||||
|
||||
compiler_rcc_make_all:
|
||||
compiler_rcc_clean:
|
||||
compiler_image_collection_make_all: qmake_image_collection.cpp
|
||||
compiler_image_collection_clean:
|
||||
-$(DEL_FILE) qmake_image_collection.cpp
|
||||
compiler_moc_source_make_all:
|
||||
compiler_moc_source_clean:
|
||||
compiler_uic_make_all: ui_mainwindow.h
|
||||
compiler_uic_clean:
|
||||
-$(DEL_FILE) ui_mainwindow.h
|
||||
ui_mainwindow.h: mainwindow.ui \
|
||||
signaldisplay.h
|
||||
/usr/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
|
||||
|
||||
compiler_yacc_decl_make_all:
|
||||
compiler_yacc_decl_clean:
|
||||
compiler_yacc_impl_make_all:
|
||||
compiler_yacc_impl_clean:
|
||||
compiler_lex_make_all:
|
||||
compiler_lex_clean:
|
||||
compiler_clean: compiler_moc_header_clean compiler_uic_clean
|
||||
|
||||
####### Compile
|
||||
|
||||
main.o: main.cpp mainwindow.h \
|
||||
ADCw.h \
|
||||
jz_adc_peripheral.h \
|
||||
jz47xx_mmap.h \
|
||||
jz47xx_gpio.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
|
||||
|
||||
mainwindow.o: mainwindow.cpp mainwindow.h \
|
||||
ADCw.h \
|
||||
jz_adc_peripheral.h \
|
||||
jz47xx_mmap.h \
|
||||
jz47xx_gpio.h \
|
||||
ui_mainwindow.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
|
||||
|
||||
signaldisplay.o: signaldisplay.cpp signaldisplay.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o signaldisplay.o signaldisplay.cpp
|
||||
|
||||
ADCw.o: ADCw.cpp ADCw.h \
|
||||
jz_adc_peripheral.h \
|
||||
jz47xx_mmap.h \
|
||||
jz47xx_gpio.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o ADCw.o ADCw.cpp
|
||||
|
||||
jz_adc_peripheral.o: jz_adc_peripheral.cpp jz_adc_peripheral.h \
|
||||
jz47xx_mmap.h \
|
||||
jz47xx_gpio.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz_adc_peripheral.o jz_adc_peripheral.cpp
|
||||
|
||||
jz47xx_gpio.o: jz47xx_gpio.cpp jz47xx_gpio.h \
|
||||
jz47xx_mmap.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz47xx_gpio.o jz47xx_gpio.cpp
|
||||
|
||||
jz47xx_mmap.o: jz47xx_mmap.cpp jz47xx_mmap.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz47xx_mmap.o jz47xx_mmap.cpp
|
||||
|
||||
moc_mainwindow.o: moc_mainwindow.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
||||
uninstall: FORCE
|
||||
|
||||
FORCE:
|
||||
|
BIN
Examples/ADC/Test-QT-src/TestADC
Executable file
BIN
Examples/ADC/Test-QT-src/TestADC
Executable file
Binary file not shown.
5
Examples/ADC/Test-QT-src/compile-mips
Executable file
5
Examples/ADC/Test-QT-src/compile-mips
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
QT_BASE_DIR="/home/cain/Embedded/ingenic/sakc/build/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/"
|
||||
${QT_BASE_DIR}/bin/qmake -spec ${QT_BASE_DIR}mkspecs/qws/linux-openwrt-g++ -unix -o Makefile
|
||||
make
|
||||
|
108
Examples/ADC/Test-QT-src/jz47xx_gpio.cpp
Normal file
108
Examples/ADC/Test-QT-src/jz47xx_gpio.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
JZ47xx GPIO at userspace
|
||||
|
||||
Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <jz47xx_gpio.h>
|
||||
#include <jz47xx_mmap.h>
|
||||
|
||||
|
||||
#define JZ_GPIO_BASE 0x10010000
|
||||
|
||||
void
|
||||
jz_gpio_as_output (JZ_PIO * pio, unsigned int o)
|
||||
{
|
||||
pio->PXFUNC = (1 << (o));
|
||||
pio->PXSELC = (1 << (o));
|
||||
pio->PXDIRS = (1 << (o));
|
||||
}
|
||||
|
||||
void
|
||||
jz_gpio_as_input (JZ_PIO * pio, unsigned int o)
|
||||
{
|
||||
pio->PXFUNC = (1 << (o));
|
||||
pio->PXSELC = (1 << (o));
|
||||
pio->PXDIRC = (1 << (o));
|
||||
}
|
||||
|
||||
void
|
||||
jz_gpio_set_pin (JZ_PIO * pio, unsigned int o)
|
||||
{
|
||||
pio->PXDATS = (1 << (o));
|
||||
}
|
||||
|
||||
void
|
||||
jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o)
|
||||
{
|
||||
pio->PXDATC = (1 << (o));
|
||||
}
|
||||
|
||||
void
|
||||
jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val)
|
||||
{
|
||||
if (val == 0)
|
||||
pio->PXDATC = (1 << (o));
|
||||
else
|
||||
pio->PXDATS = (1 << (o));
|
||||
}
|
||||
|
||||
unsigned int
|
||||
jz_gpio_get_pin (JZ_PIO * pio, unsigned int o)
|
||||
{
|
||||
return (pio->PXPIN & (1 << o)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func)
|
||||
{
|
||||
switch (func)
|
||||
{
|
||||
case 0:
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGC = (1 << o);
|
||||
pio->PXSELC = (1 << o);
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGC = (1 << o);
|
||||
pio->PXSELS = (1 << o);
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
pio->PXFUNS = (1 << o);
|
||||
pio->PXTRGS = (1 << o);
|
||||
pio->PXSELC = (1 << o);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
JZ_PIO *
|
||||
jz_gpio_map (int port)
|
||||
{
|
||||
JZ_PIO *pio;
|
||||
|
||||
pio = (JZ_PIO *) jz_mmap (JZ_GPIO_BASE);
|
||||
pio = (JZ_PIO *) ((unsigned int) pio + port * 0x100);
|
||||
|
||||
return pio;
|
||||
}
|
84
Examples/ADC/Test-QT-src/jz47xx_gpio.h
Normal file
84
Examples/ADC/Test-QT-src/jz47xx_gpio.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
JZ47xx GPIO at userspace
|
||||
|
||||
Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef __jz47xx_gpio_h__
|
||||
#define __jz47xx_gpio_h__
|
||||
|
||||
#define JZ_GPIO_PORT_A 0
|
||||
#define JZ_GPIO_PORT_B 1
|
||||
#define JZ_GPIO_PORT_C 2
|
||||
#define JZ_GPIO_PORT_D 3
|
||||
|
||||
typedef volatile unsigned int JZ_REG; /* Hardware register definition */
|
||||
|
||||
typedef struct _JZ_PIO
|
||||
{
|
||||
JZ_REG PXPIN; /* PIN Level Register */
|
||||
JZ_REG Reserved0;
|
||||
JZ_REG Reserved1;
|
||||
JZ_REG Reserved2;
|
||||
JZ_REG PXDAT; /* Port Data Register */
|
||||
JZ_REG PXDATS; /* Port Data Set Register */
|
||||
JZ_REG PXDATC; /* Port Data Clear Register */
|
||||
JZ_REG Reserved3;
|
||||
JZ_REG PXIM; /* Interrupt Mask Register */
|
||||
JZ_REG PXIMS; /* Interrupt Mask Set Reg */
|
||||
JZ_REG PXIMC; /* Interrupt Mask Clear Reg */
|
||||
JZ_REG Reserved4;
|
||||
JZ_REG PXPE; /* Pull Enable Register */
|
||||
JZ_REG PXPES; /* Pull Enable Set Reg. */
|
||||
JZ_REG PXPEC; /* Pull Enable Clear Reg. */
|
||||
JZ_REG Reserved5;
|
||||
JZ_REG PXFUN; /* Function Register */
|
||||
JZ_REG PXFUNS; /* Function Set Register */
|
||||
JZ_REG PXFUNC; /* Function Clear Register */
|
||||
JZ_REG Reserved6;
|
||||
JZ_REG PXSEL; /* Select Register */
|
||||
JZ_REG PXSELS; /* Select Set Register */
|
||||
JZ_REG PXSELC; /* Select Clear Register */
|
||||
JZ_REG Reserved7;
|
||||
JZ_REG PXDIR; /* Direction Register */
|
||||
JZ_REG PXDIRS; /* Direction Set Register */
|
||||
JZ_REG PXDIRC; /* Direction Clear Register */
|
||||
JZ_REG Reserved8;
|
||||
JZ_REG PXTRG; /* Trigger Register */
|
||||
JZ_REG PXTRGS; /* Trigger Set Register */
|
||||
JZ_REG PXTRGC; /* Trigger Set Register */
|
||||
JZ_REG Reserved9;
|
||||
JZ_REG PXFLG; /* Port Flag Register */
|
||||
JZ_REG PXFLGC; /* Port Flag clear Register */
|
||||
} JZ_PIO, *PJZ_PIO;
|
||||
|
||||
void jz_gpio_as_output (JZ_PIO * pio, unsigned int o);
|
||||
|
||||
void jz_gpio_as_input (JZ_PIO * pio, unsigned int o);
|
||||
|
||||
void jz_gpio_set_pin (JZ_PIO * pio, unsigned int o);
|
||||
|
||||
void jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o);
|
||||
|
||||
void jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val);
|
||||
|
||||
unsigned int jz_gpio_get_pin (JZ_PIO * pio, unsigned int o);
|
||||
|
||||
int jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func);
|
||||
|
||||
JZ_PIO *jz_gpio_map (int port);
|
||||
|
||||
#endif
|
BIN
Examples/ADC/Test-QT-src/jz47xx_gpio.o
Normal file
BIN
Examples/ADC/Test-QT-src/jz47xx_gpio.o
Normal file
Binary file not shown.
39
Examples/ADC/Test-QT-src/jz47xx_mmap.cpp
Normal file
39
Examples/ADC/Test-QT-src/jz47xx_mmap.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* JZ47xx GPIO lines
|
||||
*
|
||||
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <jz47xx_mmap.h>
|
||||
|
||||
|
||||
unsigned int *
|
||||
jz_mmap (off_t address)
|
||||
{
|
||||
int fd;
|
||||
|
||||
unsigned int *pio;
|
||||
|
||||
if ((fd = open ("/dev/mem", O_RDWR | O_SYNC)) == -1)
|
||||
{
|
||||
fprintf (stderr, "Cannot open /dev/mem.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pio = (unsigned int *) mmap (0, getpagesize (), PROT_READ | PROT_WRITE, MAP_SHARED, fd, address);
|
||||
|
||||
if (pio == (unsigned int *) -1)
|
||||
{
|
||||
fprintf (stderr, "Cannot mmap.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return pio;
|
||||
}
|
14
Examples/ADC/Test-QT-src/jz47xx_mmap.h
Normal file
14
Examples/ADC/Test-QT-src/jz47xx_mmap.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* JZ47xx GPIO lines
|
||||
*
|
||||
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
|
||||
*/
|
||||
|
||||
#ifndef __jz47xx_mmap_h__
|
||||
#define __jz47xx_mmap_h__
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
unsigned int * jz_mmap (off_t address);
|
||||
|
||||
#endif
|
BIN
Examples/ADC/Test-QT-src/jz47xx_mmap.o
Normal file
BIN
Examples/ADC/Test-QT-src/jz47xx_mmap.o
Normal file
Binary file not shown.
47
Examples/ADC/Test-QT-src/jz_adc_peripheral.cpp
Normal file
47
Examples/ADC/Test-QT-src/jz_adc_peripheral.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/* ADC Peripheral.c
|
||||
|
||||
Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co
|
||||
Andres Calderon andres.calderon@emqbit.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "jz_adc_peripheral.h"
|
||||
|
||||
JZ_REG *
|
||||
jz_adc_init()
|
||||
{
|
||||
JZ_PIO *pio;
|
||||
JZ_REG *virt_addr;
|
||||
|
||||
pio = jz_gpio_map (CS2_PORT);
|
||||
jz_gpio_as_func (pio, CS2_PIN, 0);
|
||||
|
||||
virt_addr = (JZ_REG *) (jz_mmap(0x13010000) + 0x18);
|
||||
|
||||
if (*virt_addr != 0x0FFF7700)
|
||||
{
|
||||
*virt_addr = 0x0FFF7700;
|
||||
printf ("ADC: Configuring CS2 8 bits and 0 WS: %08X\n", *virt_addr);
|
||||
}
|
||||
else
|
||||
printf ("ADC: CS2, already configured: %08X\n", *virt_addr);
|
||||
|
||||
virt_addr = (JZ_REG *) jz_mmap (0x14000000);
|
||||
|
||||
return virt_addr;
|
||||
}
|
81
Examples/ADC/Test-QT-src/jz_adc_peripheral.h
Normal file
81
Examples/ADC/Test-QT-src/jz_adc_peripheral.h
Normal file
@ -0,0 +1,81 @@
|
||||
/* ADC Peripheral.h
|
||||
|
||||
Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co
|
||||
Andres Calderon andres.calderon@emqbit.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef __adc_peripheral_h__
|
||||
#define __adc_peripheral_h__
|
||||
|
||||
#include "jz47xx_mmap.h"
|
||||
#include "jz47xx_gpio.h"
|
||||
|
||||
#define ADC_CMD_NONE 0x00 /* Nothing to do */
|
||||
#define ADC_CMD_SET_SPI_CLKDIV 0x00 /* Set clock divider for ADC sclk */
|
||||
#define ADC_CMD_SET_BUFFER_SIZE 0x00 /* Set clock divider for ADC sclk */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL0 0x30 /* Set channel 0 */
|
||||
#define ADC_CMD_READ_CHANNEL0 0x20 /* Read channel 0 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL1 0x31 /* Set channel 1 */
|
||||
#define ADC_CMD_READ_CHANNEL1 0x21 /* Read channel 1 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL2 0x32 /* Set channel 2 */
|
||||
#define ADC_CMD_READ_CHANNEL2 0x22 /* Read channel 2 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL3 0x33 /* Set channel 3 */
|
||||
#define ADC_CMD_READ_CHANNEL3 0x23 /* Read channel 3 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL4 0x34 /* Set channel 4 */
|
||||
#define ADC_CMD_READ_CHANNEL4 0x24 /* Read channel 4 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL5 0x35 /* Set channel 5 */
|
||||
#define ADC_CMD_READ_CHANNEL5 0x25 /* Read channel 5 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL6 0x36 /* Set channel 6 */
|
||||
#define ADC_CMD_READ_CHANNEL6 0x26 /* Read channel 6 */
|
||||
|
||||
#define ADC_CMD_SET_CHANNEL7 0x37 /* Set channel 7 */
|
||||
#define ADC_CMD_READ_CHANNEL7 0x27 /* Read channel 8 */
|
||||
|
||||
#define ADC_CMD_SET_POWER_DOWN 0X38 /* Set ADC power down mode (1uA) */
|
||||
|
||||
#define ADC_CMD_SET_FAST_CONV 0X39 /* Initialize ADC Fast Convertion(<10us)*/
|
||||
|
||||
#define ADC_CMD_SET_LOW_CONV 0X3A /* Initialize ADC Slow Convertion(<40us)*/
|
||||
|
||||
#define ADC_CMD_SET_AUTOSELFT_1 0x3B /* Set Autoselft ADC {(Vref+)-(Vref-)}/2*/
|
||||
#define ADC_CMD_READ_AUTOSELFT_1 0x2B /* Read Autoselft ADC 1 (0x0200) */
|
||||
|
||||
#define ADC_CMD_SET_AUTOSELFT_2 0x3C /* Set Autoselft ADC (Vref-) */
|
||||
#define ADC_CMD_READ_AUTOSELFT_2 0x2C /* Read Autoselft ADC 2 (0x0000) */
|
||||
|
||||
#define ADC_CMD_SET_AUTOSELFT_3 0x3D /* Set Autoselft ADC (Vref+) */
|
||||
#define ADC_CMD_READ_AUTOSELFT_3 0x2D /* Read Autoselft ADC 3 (0x03FF) */
|
||||
|
||||
#define ADC_SPI_CLKDIV_MIN 0x08 /* 50/(2*9) -> 2.78MHz (MAX=2.8MHz) */
|
||||
#define ADC_SPI_CLKDIV_MAX 0xFF /* 50/(2*256) -> 97.65KHz */
|
||||
|
||||
#define ADC_MAX_BUFFER 0x3FE/* 1022 reads/commands */
|
||||
|
||||
#define CS2_PORT JZ_GPIO_PORT_B
|
||||
#define CS2_PIN 26
|
||||
|
||||
typedef unsigned char uchar;
|
||||
|
||||
JZ_REG *jz_adc_init();
|
||||
|
||||
#endif
|
BIN
Examples/ADC/Test-QT-src/jz_adc_peripheral.o
Normal file
BIN
Examples/ADC/Test-QT-src/jz_adc_peripheral.o
Normal file
Binary file not shown.
10
Examples/ADC/Test-QT-src/main.cpp
Executable file
10
Examples/ADC/Test-QT-src/main.cpp
Executable file
@ -0,0 +1,10 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
BIN
Examples/ADC/Test-QT-src/main.o
Normal file
BIN
Examples/ADC/Test-QT-src/main.o
Normal file
Binary file not shown.
57
Examples/ADC/Test-QT-src/mainwindow.cpp
Executable file
57
Examples/ADC/Test-QT-src/mainwindow.cpp
Executable file
@ -0,0 +1,57 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
#include <QTime>
|
||||
#include <math.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(this,SIGNAL(refresh()),ui->Graph, SLOT(repaint()));
|
||||
ui->Graph->setPointsPerPlot(100);
|
||||
ui->Graph->setVoltsPerDiv(819);
|
||||
ui->Graph->setNumSig(8);
|
||||
|
||||
timer1 = new QTimer(this);
|
||||
timer1->start(100);
|
||||
connect(timer1, SIGNAL(timeout()), this, SLOT(updateGraph()));
|
||||
|
||||
/*ADC1 = new ADCw;
|
||||
ADC1->testADC();
|
||||
ADC1->setBufferLen(800);
|
||||
|
||||
ADC1->setClockDiv(ADC_SPI_CLKDIV_MIN); //Max. speed 99KHz
|
||||
ADC1->setMuxChannels(7);*/
|
||||
printf("\nTaking 100 samples by channel at Fs=12.37KHz (trigger~100ms)\n");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::updateGraph()
|
||||
{
|
||||
//JZ_REG * dataADC;
|
||||
|
||||
int tempD, tempIdx=0;
|
||||
|
||||
//dataADC=ADC1->takeSamplesADC(0);
|
||||
for(int i=0; i< 800/2; i++)
|
||||
{
|
||||
//tempD = dataADC[i]&0x0FFF;
|
||||
tempD = sin(10*PI*i/200)*0x200+0x200;
|
||||
ui->Graph->addPoints(tempIdx,tempD+0x3ff*tempIdx);
|
||||
|
||||
//tempD = (dataADC[i]>>16)&0x0FFF;
|
||||
tempD = cos(10*PI*i/200)*0x200+0x200;
|
||||
ui->Graph->addPoints(tempIdx+1,tempD+0x3ff*(tempIdx+1));
|
||||
|
||||
tempIdx=(tempIdx+2)%8;
|
||||
}
|
||||
|
||||
|
||||
emit refresh();
|
||||
}
|
39
Examples/ADC/Test-QT-src/mainwindow.h
Executable file
39
Examples/ADC/Test-QT-src/mainwindow.h
Executable file
@ -0,0 +1,39 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include "ADCw.h"
|
||||
|
||||
#define PI 3.14159265
|
||||
#define VrmsC 0.017
|
||||
#define VmC 0.4999
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
bool getSign(int val){if(val<0) return 0; else return 1;}
|
||||
|
||||
public slots:
|
||||
void updateGraph();
|
||||
|
||||
signals:
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QTimer *timer1;
|
||||
ADCw *ADC1;
|
||||
bool CHANNEL;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
BIN
Examples/ADC/Test-QT-src/mainwindow.o
Normal file
BIN
Examples/ADC/Test-QT-src/mainwindow.o
Normal file
Binary file not shown.
66
Examples/ADC/Test-QT-src/mainwindow.ui
Executable file
66
Examples/ADC/Test-QT-src/mainwindow.ui
Executable file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ADC Test</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="SignalDisplay" name="Graph" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="action_Salir">
|
||||
<property name="text">
|
||||
<string>&Salir</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionA_cerca_de">
|
||||
<property name="text">
|
||||
<string>A&cerca de...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAcerca_de_QT">
|
||||
<property name="text">
|
||||
<string>Acerca de &QT</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAcerca_de_Qt">
|
||||
<property name="text">
|
||||
<string>Acerca de &Qt...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>SignalDisplay</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">signaldisplay.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
89
Examples/ADC/Test-QT-src/moc_mainwindow.cpp
Normal file
89
Examples/ADC/Test-QT-src/moc_mainwindow.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'mainwindow.h'
|
||||
**
|
||||
** Created: Sun Oct 31 11:42:47 2010
|
||||
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'mainwindow.h' doesn't include <QObject>."
|
||||
#elif Q_MOC_OUTPUT_REVISION != 62
|
||||
#error "This file was generated using the moc from 4.6.2. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_MOC_NAMESPACE
|
||||
static const uint qt_meta_data_MainWindow[] = {
|
||||
|
||||
// content:
|
||||
4, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
2, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
1, // signalCount
|
||||
|
||||
// signals: signature, parameters, type, tag, flags
|
||||
12, 11, 11, 11, 0x05,
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
22, 11, 11, 11, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_MainWindow[] = {
|
||||
"MainWindow\0\0refresh()\0updateGraph()\0"
|
||||
};
|
||||
|
||||
const QMetaObject MainWindow::staticMetaObject = {
|
||||
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow,
|
||||
qt_meta_data_MainWindow, 0 }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &MainWindow::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *MainWindow::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *MainWindow::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_MainWindow))
|
||||
return static_cast<void*>(const_cast< MainWindow*>(this));
|
||||
return QMainWindow::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QMainWindow::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
switch (_id) {
|
||||
case 0: refresh(); break;
|
||||
case 1: updateGraph(); break;
|
||||
default: ;
|
||||
}
|
||||
_id -= 2;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
// SIGNAL 0
|
||||
void MainWindow::refresh()
|
||||
{
|
||||
QMetaObject::activate(this, &staticMetaObject, 0, 0);
|
||||
}
|
||||
QT_END_MOC_NAMESPACE
|
BIN
Examples/ADC/Test-QT-src/moc_mainwindow.o
Normal file
BIN
Examples/ADC/Test-QT-src/moc_mainwindow.o
Normal file
Binary file not shown.
27
Examples/ADC/Test-QT-src/qmake.conf
Normal file
27
Examples/ADC/Test-QT-src/qmake.conf
Normal file
@ -0,0 +1,27 @@
|
||||
include(../../common/g++.conf)
|
||||
include(../../common/linux.conf)
|
||||
include(../../common/qws.conf)
|
||||
OPENWRT_DIR = "/home/cain/Embedded/ingenic/sakc/build/openwrt-xburst"
|
||||
ROOTFS_DIR = "$${OPENWRT_DIR}/staging_dir/target-mipsel_uClibc-0.9.30.1"
|
||||
TOOLCHAIN_DIR = "$${OPENWRT_DIR}/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1"
|
||||
QT_BASE_DIR = "$${OPENWRT_DIR}/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2"
|
||||
INCDIR = -I$${ROOTFS_DIR}/usr/include/freetype2 -I$${ROOTFS_DIR}/usr/include -I$${ROOTFS_DIR}/include -I$${TOOLCHAIN_DIR}/usr/include -I$${TOOLCHAIN_DIR}/include
|
||||
QMAKE_CC = mipsel-openwrt-linux-uclibc-gcc
|
||||
QMAKE_CXX = mipsel-openwrt-linux-uclibc-g++
|
||||
QMAKE_AR = mipsel-openwrt-linux-uclibc-ar cqs
|
||||
QMAKE_OBJCOPY = mipsel-openwrt-linux-uclibc-objcopy
|
||||
QMAKE_RANLIB = mipsel-openwrt-linux-uclibc-ranlib
|
||||
QMAKE_CFLAGS = -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float $${INCDIR}
|
||||
QMAKE_CXXFLAGS = -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float $${INCDIR}
|
||||
QMAKE_LINK = mipsel-openwrt-linux-uclibc-g++
|
||||
QMAKE_LINK_SHLIB = mipsel-openwrt-linux-uclibc-g++
|
||||
QMAKE_LINK_C = mipsel-openwrt-linux-uclibc-gcc
|
||||
QMAKE_LINK_C_SHLIB = mipsel-openwrt-linux-uclibc-gcc
|
||||
QMAKE_LFLAGS = -L$${QT_BASE_DIR}/lib -L$${ROOTFS_DIR}/usr/lib -L$${ROOTFS_DIR}/lib -L/$${TOOLCHAIN_DIR}/usr/lib -L/$${TOOLCHAIN_DIR}/lib -Wl,-rpath-link=$${ROOTFS_DIR}/usr/lib
|
||||
QMAKE_STRIP = :
|
||||
QMAKE_STRIPFLAGS_LIB =
|
||||
QMAKE_INCDIR_QT = $${QT_BASE_DIR}/include
|
||||
QMAKE_LIBDIR_QT = $${QT_BASE_DIR}/lib
|
||||
QMAKE_MOC = $${QT_BASE_DIR}/bin/moc
|
||||
QMAKE_UIC = $${QT_BASE_DIR}/bin/uic
|
||||
load(qt_config)
|
68
Examples/ADC/Test-QT-src/signaldisplay.cpp
Executable file
68
Examples/ADC/Test-QT-src/signaldisplay.cpp
Executable file
@ -0,0 +1,68 @@
|
||||
#include "signaldisplay.h"
|
||||
#include <QtGui>
|
||||
#include <QDebug>
|
||||
|
||||
SignalDisplay::SignalDisplay(QWidget *&parent):QWidget(parent)
|
||||
{
|
||||
secsPerDiv = 1.0/600.0;
|
||||
voltsPerDiv = 20;
|
||||
numSig=2;
|
||||
setPointsPerPlot(10);
|
||||
}
|
||||
|
||||
void SignalDisplay::setNumSig(int value)
|
||||
{
|
||||
numSig = value;
|
||||
setPointsPerPlot(pointsPerPlot);
|
||||
}
|
||||
|
||||
void SignalDisplay::setPointsPerPlot(int value)
|
||||
{
|
||||
pointsPerPlot = value;
|
||||
waves = new QPoint *[numSig];
|
||||
secsIdx=new int[numSig];
|
||||
colorTraces = new QColor[numSig];
|
||||
int numT=(255/(numSig+1));
|
||||
for(int i=0;i<numSig;i++)
|
||||
{
|
||||
waves[i] = new QPoint [pointsPerPlot];
|
||||
secsIdx[i]=0;
|
||||
colorTraces[i]=qRgb(numT*(i%numSig),numT*(i%numSig),numT*(i%numSig));
|
||||
}
|
||||
}
|
||||
|
||||
void SignalDisplay::drawGrid(QPainter &p, QColor colorGrid, int x, int y, int w, int h, int nx, int ny){
|
||||
p.setPen(colorGrid);
|
||||
for (int ix= 0; ix<nx; ix++){
|
||||
int x = ix*w/nx;
|
||||
p.drawLine(x,0,x,h);
|
||||
}
|
||||
for (int iy = 0; iy < ny; iy++){
|
||||
int y = iy*h/ny;
|
||||
p.drawLine(0,y,w,y);
|
||||
}
|
||||
}
|
||||
void SignalDisplay::paintEvent(QPaintEvent *event){
|
||||
QPainter painter(this);
|
||||
w = width();
|
||||
h = height();
|
||||
ox = w;
|
||||
oy = h;
|
||||
painter.fillRect(0,0,w,h,Qt::white);
|
||||
drawGrid(painter, Qt::lightGray,0,0,w,h,5, 10);
|
||||
for(int i=0; i<numSig; i++)
|
||||
{
|
||||
painter.setPen(colorTraces[i]);
|
||||
painter.drawPolyline(waves[i],pointsPerPlot);
|
||||
}
|
||||
}
|
||||
|
||||
void SignalDisplay::addPoints(int idx, int value)
|
||||
{
|
||||
waves[idx][secsIdx[idx]] = QPoint(secsIdx[idx]*w/10/60.0/pointsPerPlot/secsPerDiv+w/(2*pointsPerPlot), \
|
||||
oy-value*h/voltsPerDiv/10);
|
||||
secsIdx[idx] = (secsIdx[idx]+1) % pointsPerPlot;
|
||||
}
|
||||
|
||||
|
||||
//EOF
|
33
Examples/ADC/Test-QT-src/signaldisplay.h
Executable file
33
Examples/ADC/Test-QT-src/signaldisplay.h
Executable file
@ -0,0 +1,33 @@
|
||||
#ifndef SIGNALDISPLAY_H
|
||||
#define SIGNALDISPLAY_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <cmath>
|
||||
#include <QtGui>
|
||||
|
||||
class SignalDisplay : public QWidget
|
||||
{
|
||||
public:
|
||||
SignalDisplay(QWidget *&parent);
|
||||
void addPoints(int idx, int value);
|
||||
void setSecsPerDiv( float value ){ secsPerDiv = fabs(value);}
|
||||
void setVoltsPerDiv( float value ){ voltsPerDiv = fabs(value);}
|
||||
float getSecsPerDiv(){ return secsPerDiv; }
|
||||
void setPointsPerPlot(int value);
|
||||
void setColorTraces(QColor color, int idx){colorTraces[idx]=color;}
|
||||
void setNumSig(int value);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void drawGrid(QPainter &p, QColor colorGrid, int x, int y, int w, int h, int nx, int ny);
|
||||
QPoint **waves;
|
||||
float voltsPerDiv;
|
||||
float secsPerDiv;
|
||||
QColor *colorTraces;
|
||||
int *secsIdx;
|
||||
int w, h, ox, oy;
|
||||
int pointsPerPlot;
|
||||
int numSig;
|
||||
};
|
||||
|
||||
#endif // SIGNALDISPLAY_H
|
BIN
Examples/ADC/Test-QT-src/signaldisplay.o
Normal file
BIN
Examples/ADC/Test-QT-src/signaldisplay.o
Normal file
Binary file not shown.
77
Examples/ADC/Test-QT-src/ui_mainwindow.h
Normal file
77
Examples/ADC/Test-QT-src/ui_mainwindow.h
Normal file
@ -0,0 +1,77 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'mainwindow.ui'
|
||||
**
|
||||
** Created: Sun Oct 31 11:42:44 2010
|
||||
** by: Qt User Interface Compiler version 4.6.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_MAINWINDOW_H
|
||||
#define UI_MAINWINDOW_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QWidget>
|
||||
#include <signaldisplay.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_MainWindow
|
||||
{
|
||||
public:
|
||||
QAction *action_Salir;
|
||||
QAction *actionA_cerca_de;
|
||||
QAction *actionAcerca_de_QT;
|
||||
QAction *actionAcerca_de_Qt;
|
||||
QWidget *centralWidget;
|
||||
SignalDisplay *Graph;
|
||||
|
||||
void setupUi(QMainWindow *MainWindow)
|
||||
{
|
||||
if (MainWindow->objectName().isEmpty())
|
||||
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
||||
MainWindow->resize(320, 240);
|
||||
action_Salir = new QAction(MainWindow);
|
||||
action_Salir->setObjectName(QString::fromUtf8("action_Salir"));
|
||||
actionA_cerca_de = new QAction(MainWindow);
|
||||
actionA_cerca_de->setObjectName(QString::fromUtf8("actionA_cerca_de"));
|
||||
actionAcerca_de_QT = new QAction(MainWindow);
|
||||
actionAcerca_de_QT->setObjectName(QString::fromUtf8("actionAcerca_de_QT"));
|
||||
actionAcerca_de_Qt = new QAction(MainWindow);
|
||||
actionAcerca_de_Qt->setObjectName(QString::fromUtf8("actionAcerca_de_Qt"));
|
||||
centralWidget = new QWidget(MainWindow);
|
||||
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
|
||||
Graph = new SignalDisplay(centralWidget);
|
||||
Graph->setObjectName(QString::fromUtf8("Graph"));
|
||||
Graph->setGeometry(QRect(0, 0, 320, 240));
|
||||
Graph->setMinimumSize(QSize(100, 20));
|
||||
MainWindow->setCentralWidget(centralWidget);
|
||||
|
||||
retranslateUi(MainWindow);
|
||||
|
||||
QMetaObject::connectSlotsByName(MainWindow);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QMainWindow *MainWindow)
|
||||
{
|
||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "ADC Test", 0, QApplication::UnicodeUTF8));
|
||||
action_Salir->setText(QApplication::translate("MainWindow", "&Salir", 0, QApplication::UnicodeUTF8));
|
||||
actionA_cerca_de->setText(QApplication::translate("MainWindow", "A&cerca de...", 0, QApplication::UnicodeUTF8));
|
||||
actionAcerca_de_QT->setText(QApplication::translate("MainWindow", "Acerca de &QT", 0, QApplication::UnicodeUTF8));
|
||||
actionAcerca_de_Qt->setText(QApplication::translate("MainWindow", "Acerca de &Qt...", 0, QApplication::UnicodeUTF8));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow: public Ui_MainWindow {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_MAINWINDOW_H
|
@ -1,15 +1,15 @@
|
||||
PCBNEW-LibModule-V1 23/2/2010-03:08:11
|
||||
$INDEX
|
||||
J17
|
||||
POWER_CONN
|
||||
$EndINDEX
|
||||
$MODULE J17
|
||||
$MODULE POWER_CONN
|
||||
Po 0 0 0 15 43C58C74 4B834694 ~~
|
||||
Li J17
|
||||
Li POWER_CONN
|
||||
Sc 4B834694
|
||||
AR
|
||||
Op 0 0 0
|
||||
T0 0 -79 157 157 -1800 20 N V 21 "J17"
|
||||
T1 0 118 118 118 -1800 20 N I 21 "HEADER 2"
|
||||
T0 0 -79 157 157 -1800 20 N I 21 "POWER_CONN"
|
||||
T1 0 118 118 118 -1800 20 N V 21 "VALUE"
|
||||
DS -1650 2650 -1650 -3350 10 24
|
||||
DS -1650 -3350 2350 -3350 10 24
|
||||
DS 2350 -3350 2350 2650 10 24
|
||||
@ -39,5 +39,5 @@ At STD N 00C08001
|
||||
Ne 0 ""
|
||||
Po 1500 -1500
|
||||
$EndPAD
|
||||
$EndMODULE J17
|
||||
$EndMODULE POWER_CONN
|
||||
$EndLIBRARY
|
||||
|
@ -1,4 +1,4 @@
|
||||
update=Mon 11 Oct 2010 12:34:05 PM COT
|
||||
update=Mon 08 Nov 2010 07:59:46 PM COT
|
||||
last_client=pcbnew
|
||||
[general]
|
||||
version=1
|
||||
@ -95,7 +95,7 @@ DrawLar=79
|
||||
EdgeLar=79
|
||||
TxtLar=120
|
||||
MSegLar=79
|
||||
LastNetListRead=
|
||||
LastNetListRead=SAKC.net
|
||||
[pcbnew/libraries]
|
||||
LibDir=./N_MODELS/
|
||||
LibName1=./N_MODELS/D8
|
||||
|
23
Software/sie_cg/block_editor/adc_single.die
Normal file
23
Software/sie_cg/block_editor/adc_single.die
Normal file
@ -0,0 +1,23 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="ADC Single">
|
||||
<Polygon>
|
||||
<Point x="-80" y="0"/>
|
||||
<Point x="-60" y="-40"/>
|
||||
<Point x="60" y="-40"/>
|
||||
<Point x="60" y="40"/>
|
||||
<Point x="110" y="40"/>
|
||||
<Point x="110" y="-40"/>
|
||||
<Point x="60" y="-40"/>
|
||||
<Point x="110" y="-40"/>
|
||||
<Point x="110" y="40"/>
|
||||
<Point x="-60" y="40"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="3" text="ADC Single Channel" posOffset-x="0"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="4" text="0" posOffset-x="20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="5" text="CH:" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="6" text="SP:" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="7" text="255" posOffset-x="20"/>
|
||||
<TextItem myStyleIO="8" posOffset-y="-20" editableItem="0" ID="8" text="UChar" posOffset-x="110"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
14
Software/sie_cg/block_editor/constant.die
Normal file
14
Software/sie_cg/block_editor/constant.die
Normal file
@ -0,0 +1,14 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="Constant">
|
||||
<Polygon>
|
||||
<Point x="-50" y="-10"/>
|
||||
<Point x="-50" y="30"/>
|
||||
<Point x="30" y="30"/>
|
||||
<Point x="30" y="-10"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="21" text="Value" posOffset-x="-30"/>
|
||||
<TextItem myStyleIO="3" posOffset-y="-20" editableItem="0" ID="15" text="OUT Integer" posOffset-x="30"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="19" text="1" posOffset-x="10"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
@ -118,8 +118,8 @@ void DiagramScene::doSnapToGrid(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
if(snapToGrid){
|
||||
mouseEvent->setScenePos(QPointF(
|
||||
int(mouseEvent->scenePos().x()/myGrid)*myGrid,
|
||||
int(mouseEvent->scenePos().y()/myGrid)*myGrid
|
||||
round(mouseEvent->scenePos().x()/myGrid)*myGrid,
|
||||
round(mouseEvent->scenePos().y()/myGrid)*myGrid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
18
Software/sie_cg/block_editor/left_shift.die
Normal file
18
Software/sie_cg/block_editor/left_shift.die
Normal file
@ -0,0 +1,18 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="Left Shift">
|
||||
<Polygon>
|
||||
<Point x="-70" y="-30"/>
|
||||
<Point x="-70" y="20"/>
|
||||
<Point x="60" y="20"/>
|
||||
<Point x="60" y="-30"/>
|
||||
<Point x="-50" y="-30"/>
|
||||
<Point x="-70" y="-30"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="9" posOffset-y="-0" editableItem="0" ID="13" text="OUT" posOffset-x="60"/>
|
||||
<TextItem myStyleIO="138" posOffset-y="-0" editableItem="0" ID="12" text="IN" posOffset-x="-70"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text="<<" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
@ -168,6 +168,20 @@ void MainWindow::createToolBox()
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("Float"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("Short"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("Long"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("UChar"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("UInt"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("UShort"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
layout->addWidget(createToolButton(129+i,tr("ULong"),
|
||||
QIcon(":/images/background1.png")),++i,0);
|
||||
|
||||
|
||||
|
||||
//OUTPUTS
|
||||
i=0;
|
||||
@ -181,6 +195,18 @@ void MainWindow::createToolBox()
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("Float"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("Short"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("Long"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("UChar"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("UInt"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("UShort"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
layout->addWidget(createToolButton(i,tr("ULong"),
|
||||
QIcon(":/images/background3.png")),++i,1);
|
||||
|
||||
layout->setRowStretch(3, 10);
|
||||
layout->setColumnStretch(2, 10);
|
||||
|
32
Software/sie_cg/block_editor/pwm_single.die
Normal file
32
Software/sie_cg/block_editor/pwm_single.die
Normal file
@ -0,0 +1,32 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="PWM Single">
|
||||
<Polygon>
|
||||
<Point x="-90" y="-50"/>
|
||||
<Point x="50" y="-50"/>
|
||||
<Point x="50" y="-30"/>
|
||||
<Point x="-90" y="-30"/>
|
||||
<Point x="-90" y="20"/>
|
||||
<Point x="-40" y="20"/>
|
||||
<Point x="50" y="20"/>
|
||||
<Point x="50" y="10"/>
|
||||
<Point x="-40" y="10"/>
|
||||
<Point x="-40" y="-10"/>
|
||||
<Point x="-20" y="-10"/>
|
||||
<Point x="0" y="-10"/>
|
||||
<Point x="0" y="10"/>
|
||||
<Point x="10" y="10"/>
|
||||
<Point x="10" y="-10"/>
|
||||
<Point x="50" y="-10"/>
|
||||
<Point x="50" y="10"/>
|
||||
<Point x="50" y="-30"/>
|
||||
<Point x="50" y="20"/>
|
||||
<Point x="-90" y="20"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="137" posOffset-y="-0" editableItem="0" ID="14" text="UChar" posOffset-x="-90"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="15" text="|-Duty-|" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="16" text="0" posOffset-x="0"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="11" text="Out:" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="18" text="PWM" posOffset-x="-50"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
18
Software/sie_cg/block_editor/right_shift.die
Normal file
18
Software/sie_cg/block_editor/right_shift.die
Normal file
@ -0,0 +1,18 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="Right Shift">
|
||||
<Polygon>
|
||||
<Point x="-70" y="-30"/>
|
||||
<Point x="-70" y="20"/>
|
||||
<Point x="60" y="20"/>
|
||||
<Point x="60" y="-30"/>
|
||||
<Point x="-50" y="-30"/>
|
||||
<Point x="-70" y="-30"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="9" posOffset-y="-0" editableItem="0" ID="13" text="OUT" posOffset-x="60"/>
|
||||
<TextItem myStyleIO="138" posOffset-y="-0" editableItem="0" ID="12" text="IN" posOffset-x="-70"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text=">>" posOffset-x="-20"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
@ -1,15 +1,15 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="Test Block 2">
|
||||
<Polygon>
|
||||
<Point x="-50" y="-20"/>
|
||||
<Point x="-30" y="0"/>
|
||||
<Point x="-50" y="20"/>
|
||||
<Point x="-60" y="-20"/>
|
||||
<Point x="-40" y="0"/>
|
||||
<Point x="-60" y="20"/>
|
||||
<Point x="30" y="20"/>
|
||||
<Point x="60" y="0"/>
|
||||
<Point x="40" y="-20"/>
|
||||
<Point x="50" y="0"/>
|
||||
<Point x="30" y="-20"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="130" posOffset-y="-0" editableItem="0" ID="1" text=" IN Bool" posOffset-x="-30"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="30" editableItem="0" ID="0" text="Test Block 2" posOffset-x="-10"/>
|
||||
<TextItem myStyleIO="130" posOffset-y="-0" editableItem="0" ID="1" text=" IN Bool" posOffset-x="-30"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
||||
|
69
Software/sie_cg/block_editor/timer.die
Normal file
69
Software/sie_cg/block_editor/timer.die
Normal file
@ -0,0 +1,69 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="Timer">
|
||||
<Polygon>
|
||||
<Point x="-70" y="-80"/>
|
||||
<Point x="-70" y="80"/>
|
||||
<Point x="80" y="80"/>
|
||||
<Point x="80" y="-80"/>
|
||||
<Point x="-70" y="-80"/>
|
||||
<Point x="-70" y="-30"/>
|
||||
<Point x="80" y="-30"/>
|
||||
<Point x="80" y="80"/>
|
||||
<Point x="50" y="80"/>
|
||||
<Point x="40" y="50"/>
|
||||
<Point x="30" y="50"/>
|
||||
<Point x="20" y="60"/>
|
||||
<Point x="40" y="40"/>
|
||||
<Point x="40" y="40"/>
|
||||
<Point x="40" y="30"/>
|
||||
<Point x="30" y="40"/>
|
||||
<Point x="30" y="30"/>
|
||||
<Point x="30" y="30"/>
|
||||
<Point x="10" y="30"/>
|
||||
<Point x="10" y="30"/>
|
||||
<Point x="10" y="30"/>
|
||||
<Point x="30" y="30"/>
|
||||
<Point x="30" y="20"/>
|
||||
<Point x="40" y="30"/>
|
||||
<Point x="40" y="20"/>
|
||||
<Point x="30" y="10"/>
|
||||
<Point x="30" y="10"/>
|
||||
<Point x="40" y="0"/>
|
||||
<Point x="50" y="10"/>
|
||||
<Point x="50" y="0"/>
|
||||
<Point x="40" y="-10"/>
|
||||
<Point x="30" y="-20"/>
|
||||
<Point x="20" y="-20"/>
|
||||
<Point x="30" y="-10"/>
|
||||
<Point x="20" y="0"/>
|
||||
<Point x="20" y="0"/>
|
||||
<Point x="-10" y="0"/>
|
||||
<Point x="-20" y="-10"/>
|
||||
<Point x="-10" y="-20"/>
|
||||
<Point x="-20" y="-20"/>
|
||||
<Point x="-40" y="0"/>
|
||||
<Point x="-40" y="10"/>
|
||||
<Point x="-30" y="0"/>
|
||||
<Point x="-20" y="10"/>
|
||||
<Point x="-20" y="10"/>
|
||||
<Point x="-20" y="10"/>
|
||||
<Point x="-30" y="20"/>
|
||||
<Point x="-30" y="40"/>
|
||||
<Point x="-20" y="50"/>
|
||||
<Point x="-10" y="60"/>
|
||||
<Point x="20" y="60"/>
|
||||
<Point x="-10" y="60"/>
|
||||
<Point x="-20" y="50"/>
|
||||
<Point x="-30" y="50"/>
|
||||
<Point x="-30" y="50"/>
|
||||
<Point x="-40" y="80"/>
|
||||
<Point x="-70" y="80"/>
|
||||
<Point x="-70" y="80"/>
|
||||
<Point x="-70" y="80"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="1" text="1 " posOffset-x="-10"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="2" text="ms" posOffset-x="10"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="60" editableItem="0" ID="0" text="System Timer" posOffset-x="0"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
29
Software/sie_cg/block_editor/while.die
Normal file
29
Software/sie_cg/block_editor/while.die
Normal file
@ -0,0 +1,29 @@
|
||||
<!--File for SIE Code Generator. Custmos Blocks-->
|
||||
<CustomItem BlockName="System While">
|
||||
<Polygon>
|
||||
<Point x="-50" y="-30"/>
|
||||
<Point x="50" y="-30"/>
|
||||
<Point x="50" y="-10"/>
|
||||
<Point x="-50" y="-10"/>
|
||||
<Point x="-50" y="30"/>
|
||||
<Point x="0" y="30"/>
|
||||
<Point x="0" y="0"/>
|
||||
<Point x="40" y="0"/>
|
||||
<Point x="40" y="20"/>
|
||||
<Point x="20" y="20"/>
|
||||
<Point x="20" y="10"/>
|
||||
<Point x="10" y="20"/>
|
||||
<Point x="20" y="30"/>
|
||||
<Point x="20" y="20"/>
|
||||
<Point x="20" y="30"/>
|
||||
<Point x="50" y="30"/>
|
||||
<Point x="50" y="-10"/>
|
||||
<Point x="50" y="30"/>
|
||||
<Point x="-50" y="30"/>
|
||||
<Point x="-50" y="-10"/>
|
||||
</Polygon>
|
||||
<TextItems>
|
||||
<TextItem myStyleIO="130" posOffset-y="-10" editableItem="0" ID="14" text="IN Bool" posOffset-x="-50"/>
|
||||
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="23" text="System While" posOffset-x="0"/>
|
||||
</TextItems>
|
||||
</CustomItem>
|
@ -176,8 +176,8 @@ void DiagramScene::doSnapToGrid(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
if(snapToGrid){
|
||||
mouseEvent->setScenePos(QPointF(
|
||||
int(mouseEvent->scenePos().x()/myGrid)*myGrid,
|
||||
int(mouseEvent->scenePos().y()/myGrid)*myGrid
|
||||
round(mouseEvent->scenePos().x()/myGrid)*myGrid,
|
||||
round(mouseEvent->scenePos().y()/myGrid)*myGrid
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -277,6 +277,10 @@ QDomDocument DiagramScene::toXmlFormat()
|
||||
QDomElement diagram = document.createElement("Diagram");
|
||||
document.appendChild(diagram);
|
||||
|
||||
QDomElement test = document.createElement("Test");
|
||||
test.text().fromAscii("TEXT HERE");
|
||||
document.appendChild(test);
|
||||
|
||||
//Lists of items
|
||||
QList<DiagramItem *> Items;
|
||||
QList<Arrow *> Arrows;
|
||||
|
@ -76,7 +76,7 @@
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<valuelist key="abstractProcess.Environment" type="QVariantList">
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MI4KrAyPP5,guid=5c5c5e6146195c74b6ad266d4cc07afd</value>
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bm3IFDvHlY,guid=a9cadece3d5adbab4e7ecc664cc367c4</value>
|
||||
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
|
||||
<value type="QString">DESKTOP_SESSION=gnome</value>
|
||||
<value type="QString">DISPLAY=:0.0</value>
|
||||
@ -84,12 +84,11 @@
|
||||
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
|
||||
<value type="QString">GDM_LANG=en_US.utf8</value>
|
||||
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-CFAuJK</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1516</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-EOe3re</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1591</value>
|
||||
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
|
||||
<value type="QString">HOME=/home/juan64bits</value>
|
||||
<value type="QString">LANG=en_US.utf8</value>
|
||||
<value type="QString">LANGUAGE=</value>
|
||||
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
|
||||
<value type="QString">LOGNAME=juan64bits</value>
|
||||
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
|
||||
@ -97,20 +96,20 @@
|
||||
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||
<value type="QString">PWD=/home/juan64bits</value>
|
||||
<value type="QString">QTDIR=/usr/share/qt4</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1534,unix/Maximus:/tmp/.ICE-unix/1534</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1609,unix/Maximus:/tmp/.ICE-unix/1609</value>
|
||||
<value type="QString">SHELL=/bin/bash</value>
|
||||
<value type="QString">SPEECHD_PORT=7560</value>
|
||||
<value type="QString">SSH_AGENT_PID=1570</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-CFAuJK/ssh</value>
|
||||
<value type="QString">SSH_AGENT_PID=1645</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-EOe3re/ssh</value>
|
||||
<value type="QString">USER=juan64bits</value>
|
||||
<value type="QString">USERNAME=juan64bits</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-V4ry7M/database</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-XFOps8/database</value>
|
||||
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
|
||||
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287682812.550485-1725059380</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287874500.2500-279079160</value>
|
||||
</valuelist>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList">
|
||||
<value type="QString">/home/juan64bits/QT/diagramscene/diagramscene.pro</value>
|
||||
<value type="QString">/home/juan64bits/QT/sie_cg/diagramscene.pro</value>
|
||||
<value type="QString">-spec</value>
|
||||
<value type="QString">linux-g++</value>
|
||||
<value type="QString">-r</value>
|
||||
@ -118,7 +117,7 @@
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
|
||||
<value key="abstractProcess.enabled" type="bool">false</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/diagramscene</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/sie_cg</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
@ -126,7 +125,7 @@
|
||||
<valuemap type="QVariantMap">
|
||||
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
|
||||
<valuelist key="abstractProcess.Environment" type="QVariantList">
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-MI4KrAyPP5,guid=5c5c5e6146195c74b6ad266d4cc07afd</value>
|
||||
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bm3IFDvHlY,guid=a9cadece3d5adbab4e7ecc664cc367c4</value>
|
||||
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
|
||||
<value type="QString">DESKTOP_SESSION=gnome</value>
|
||||
<value type="QString">DISPLAY=:0.0</value>
|
||||
@ -134,12 +133,11 @@
|
||||
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
|
||||
<value type="QString">GDM_LANG=en_US.utf8</value>
|
||||
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-CFAuJK</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1516</value>
|
||||
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-EOe3re</value>
|
||||
<value type="QString">GNOME_KEYRING_PID=1591</value>
|
||||
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
|
||||
<value type="QString">HOME=/home/juan64bits</value>
|
||||
<value type="QString">LANG=en_US.utf8</value>
|
||||
<value type="QString">LANGUAGE=</value>
|
||||
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
|
||||
<value type="QString">LOGNAME=juan64bits</value>
|
||||
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
|
||||
@ -147,17 +145,17 @@
|
||||
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||
<value type="QString">PWD=/home/juan64bits</value>
|
||||
<value type="QString">QTDIR=/usr/share/qt4</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1534,unix/Maximus:/tmp/.ICE-unix/1534</value>
|
||||
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1609,unix/Maximus:/tmp/.ICE-unix/1609</value>
|
||||
<value type="QString">SHELL=/bin/bash</value>
|
||||
<value type="QString">SPEECHD_PORT=7560</value>
|
||||
<value type="QString">SSH_AGENT_PID=1570</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-CFAuJK/ssh</value>
|
||||
<value type="QString">SSH_AGENT_PID=1645</value>
|
||||
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-EOe3re/ssh</value>
|
||||
<value type="QString">USER=juan64bits</value>
|
||||
<value type="QString">USERNAME=juan64bits</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-V4ry7M/database</value>
|
||||
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-XFOps8/database</value>
|
||||
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
|
||||
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287682812.550485-1725059380</value>
|
||||
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1287874500.2500-279079160</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList">
|
||||
@ -165,7 +163,7 @@
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
|
||||
<value key="abstractProcess.enabled" type="bool">true</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/diagramscene</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">/home/juan64bits/QT/sie_cg</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
|
@ -374,7 +374,7 @@ void MainWindow::createToolBox()
|
||||
toolBox = new QToolBox;
|
||||
toolBox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Ignored));
|
||||
toolBox->setMinimumWidth(itemWidget->sizeHint().width());
|
||||
toolBox->addItem(itemWidget, tr("Basic Flowchart Shapes"));
|
||||
toolBox->addItem(itemWidget, tr("Basic blocks"));
|
||||
//toolBox->addItem(backgroundWidget, tr("Backgrounds"));
|
||||
|
||||
//Add tool box to window
|
||||
|
@ -212,8 +212,8 @@ public:
|
||||
{
|
||||
QProcess lnexternapp;
|
||||
lnexternapp.start(QString("%1 %2").arg(execFile).arg(execParm));
|
||||
lnexternapp.waitForFinished(-1);
|
||||
retnValu = QString(lnexternapp.readAll());
|
||||
//lnexternapp.waitForFinished(-1);
|
||||
//retnValu = QString(lnexternapp.readAll());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7,35 +7,53 @@ Arrows depend of items, and items depend of libraries!!!!
|
||||
-->
|
||||
<Diagram>
|
||||
<Libraries>
|
||||
<Library Dir="block_editor/timer.die"/>
|
||||
<Library Dir="block_editor/adc_single.die"/>
|
||||
<Library Dir="block_editor/left_shift.die"/>
|
||||
<Library Dir="block_editor/right_shift.die"/>
|
||||
<Library Dir="block_editor/pwm_single.die"/>
|
||||
<Library Dir="block_editor/constant.die"/>
|
||||
<Library Dir="block_editor/while.die"/>
|
||||
<Library Dir="block_editor/test_block1.die"/>
|
||||
<Library Dir="block_editor/test_block2.die"/>
|
||||
<Library Dir="block_editor/test_block3.die"/>
|
||||
</Libraries>
|
||||
<DiagramItems>
|
||||
<DiagramItem x="2780" y="2540" z="500" type="Test Block 2" ID="0" color="#0000ff">
|
||||
<diagramValues/>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2510" y="2440" z="500" type="Test Block 1" ID="1" color="#808080">
|
||||
<DiagramItem x="2280" y="2110" z="500" type="Timer" ID="0" color="#00ff00">
|
||||
<diagramValues>
|
||||
<diagramValue value="0.001" ID="1"/>
|
||||
<diagramValue value="1 " ID="1"/>
|
||||
</diagramValues>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2230" y="2550" z="500" type="Test Block 3" ID="2" color="#ff0000">
|
||||
<DiagramItem x="2460" y="2350" z="500" type="Right Shift" ID="1" color="#00ffff">
|
||||
<diagramValues>
|
||||
<diagramValue value="1" ID="11"/>
|
||||
</diagramValues>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2670" y="2350" z="500" type="PWM Single" ID="2" color="#808000">
|
||||
<diagramValues>
|
||||
<diagramValue value="0" ID="16"/>
|
||||
</diagramValues>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2580" y="2110" z="500" type="System While" ID="3" color="#ff00ff">
|
||||
<diagramValues/>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2470" y="2100" z="500" type="Constant" ID="4" color="#00ffff">
|
||||
<diagramValues>
|
||||
<diagramValue value="Value" ID="21"/>
|
||||
<diagramValue value="1" ID="19"/>
|
||||
</diagramValues>
|
||||
</DiagramItem>
|
||||
<DiagramItem x="2220" y="2330" z="-0.1" type="ADC Single" ID="5" color="#808080">
|
||||
<diagramValues>
|
||||
<diagramValue value="0" ID="4"/>
|
||||
<diagramValue value="255" ID="7"/>
|
||||
</diagramValues>
|
||||
</DiagramItem>
|
||||
</DiagramItems>
|
||||
<Arrows>
|
||||
<Arrow end-ID="1" end-Owner="0" start-x="140" start-y="0" start-Owner="1" ID="0" start-ID="3" end-x="-30" end-y="0" color="#808080">
|
||||
<arrowCorners>
|
||||
<arrowCorner x="2700" y="2440"/>
|
||||
<arrowCorner x="2699.5" y="2539.5"/>
|
||||
</arrowCorners>
|
||||
</Arrow>
|
||||
<Arrow end-ID="4" end-Owner="1" start-x="60" start-y="0" start-Owner="2" ID="1" start-ID="0" end-x="-120" end-y="0" color="#808080">
|
||||
<arrowCorners>
|
||||
<arrowCorner x="2340" y="2550"/>
|
||||
<arrowCorner x="2340" y="2440"/>
|
||||
</arrowCorners>
|
||||
</Arrow>
|
||||
<Arrow end-ID="12" end-Owner="1" start-x="110" start-y="20" start-Owner="5" ID="0" start-ID="8" end-x="-70" end-y="0" color="#000000"/>
|
||||
<Arrow end-ID="14" end-Owner="2" start-x="60" start-y="0" start-Owner="1" ID="1" start-ID="13" end-x="-90" end-y="0" color="#000000"/>
|
||||
<Arrow end-ID="14" end-Owner="3" start-x="30" start-y="20" start-Owner="4" ID="2" start-ID="15" end-x="-50" end-y="10" color="#000000"/>
|
||||
</Arrows>
|
||||
</Diagram>
|
||||
<Test/>
|
||||
|
BIN
Software/sie_cg/test1.png
Normal file
BIN
Software/sie_cg/test1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 261 KiB |
Loading…
Reference in New Issue
Block a user