summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/ftnoir_tracker_hat.h
blob: b23005561971ecd762d84797de6c7907cd0448e9 (plain)
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
#pragma once

#include "thread.hpp"
#include "api/plugin-api.hpp"
#include "ftnoir_tracker_hat_settings.h"
#include "ftnoir_arduino_type.h"

#include <atomic>

#include <QObject>
#include <QByteArray>
#include <QMessageBox>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QSettings>

class hatire : public QObject, public ITracker
{
    Q_OBJECT

public:
    hatire();
    ~hatire() override;

    module_status start_tracker(QFrame*) override;
    void data(double *data) override;
    //void center();
    //bool notifyZeroed();
    void reset();
    void get_info(int *tps);
    void serial_info();
    void send_serial_command(const QByteArray& x);

    hatire_thread t;
private:
    TArduinoData ArduinoData {}, HAT {};
    QByteArray Begin;
    QByteArray End;

    TrackerSettings s;

    int frame_cnt = 0;

    std::atomic<int> CptError { 0 };

    static inline QByteArray to_latin1(const QString& str) { return str.toLatin1(); }
};

class hatire_metadata : public Metadata
{
    Q_OBJECT

    QString name() override { return tr("Hatire Arduino"); }
    QIcon icon() override { return QIcon(":/images/hat.png"); }
};