-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscopewidget.h
73 lines (53 loc) · 1.43 KB
/
scopewidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Scope widget
Copyright 2006-2016
Niels A. Moseley
Pieter-Tjerk de Boer
License: GPLv2
*/
#ifndef scopewidget_h
#define scopewidget_h
#include <stdint.h>
#include <vector>
#include <QWidget>
#include <QImage>
#include "virtualmachine.h"
class ScopeWidget : public QWidget
{
Q_OBJECT
public:
ScopeWidget(QWidget *parent);
void submit256Samples(VirtualMachine::ring_buffer_data_t *buffer);
/** set sample rate for correct x-axis scaling */
void setSampleRate(float rate);
/** enable or disable the state */
void setTriggerState(bool enabled);
/** set to which channel the scope will trigger */
void setTriggerChannel(uint32_t channelID)
{
m_trigChannel = channelID;
}
/** set the trigger level */
void setTriggerLevel(float level)
{
m_trigLevel = level;
}
protected:
void paintEvent(QPaintEvent *event);
int32_t y2pix(float yvalue);
int32_t x2pix(float xvalue);
std::vector<VirtualMachine::ring_buffer_data_t> m_trigStorage;
std::vector<VirtualMachine::ring_buffer_data_t> m_signal;
float m_timespan;
float m_ymin,m_ymax;
// trigger related variables
bool m_trigSearch;
bool m_trigEnabled;
float m_trigLevel;
float m_lastSample;
uint32_t m_trigChannel;
uint32_t m_samplesStored;
bool m_forceAxisRedraw;
QImage *m_bkbuffer;
};
#endif