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/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
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/scope/Makefile
0,0 → 1,218
#############################################################################
# Makefile for building: scope4
# Generated by qmake (2.01a) (Qt 4.7.2) on: Sun May 15 01:51:53 2011
# Project: scope4.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile scope4.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 \
scope4.pro
QMAKE_TARGET = scope4
DESTDIR =
TARGET = scope4
 
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: scope4.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 scope4.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 scope4.pro
 
dist:
@$(CHK_DIR_EXISTS) .tmp/scope41.0.0 || $(MKDIR) .tmp/scope41.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/scope41.0.0/ && $(COPY_FILE) --parents scope.h .tmp/scope41.0.0/ && $(COPY_FILE) --parents main.cpp scope.cpp .tmp/scope41.0.0/ && (cd `dirname .tmp/scope41.0.0` && $(TAR) scope41.0.0.tar scope41.0.0 && $(COMPRESS) scope41.0.0.tar) && $(MOVE) `dirname .tmp/scope41.0.0`/scope41.0.0.tar.gz . && $(DEL_FILE) -r .tmp/scope41.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/scope/main.cpp
0,0 → 1,31
#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(1200, 200, 570, 390);
window.show();
return app.exec();
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/scope/scope.cpp
0,0 → 1,53
#include "scope.h"
 
#include <QPainter>
#include <iostream>
#include <stdio.h>
 
using namespace std;
 
#define LEN 128
 
 
Scope::Scope(QWidget *parent) {
dataAquired=0;
 
updateTimer = new QTimer(this);
updateTimer->start(250);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(getData()));
}
 
 
Scope::~Scope() {
delete [] data;
}
 
 
void Scope::paintEvent(QPaintEvent* event) {
if (dataAquired) {
QPainter painter(this);
 
painter.drawLine(9,45,9,300);
painter.drawLine(522,45,522,300);
painter.drawLine(9,45,522,45);
painter.drawLine(9,300,522,300);
int i;
for(i=0;i<LEN-1;i++) {
painter.drawLine(4*i+10,300-(unsigned char)data[i],4*i+4+10,300-(unsigned char)data[i+1]);
}
}
}
 
void Scope::getData() {
char c='a';
data=new char[LEN*sizeof(char)];
 
FILE *serial=fopen("/dev/ttyUSB0","r+");
fwrite(&c,sizeof(char),1,serial); // ask for data
fread(data,sizeof(char),LEN,serial); // and take them
fclose(serial);
 
dataAquired=1;
update();
}
 
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/scope/scope.h
0,0 → 1,28
#ifndef SCOPE_H
#define SCOPE_H
 
#include <QWidget>
#include <QTimer>
 
class Scope : public QWidget
{
Q_OBJECT
 
public:
Scope(QWidget *parent = 0);
~Scope();
 
public slots:
void getData();
 
protected:
void paintEvent(QPaintEvent *event);
 
private:
char * data;
char dataAquired;
 
QTimer *updateTimer;
};
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/scope/scope4
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/scope/scope4.pro
0,0 → 1,12
######################################################################
# Automatically generated by qmake (2.01a) Sun May 15 01:51:49 2011
######################################################################
 
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
 
# Input
HEADERS += scope.h
SOURCES += main.cpp scope.cpp
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/PC_side/stty_setting.txt
0,0 → 1,2
stty -F /dev/ttyUSB0 1000000 raw -hupcl
 
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/Makefile
0,0 → 1,35
PRG = fluxgate
OBJ = main.o ./libs/usart.o ./libs/spi.o ./libs/mcp4922.o
MCU_TARGET = atmega8
AVRDUDE_PART = m8
 
# OPTIMIZE = -O1
OPTIMIZE = -Os
 
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
 
all: hex
 
#./libs/adc.o: ./libs/adc.h
./libs/spi.o: ./libs/spi.h
./libs/usart.o: ./libs/usart.h
./libs/mcp4922.o: ./libs/mcp4922.h
#./libs/timer.o: ./libs/timer.h
 
hex: $(PRG).hex
 
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
 
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 
load: $(PRG).hex
avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB1 -B 1 -U flash:w:$<
 
clean:
rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o
 
Property changes:
Added: svn:executable
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/adc.c
0,0 → 1,32
#include "adc.h"
 
#include <avr/io.h>
 
