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