-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLogicFeeder.h
44 lines (36 loc) · 973 Bytes
/
LogicFeeder.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
#ifndef LADATA_FEEDER
#define LADATA_FEEDER
#include <libsigrokcxx/libsigrokcxx.hpp>
class wxEvtHandler;
struct LogicFeederConfig
{
size_t blocksize;
size_t bitsPerSample;
size_t numTotalChannels;
size_t parallelChannelsPerSample = 1;
};
class LogicFeeder
{
public:
LogicFeeder(wxEvtHandler *handler, int id, const LogicFeederConfig &config);
~LogicFeeder();
void data_feed_callback(std::shared_ptr<sigrok::Device> device, std::shared_ptr<sigrok::Packet> packet);
protected:
void clearTraces();
void allocateNeededBuffers();
void freeBuffer();
void appendToBuffer(double data);
int64_t convertToSigned(uint64_t raw_sample);
wxEvtHandler *evtHandler_;
int id_;
size_t *sweepPoints_;
double **vals_;
double divider_;
size_t signBitPosition_;
size_t bitsPerSample_;
size_t parallelChannelsPerSample_;
size_t numTotalChannels_;
size_t channelIdx_;
size_t blocksize_;
};
#endif