void AD_Init_Interrupt() {
ADMUX = 0b01000000; // PORTC_0,Vref=V_ACC,capacitor on AVREF
 
ADCSRA = (0b00000011); // 8 Prescaling
ADCSRA |= (1 << ADFR); // Set ADC to Free-Running Mode
ADCSRA |= (1 << ADIE); // enable interrupt
// sei();
ADCSRA |= (1 << ADEN); // Enable ADC
ADCSRA |= (1 << ADSC); // Start A2D Conversions
}
 
 
void AD_Init() {
ADMUX = 0b01000000; // PORTC_0,Vref=Vacc with cap. on ref.
 
ADCSRA |= (0b00000101); // 32 Prescaling
ADCSRA |= (1 << ADFR); // Set ADC to Free-Running Mode
ADCSRA |= (1 << ADEN); // Enable ADC
ADCSRA |= (1 << ADSC); // Start A2D Conversions
}
 
 
unsigned char AD_Read() {
char val;
val=(ADCL>>2); // low must be read first!! see datasheet...
val|=(ADCH<<6);
return val;
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/adc.h
0,0 → 1,8
#ifndef ADC_H
#define ADC_H
 
void AD_Init_Interrupt();
void AD_Init();
unsigned char AD_Read();
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/mcp4922.c
0,0 → 1,15
#include <avr/io.h>
#include "mcp4922.h"
#include "spi.h"
 
 
void DAC_write(unsigned char data) {
unsigned char first, second;
first=(0b10110000 | data>>4); // DACB, unbuffered, 1x, ON, 12 data bites
second=(data<<4);
DAC_CS_PORT &= ~(1 << DAC_CS_PIN);
SPI_MasterTransmit(first);
SPI_MasterTransmit(second);
DAC_CS_PORT |= 1 << DAC_CS_PIN;
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/mcp4922.h
0,0 → 1,9
#ifndef MCP4922_H
#define MCP4922_H
 
#define DAC_CS_PORT PORTB
#define DAC_CS_PIN 1
 
void DAC_write(unsigned char data);
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/spi.c
0,0 → 1,20
#include "spi.h"
 
#include <avr/io.h>
 
void SPI_MasterInit(void)
{
/* Enable SPI, Master, set clock rate fck/16, SCK high when idle, sample on rising */
// SPSR|= 0b00000001;
SPCR = 0b01011101;
}
 
unsigned char SPI_MasterTransmit(unsigned char cData) {
/* Start transmission */
SPDR = cData;
 
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
;
return SPDR;
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/spi.h
0,0 → 1,7
#ifndef SPI_H
#define SPI_H
 
void SPI_MasterInit(void);
unsigned char SPI_MasterTransmit(unsigned char cData);
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/timer.c
0,0 → 1,14
#include "timer.h"
 
#include <avr/io.h>
 
void Timer0_Init_Interrupt() {
TIMSK |= 0b0000001; // Enable overflow interrupt tim0
TCCR0=0b00000010; //8 prescale,start timer
}
 
void Timer1_Init_Interrupt() {
TIMSK |= 0b00000100; // Enable overflow interrupt tim1
TCCR1B=0b00000010; //8 prescale,start timer
}
 
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/timer.h
0,0 → 1,7
#ifndef TIMER_H
#define TIMER_H
 
void Timer0_Init_Interrupt();
void Timer1_Init_Interrupt();
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/usart.c
0,0 → 1,104
#include "usart.h"
 
#include <avr/io.h>
 
 
void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
 
/* flush transmitt register Double speed */
UCSRA = (1<<UDRE)|(1 << U2X);
 
/* enable receiver interrupt and transmitter, pins forced */
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
 
/* Asynchronous, no parity, Set frame format: 8data, 1stop bit */
UCSRC = (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1);
}
 
 
void USART_Transmit( unsigned char data )
{
while ( !( UCSRA & (1<<UDRE)) ); /* Wait for empty transmit buffer */
 
UDR = data; /* Put data into buffer, sends the data */
}
 
 
void USART_Transmit_string( char *data )
{
while ( *data != 0 ) {
USART_Transmit(*data);
data++;
}
}
 
 
void USART_Transmit_longnum(signed long data ) {
unsigned char digits[10],i;
 
if (data==0)
USART_Transmit('0');
else { // PROZKOUMAT!
 
if (data<0) {
USART_Transmit('-');
data*=-1;
}
 
for (i=0;i<10;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=9;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_num(unsigned char data ) {
unsigned char a,b,c;
 
c=data%10;
data=data/10;
b=data%10;
data=data/10;
a=data%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}
 
 
/*void USART_Transmit_float( float data ) {
int a,b,c;
 
c=((int)data)%10;
b=((int)(data/10))%10;
a=((int)(data/100))%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}*/
 
 
void USART_Transmit_byte( char data ) {
unsigned char i;
i=0b10000000;
while (i) {
USART_Transmit( ( (i&data)&&1 ) + 48 );
i>>=1;
}
}
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/libs/usart.h
0,0 → 1,16
#ifndef USART_H
#define USART_H
 
//Inits:
void USART_Init( unsigned int ubrr); // 8b, no parity, 1 stop
// asynchronous, RX interrupt
 
// Busy loop send:
void USART_Transmit( unsigned char data ); // send char (1B)
void USART_Transmit_string( char *data ); // send string
void USART_Transmit_num( unsigned char data ); // send ascii
void USART_Transmit_longnum( signed long data ); // send ascii
//void USART_Transmit_float( float data );
void USART_Transmit_byte( char data ); //send in ascii hex reprezentation
 
#endif
/Designs/Measuring_instruments/Fluxgate_magnetometer/SW/firmware/main.c
0,0 → 1,145
// Template - Roman Pavelka, 2011
// written for atmega8
 
#define F_CPU 16000000
#define BAUD 1000000
//#define MYUBRR F_CPU/8/BAUD-1
#define MYUBRR 1
 
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
 
#include "./libs/usart.h"
#include "./libs/spi.h"
//#include "./libs/mcp4922.h"
//#include "./libs/adc.h"
//#include "./libs/timer.h"
 
 
#define LEN 128
 
void act(void);
void drive(unsigned char t);
 
int main (void) {
USART_Init(MYUBRR);
PORTC = 0b00000000; // drive port
DDRC = 0b00000011; // drive port out
 
DDRB = 0b00101110; //MOSI out CONV out, DAC CS out
PORTB = 0b00101010; // SCK, MOSI, CONV, DAC high
SPI_MasterInit();
 
sei();
 
while (1) ;
return 0;
}
 
 
void act(void) {
 
unsigned char data[2*LEN];
unsigned char i,j;
 
for(j=0;j<40;j++) {
for(i=0;i<LEN;i++) {
drive(i);
_delay_us(5);
}
}
 
for(i=0;i<LEN;i++) {
drive(i);
 
PORTB |= 0b00000100;
_delay_us(4); // converting
PORTB &= 0b11111011;
 
data[2*i]=SPI_MasterTransmit(0x0);
data[2*i+1]=SPI_MasterTransmit(0x0);
}
 
PORTC=0;
 
for(i=0;i<LEN;i++) {
USART_Transmit(data[2*i]);
// USART_Transmit(data[2*i+1]);
}
 
}
 
 
void value(void) {
 
unsigned char i,j;
long resultH,resultL;
 
resultH=0;
resultL=0;
 
for(j=0;j<32;j++) {
for(i=0;i<LEN;i++) {
drive(i);
_delay_us(5);
}
}
 
for(j=0;j<4;j++) {
for(i=0;i<LEN/2;i++) {
drive(i);
 
PORTB |= 0b00000100;
_delay_us(4); // converting
PORTB &= 0b11111011;
 
resultH+=(unsigned char)SPI_MasterTransmit(0x0);
resultL+=(unsigned char)SPI_MasterTransmit(0x0);
}
for(i=LEN/2;i<(LEN/4)*3;i++) { //dela podivnou kvantitatizaci vysledku
drive(i);
 
PORTB |= 0b00000100;
_delay_us(4); // converting
PORTB &= 0b11111011;
 
resultH-=(unsigned char)SPI_MasterTransmit(0x0);
resultL-=(unsigned char)SPI_MasterTransmit(0x0);
}
}
 
PORTC=0; // drive off
 
// resultH *= 256;
// USART_Transmit_longnum(resultH+resultL);
 
USART_Transmit_longnum(resultH);
 
USART_Transmit('\n');
}
 
 
ISR(USART_RXC_vect) {
cli();
char c;
 
c=UDR; //must be read to untrigger interupt
 
if (c=='a')
act();
else if (c=='v')
value();
 
sei();
}
 
 
void drive(unsigned char t) {
if (t<LEN/2)
PORTC = 0b00000001;
else
PORTC = 0b00000010;
}