2017-10-21 06:11:49 +01:00
|
|
|
#ifndef FUNCTIONGENCONTROL_H
|
|
|
|
#define FUNCTIONGENCONTROL_H
|
|
|
|
|
2019-03-04 09:02:19 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFile>
|
|
|
|
#include "xmega.h"
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
|
|
//functionGenControl is a centralised object to control all of the high-level function gen commands for both channels.
|
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
namespace functionGen {
|
|
|
|
|
|
|
|
enum class ChannelID
|
2017-10-21 06:11:49 +01:00
|
|
|
{
|
2021-11-16 03:28:55 +00:00
|
|
|
CH1 = 0,
|
|
|
|
CH2 = 1
|
2019-03-25 23:12:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ChannelData
|
|
|
|
{
|
2021-11-16 03:28:55 +00:00
|
|
|
std::vector<uint8_t> samples;
|
|
|
|
int divisibility;
|
|
|
|
double freq = 1000.0;
|
|
|
|
double amplitude = 0.0;
|
|
|
|
double offset = 0.0;
|
2019-03-25 23:12:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SingleChannelController : public QObject
|
|
|
|
{
|
2021-11-16 03:28:55 +00:00
|
|
|
Q_OBJECT
|
2019-03-25 23:12:08 +00:00
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
public:
|
2021-11-16 03:28:55 +00:00
|
|
|
ChannelData const& getData() const;
|
2019-03-04 09:02:19 +00:00
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
signals:
|
|
|
|
void notifyUpdate(SingleChannelController* controller);
|
2021-11-16 03:28:55 +00:00
|
|
|
void setMaxFreq(double maxFreq);
|
2019-03-25 23:12:08 +00:00
|
|
|
void setMinFreq(double minFreq);
|
2019-03-07 08:58:52 +00:00
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
public slots:
|
|
|
|
void waveformName(QString newName);
|
|
|
|
void freqUpdate(double newFreq);
|
|
|
|
void amplitudeUpdate(double newAmplitude);
|
|
|
|
void offsetUpdate(double newOffset);
|
2019-03-04 09:02:19 +00:00
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
private:
|
2021-11-16 03:28:55 +00:00
|
|
|
ChannelData m_data;
|
2019-03-25 23:12:08 +00:00
|
|
|
};
|
2019-03-04 09:02:19 +00:00
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
class DualChannelController : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-03-07 08:58:52 +00:00
|
|
|
public:
|
2019-03-25 23:12:08 +00:00
|
|
|
explicit DualChannelController(QWidget *parent = 0);
|
2019-03-04 09:02:19 +00:00
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
public:
|
2021-11-16 03:28:55 +00:00
|
|
|
SingleChannelController* getChannelController(ChannelID channelID);
|
2019-03-04 09:02:19 +00:00
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
signals:
|
2019-03-25 23:12:08 +00:00
|
|
|
void functionGenToUpdate(ChannelID channel, SingleChannelController* fGenControl);
|
2017-10-21 06:11:49 +01:00
|
|
|
void setMaxFreq_CH1(double maxFreq);
|
|
|
|
void setMinFreq_CH1(double minFreq);
|
|
|
|
void setMaxFreq_CH2(double maxFreq);
|
|
|
|
void setMinFreq_CH2(double minFreq);
|
2019-03-07 08:58:52 +00:00
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
public slots:
|
2019-03-25 23:12:08 +00:00
|
|
|
void waveformName(ChannelID channelID, QString newName);
|
|
|
|
void freqUpdate(ChannelID channelID, double newFreq);
|
|
|
|
void amplitudeUpdate(ChannelID channelID, double newAmplitude);
|
|
|
|
void offsetUpdate(ChannelID channelID, double newOffset);
|
2019-03-07 08:58:52 +00:00
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
void waveformName_CH1(QString newName);
|
|
|
|
void freqUpdate_CH1(double newFreq);
|
|
|
|
void amplitudeUpdate_CH1(double newAmplitude);
|
|
|
|
void offsetUpdate_CH1(double newOffset);
|
2019-03-25 23:12:08 +00:00
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
void waveformName_CH2(QString newName);
|
|
|
|
void freqUpdate_CH2(double newFreq);
|
|
|
|
void amplitudeUpdate_CH2(double newAmplitude);
|
|
|
|
void offsetUpdate_CH2(double newOffset);
|
2019-03-25 23:12:08 +00:00
|
|
|
|
|
|
|
private:
|
2021-11-16 03:28:55 +00:00
|
|
|
SingleChannelController m_channels[2];
|
2017-10-21 06:11:49 +01:00
|
|
|
};
|
|
|
|
|
2019-03-25 23:12:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
using functionGenControl = functionGen::DualChannelController;
|
|
|
|
|
2017-10-21 06:11:49 +01:00
|
|
|
#endif // FUNCTIONGENCONTROL_H
|