You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.5 KiB

4 years ago
#ifndef REGISTER_H
#define REGISTER_H
#include "model/hardware/core/register/Field.h"
#include "model/hardware/device/SonoDevice.h"
4 years ago
#include <QtMath>
#include <math.h>
4 years ago
class Register
{
private:
virtual void prepareData(quint32){}
virtual void receiveData(void){}
4 years ago
protected:
quint32 _bar;
quint32 _offset;
quint32 _baseOffset;
quint32 _arrayLength;
quint32 _value;
bool _isUpdated;
QList<Field*> _fields;
SonoDevice* _device;
public:
Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array
virtual ~Register();
4 years ago
quint32 getValue();
void setValue(quint32 value);
void changeOffset(quint32 offset);
quint32 getCurrentOffset (void) const;
bool isUpdated();
void update();
4 years ago
void updateLong();
void updateArray(bool isVariable=false, quint8 arrayLength=0);
void updateArrayLong(quint8 interval, quint32 arrayLength);
4 years ago
void sync();
void syncArray();
4 years ago
static QVector<quint32> qntzr(QVector<float> &data,
quint32 sign,
quint32 wordlength,
quint32 fractionalLength,
float maxLevel,
bool integerOutput,
bool useRound = true,
bool twosCmpl = false);
4 years ago
};
4 years ago
4 years ago
#endif //rEGISTER_H