1 |
#ifndef SCOPE_H |
1 |
#ifndef SCOPE_H |
2 |
#define SCOPE_H |
2 |
#define SCOPE_H |
3 |
|
3 |
|
4 |
#include <QWidget> |
4 |
#include <QWidget> |
5 |
#include <QTimer> |
5 |
#include <QTimer> |
6 |
#include <QSlider> |
6 |
#include <QSlider> |
7 |
#include <stdint.h> |
7 |
#include <stdint.h> |
- |
|
8 |
#include <QLabel> |
8 |
|
9 |
|
9 |
#define TICK 150 // time in ms for one sampling (of LEN values) |
10 |
#define TICK 250 // time in ms for one sample (LEN values) |
10 |
#define LEN 100 // number of sampled values |
11 |
#define LEN 100 // number of sampled values |
11 |
|
12 |
|
12 |
#define DEF_SCALE 256 //divisor |
13 |
#define DEF_SCALE 128 //divisor |
13 |
#define DEF_SHIFT 0 |
14 |
#define DEF_SHIFT 37203 |
14 |
|
15 |
|
15 |
#define LEFT 10 |
16 |
#define LEFT 10 |
16 |
#define TOP 10 |
17 |
#define TOP 10 |
17 |
#define PIXPT_X 4 |
18 |
#define PIXPT_X 4 |
18 |
#define PIXPT_Y 1 |
19 |
#define PIXPT_Y 1 |
19 |
#define WIDTH (PIXPT_X*LEN) |
20 |
#define WIDTH (PIXPT_X*LEN) |
20 |
#define HEIGHT (PIXPT_Y*512) |
21 |
#define HEIGHT (PIXPT_Y*512) |
21 |
|
22 |
|
22 |
class Scope : public QWidget |
23 |
class Scope : public QWidget |
23 |
{ |
24 |
{ |
24 |
Q_OBJECT |
25 |
Q_OBJECT |
25 |
|
26 |
|
26 |
public: |
27 |
public: |
27 |
Scope(QWidget *parent = 0); |
28 |
Scope(QWidget *parent = 0); |
28 |
~Scope(); |
29 |
~Scope(); |
29 |
|
30 |
|
30 |
public slots: |
31 |
public slots: |
31 |
void getData(); |
32 |
void getData(); |
32 |
void setScale(int val); |
33 |
void setScale(int val); |
33 |
void setShift(int val); |
34 |
void setShift(int val); |
34 |
|
35 |
|
35 |
protected: |
36 |
protected: |
36 |
void paintEvent(QPaintEvent *event); |
37 |
void paintEvent(QPaintEvent *event); |
37 |
|
38 |
|
38 |
private: |
39 |
private: |
- |
|
40 |
|
39 |
uint8_t buffer[2*LEN]; |
41 |
uint8_t buffer[2*LEN]; |
40 |
int data[LEN]; |
42 |
int data[LEN]; |
41 |
char dataAquired; |
43 |
char dataAquired; |
- |
|
44 |
void UI(void); |
42 |
|
45 |
|
43 |
long shift, scale; |
46 |
int shift, scale; |
44 |
|
47 |
|
45 |
QTimer *updateTimer; |
48 |
QTimer *updateTimer; |
46 |
QSlider *shiftSlider; |
49 |
QSlider *shiftSlider; |
47 |
QSlider *scaleSlider; |
50 |
QSlider *scaleSlider; |
- |
|
51 |
|
- |
|
52 |
QLabel * labels[5]; |
48 |
}; |
53 |
}; |
49 |
|
54 |
|
50 |
#endif |
55 |
#endif |