Line 4... |
Line 4... |
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 |
|
8 |
|
- |
|
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 |
|
9 |
class Scope : public QWidget |
22 |
class Scope : public QWidget |
10 |
{ |
23 |
{ |
11 |
Q_OBJECT |
24 |
Q_OBJECT |
12 |
|
25 |
|
13 |
public: |
26 |
public: |
Line 21... |
Line 34... |
21 |
|
34 |
|
22 |
protected: |
35 |
protected: |
23 |
void paintEvent(QPaintEvent *event); |
36 |
void paintEvent(QPaintEvent *event); |
24 |
|
37 |
|
25 |
private: |
38 |
private: |
- |
|
39 |
uint8_t buffer[2*LEN]; |
26 |
int * data; |
40 |
int data[LEN]; |
27 |
char dataAquired; |
41 |
char dataAquired; |
28 |
int head; |
- |
|
29 |
|
42 |
|
30 |
long shift, scale; |
43 |
long shift, scale; |
31 |
|
44 |
|
32 |
QTimer *updateTimer; |
45 |
QTimer *updateTimer; |
33 |
QSlider *shiftSlider; |
46 |
QSlider *shiftSlider; |