No changes between revisions
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/Makefile
0,0 → 1,218
#############################################################################
# Makefile for building: logger
# Generated by qmake (2.01a) (Qt 4.7.2) on: Mon Jul 11 05:34:36 2011
# Project: logger.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile logger.pro
#############################################################################
 
####### Compiler, tools and options
 
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -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.
LINK = g++
LFLAGS = -Wl,-O1 -Wl,-rpath,/usr/lib/qt4
LIBS = $(SUBLIBS) -L/usr/lib/qt4 -lQtGui -L/usr/lib/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -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 \
scope.cpp moc_scope.cpp
OBJECTS = main.o \
scope.o \
moc_scope.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/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.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 \
logger.pro
QMAKE_TARGET = logger
DESTDIR =
TARGET = logger
 
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): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
Makefile: logger.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/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.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/qt4/libQtGui.prl \
/usr/lib/qt4/libQtCore.prl
$(QMAKE) -o Makefile logger.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/modules/qt_phonon.pri:
/usr/share/qt4/mkspecs/modules/qt_webkit_version.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/qt4/libQtGui.prl:
/usr/lib/qt4/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile logger.pro
 
dist:
@$(CHK_DIR_EXISTS) .tmp/logger1.0.0 || $(MKDIR) .tmp/logger1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/logger1.0.0/ && $(COPY_FILE) --parents scope.h .tmp/logger1.0.0/ && $(COPY_FILE) --parents main.cpp scope.cpp .tmp/logger1.0.0/ && (cd `dirname .tmp/logger1.0.0` && $(TAR) logger1.0.0.tar logger1.0.0 && $(COMPRESS) logger1.0.0.tar) && $(MOVE) `dirname .tmp/logger1.0.0`/logger1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/logger1.0.0
 
 
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
 
 
####### Sub-libraries
 
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
 
 
check: first
 
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_scope.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_scope.cpp
moc_scope.cpp: scope.h
/usr/bin/moc $(DEFINES) $(INCPATH) scope.h -o moc_scope.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:
compiler_uic_clean:
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
 
####### Compile
 
main.o: main.cpp scope.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
 
scope.o: scope.cpp scope.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o scope.o scope.cpp
 
moc_scope.o: moc_scope.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_scope.o moc_scope.cpp
 
####### Install
 
install: FORCE
 
uninstall: FORCE
 
FORCE:
 
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/logger.pro
0,0 → 1,12
######################################################################
# Automatically generated by qmake (2.01a) Mon Jul 11 05:34:36 2011
######################################################################
 
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
 
# Input
HEADERS += scope.h
SOURCES += main.cpp scope.cpp
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/main.cpp
0,0 → 1,33
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
 
#include "scope.h"
 
 
class Window : public QWidget
{
public:
Window(QWidget *parent = 0);
};
 
 
Window::Window(QWidget *parent)
: QWidget(parent)
{
Scope *scope = new Scope;
 
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(scope);
setLayout(layout);
}
 
 
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
window.setGeometry(800, 200, 560, 690);
window.show();
return app.exec();
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/moc_scope.cpp
0,0 → 1,84
/****************************************************************************
** Meta object code from reading C++ file 'scope.h'
**
** Created: Sun Jul 17 22:19:53 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
 
#include "scope.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'scope.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 62
#error "This file was generated using the moc from 4.7.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_Scope[] = {
 
// content:
5, // revision
0, // classname
0, 0, // classinfo
3, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
 
// slots: signature, parameters, type, tag, flags
7, 6, 6, 6, 0x0a,
21, 17, 6, 6, 0x0a,
35, 17, 6, 6, 0x0a,
 
0 // eod
};
 
static const char qt_meta_stringdata_Scope[] = {
"Scope\0\0getData()\0val\0setScale(int)\0"
"setShift(int)\0"
};
 
const QMetaObject Scope::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_Scope,
qt_meta_data_Scope, 0 }
};
 
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &Scope::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
 
const QMetaObject *Scope::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
 
void *Scope::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Scope))
return static_cast<void*>(const_cast< Scope*>(this));
return QWidget::qt_metacast(_clname);
}
 
int Scope::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: getData(); break;
case 1: setScale((*reinterpret_cast< int(*)>(_a[1]))); break;
case 2: setShift((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
_id -= 3;
}
return _id;
}
QT_END_MOC_NAMESPACE
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/scope.cpp
0,0 → 1,119
#include "scope.h"
 
#include <QPainter>
#include <QString>
 
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
#define LEN 256
#define DEF_SCALE 64
#define DEF_SHIFT 0
 
#define LEFT 10
#define WIDTH 512
#define HEIGHT 600
 
#define PIXPT 2
 
Scope::Scope(QWidget *parent) {
dataAquired=0;
head=-1;
 
data=new long[LEN*sizeof(long)]; ;
 
int i;
for(i=1;i<LEN;i++)
data[i]=0;
 
scale=DEF_SCALE;
shift=DEF_SHIFT;
scaleSlider = new QSlider(Qt::Horizontal);
scaleSlider->setRange(1, 128);
scaleSlider->setValue(DEF_SCALE);
connect(scaleSlider, SIGNAL(valueChanged(int)), this, SLOT(setScale(int)));
shiftSlider = new QSlider(Qt::Horizontal);
shiftSlider->setRange(-60000, +60000);
shiftSlider->setValue(DEF_SHIFT);
connect(shiftSlider, SIGNAL(valueChanged(int)), this, SLOT(setShift(int)));
 
updateTimer = new QTimer(this);
updateTimer->start(1);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(getData()));
scaleSlider->setGeometry(QRect(50,250,400,10));
scaleSlider->show();
shiftSlider->setGeometry(QRect(50,300,800,10));
shiftSlider->show();
}
 
 
Scope::~Scope() {
delete [] data;
}
 
 
void Scope::paintEvent(QPaintEvent* event) {
 
QPainter painter(this);
 
if (head>-1)
painter.drawText(10,20,QString::number(data[head]));
 
if (dataAquired) {
painter.drawLine(LEFT-1,45,LEFT-1,HEIGHT);
painter.drawLine(LEFT+WIDTH,45,LEFT+WIDTH,HEIGHT);
painter.drawLine(LEFT-1,45,LEFT+WIDTH,45);
painter.drawLine(LEFT-1,HEIGHT,LEFT+WIDTH,HEIGHT);
 
painter.drawLine(LEFT-1,HEIGHT/2,LEFT+WIDTH,HEIGHT/2);
 
int i;
data[head] = (data[head] + shift)/scale;
data[head] = data[head] + HEIGHT/2;
 
for(i=head+1;i<LEN-1;i++)
painter.drawLine(PIXPT*(i-head)+LEFT,HEIGHT-data[i],PIXPT*(i-head+1)+LEFT,HEIGHT-data[i+1]);
painter.drawLine(PIXPT*(LEN-head-1)+LEFT,HEIGHT-data[LEN-1],PIXPT*(LEN-head+1)+LEFT,HEIGHT-data[0]);
for(i=0;i<head;i++)
painter.drawLine(PIXPT*(i+LEN-head)+LEFT,HEIGHT-data[i],PIXPT*(i+LEN-head+1)+10,HEIGHT-data[i+1]);
}
}
 
void Scope::getData() {
char c='v';
 
FILE *serial=fopen("/dev/ttyUSB0","r+");
fwrite(&c,sizeof(char),1,serial); // poprosime o data
 
if (head != LEN-1)
head++;
else
head=0;
 
fscanf(serial,"%ld",&data[head]);
fclose(serial);
 
cout << data[head] <<endl;
 
if (head>0)
dataAquired=1;
 
update();
}
 
 
void Scope::setScale(int val) {
scale=val;
}
 
void Scope::setShift(int val) {
shift=val;
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/logger/scope.h
0,0 → 1,36
#ifndef SCOPE_H
#define SCOPE_H
 
#include <QWidget>
#include <QTimer>
#include <QSlider>
 
class Scope : public QWidget
{
Q_OBJECT
 
public:
Scope(QWidget *parent = 0);
~Scope();
 
public slots:
void getData();
void setScale(int val);
void setShift(int val);
 
protected:
void paintEvent(QPaintEvent *event);
 
private:
signed long * data;
char dataAquired;
int head;
long shift, scale;
 
QTimer *updateTimer;
QSlider *shiftSlider;
QSlider *scaleSlider;
};
 
#endif